-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(python): Implement user-facing Schema class (#366)
General design: - One `Schema` class. I could do many subclasses also, but the autocomplete is sort of nice and checking `schema.type` is maybe nicer than `isinstance(x, x)`. This means some properties return `None` for types where the property is not relevant (they could error, too, or be dynamically added). - Very fast `Schema` construction from an existing `CSchema` (e.g., imported from somewhere) - Somewhat slower performance if you work with these objects in Python (copies of children, looping over columns in Python, etc.) Example: ```python import nanoarrow as na na.struct({"col1": na.int32()}) #> Schema(STRUCT, fields=[Schema(INT32, name='col1')]) na.fixed_size_binary(123) #> Schema(FIXED_SIZE_BINARY, byte_width=123) schema = na.fixed_size_binary(123) schema.byte_width #> 123 ``` Things not implemented here for future PRs: - A few types: list, map, dictionary, extension, union - Metadata --------- Co-authored-by: Joris Van den Bossche <[email protected]>
- Loading branch information
1 parent
c4844e3
commit 5d56676
Showing
7 changed files
with
1,530 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.