Refactor findSchemaElement to use named struct and add column_index#35
Merged
Refactor findSchemaElement to use named struct and add column_index#35
Conversation
- Define SchemaInfo struct instead of anonymous struct - Add column_index field that corresponds to the index in row group columns array - Track column_index by counting only leaf elements (elements without children) - Update NYC taxi example to use column_index directly instead of index - 1 - Update README example to use column_index - Add tests for findSchemaElement covering flat and nested schemas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem: The
findSchemaElementmethod returned a schema index that required users to subtract 1 to get the column index (as seen in the NYC taxi example:file.findSchemaElement(&.{name}).?.index - 1).Solution:
Define a named struct
SchemaInfoinstead of anonymous struct with fields:column_index- index into the row group's columns array (leaf elements only)max_definition_level- for handling nullabilitymax_repetition_level- for handling repeated elementselem- the schema element itselfUpdate
findSchemaElementto track the column index by counting only leaf elements (elements without children) as it traverses the schema tree.Update the NYC taxi example and README to use
column_indexdirectly instead ofindex - 1.Add tests for:
roll_num.min→ 0,roll_num.variance→ 5,PC_CUR.min→ 6)