Skip to content

Commit f0d35de

Browse files
committed
calculate max_id with for-loop to see if we can pass all tests, will revert if needed
1 parent c76e612 commit f0d35de

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

parquet-variant/src/builder.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,11 +1266,8 @@ impl<'a> ObjectBuilder<'a> {
12661266
field_a_name.cmp(field_b_name)
12671267
});
12681268

1269-
// the length of the metadata's field names is a very cheap to compute the upper bound.
1270-
// it will almost always be a tight upper bound as well -- it would take a pretty
1271-
// carefully crafted object to use only the early field ids of a large dictionary.
1272-
let max_id = metadata_builder.field_names.len();
1273-
let id_size = int_size(max_id);
1269+
let max_id = self.fields.iter().map(|(i, _)| *i).max().unwrap_or(0);
1270+
let id_size = int_size(max_id as usize);
12741271

12751272
let parent_buffer = self.parent_state.buffer();
12761273
let current_offset = parent_buffer.offset();

0 commit comments

Comments
 (0)