-
Notifications
You must be signed in to change notification settings - Fork 4.3k
GH-50658: [C++][Dev] Add RunEndEncoded support to gdb_arrow.py #50768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,7 +95,8 @@ def identity(v): | |
|
|
||
|
|
||
| def has_null_bitmap(type_id): | ||
| return type_id not in (Type.NA, Type.SPARSE_UNION, Type.DENSE_UNION) | ||
| return type_id not in (Type.NA, Type.SPARSE_UNION, Type.DENSE_UNION, | ||
| Type.RUN_END_ENCODED) | ||
|
|
||
|
|
||
| @lru_cache() | ||
|
|
@@ -1069,6 +1070,7 @@ def num_rows(self): | |
| 'SparseUnionType': 'sparse_union', | ||
| 'DenseUnionType': 'dense_union', | ||
| 'DictionaryType': 'dictionary', | ||
| 'RunEndEncodedType': 'run_end_encoded', | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -1170,6 +1172,20 @@ def to_string(self): | |
| return f"{self._format_type()}({child})" | ||
|
|
||
|
|
||
| class RunEndEncodedTypePrinter(TypePrinter): | ||
| """ | ||
| Pretty-printer for run-end encoded types. | ||
| """ | ||
|
|
||
| def to_string(self): | ||
| fields = self.fields | ||
| if len(fields) != 2: | ||
| return f"{self._format_type()}<uninitialized or corrupt>" | ||
| run_end_type = fields[0].type | ||
| value_type = fields[1].type | ||
| return f"{self._format_type()}({run_end_type}, {value_type})" | ||
|
|
||
|
|
||
| class FixedSizeListTypePrinter(ListTypePrinter): | ||
| """ | ||
| Pretty-printer for fixed-size list type. | ||
|
|
@@ -1999,6 +2015,12 @@ class FixedSizeListTypeClass(DataTypeClass): | |
| scalar_printer = BaseListScalarPrinter | ||
|
|
||
|
|
||
| class RunEndEncodedTypeClass(DataTypeClass): | ||
| is_parametric = True | ||
| type_printer = RunEndEncodedTypePrinter | ||
| scalar_printer = BaseListScalarPrinter | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we would also define a |
||
|
|
||
| class MapTypeClass(DataTypeClass): | ||
| is_parametric = True | ||
| type_printer = MapTypePrinter | ||
|
|
@@ -2085,6 +2107,8 @@ class ExtensionTypeClass(DataTypeClass): | |
| Type.LARGE_LIST: DataTypeTraits(BaseListTypeClass, 'LargeListType'), | ||
| Type.FIXED_SIZE_LIST: DataTypeTraits(FixedSizeListTypeClass, | ||
| 'FixedSizeListType'), | ||
| Type.RUN_END_ENCODED: DataTypeTraits(RunEndEncodedTypeClass, | ||
| 'RunEndEncodedType'), | ||
|
Comment on lines
+2110
to
+2111
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: since REE is not a list type, it would be better to move this below with Dictionary and Extension. |
||
| Type.MAP: DataTypeTraits(MapTypeClass, 'MapType'), | ||
|
|
||
| Type.STRUCT: DataTypeTraits(StructTypeClass, 'StructType'), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (using
BaseListScalarPrinter) might work by chance, but I don't think this is conceptually right. Run-end-encoded is not a list type, and a run-end-encoded scalar represents a single child value, not an entire run of values.(as the tests show, by the way)