Add list column support to the record batch API - #101
Draft
yogendra-17 wants to merge 2 commits into
Draft
Conversation
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.
Pull Request description
This adds list column support to the record batch API. It's the first bit of nested type support (lists now, structs later).
Right now the list element can be any fixed-width type - the int/uint/float types and the date/time types from #100. I left out bool, utf8 and lists-of-lists for now, those can come in a follow up. To make room for the nested stuff I added a small recursive type descriptor (
IrxRbType) so we can describe the element type through the C ABI and the ctypes layer.New things we can do:
schema.add_list_field(name, elem_type)to declare a list columnbuilder.append_list(col, values)to add one listbatch.get_list(col, row)to read it back (returns None for a null slot,empty list for an empty one)Reads are zero-copy - it uses the offsets buffer + the flattened child buffer instead of copying element by element. Also checked that it round-trips with pyarrow both ways.
Note: This is stacked on top of #100 (date/time), so it'll look cleaner to review once that one lands.
How to test these changes
cd packages/irxpython -m pytest tests/test_record_batch.pyThe list tests cover int/float/date lists, null and empty lists, the raw buffer round-trip, rejecting unsupported element types, and pyarrow interop.
...Pull Request checklists
This PR is a:
About this PR:
Author's checklist:
Additional information
Reviewer's checklist
Copy and paste this template for your review's note: