Conversation
|
Here are some examples from a local GDB session. RunEndEncodedTypeRunEndEncodedType run_end_encoded_type(int32(), utf8());
auto heap_run_end_encoded_type =
run_end_encoded(int32(), utf8());
(gdb) p run_end_encoded_type
$1 = arrow::run_end_encoded(arrow::int32(), arrow::utf8())
(gdb) p *heap_run_end_encoded_type
$2 = (std::__shared_ptr_access<arrow::DataType, (__gnu_cxx::_Lock_policy)2, false, false>::element_type &) @0x555555f52f10:
arrow::run_end_encoded(arrow::int32(), arrow::utf8())RunEndEncodedScalarauto run_end_encoded_scalar_type =
run_end_encoded(int32(), utf8());
RunEndEncodedScalar run_end_encoded_scalar{
MakeScalar("foo"), run_end_encoded_scalar_type};
RunEndEncodedScalar run_end_encoded_scalar_null{
run_end_encoded_scalar_type};
(gdb) p run_end_encoded_scalar
$3 = arrow::RunEndEncodedScalar of value
arrow::StringScalar of size 3, value "foo"
(gdb) p run_end_encoded_scalar_null
$4 = arrow::RunEndEncodedScalar of type
arrow::run_end_encoded(arrow::int32(), arrow::utf8()),
null valueRunEndEncodedArray// Encodes ["foo", "foo", null, null, null].
auto run_end_encoded_run_ends =
SliceArrayFromJSON(int32(), "[2, 5]");
auto run_end_encoded_values =
SliceArrayFromJSON(utf8(), R"(["foo", null])");
auto heap_run_end_encoded_array =
*RunEndEncodedArray::Make(
5, run_end_encoded_run_ends,
run_end_encoded_values);
auto heap_run_end_encoded_array_sliced =
heap_run_end_encoded_array->Slice(1, 3);
(gdb) p *heap_run_end_encoded_array
$5 = (std::__shared_ptr_access<arrow::Array, (__gnu_cxx::_Lock_policy)2, false, false>::element_type &) @0x555555fab440:
arrow::RunEndEncodedArray of type
arrow::run_end_encoded(arrow::int32(), arrow::utf8()),
length 5, offset 0, null count 0
(gdb) p *heap_run_end_encoded_array_sliced
$6 = (std::__shared_ptr_access<arrow::Array, (__gnu_cxx::_Lock_policy)2, false, false>::element_type &) @0x555555f7dd60:
arrow::RunEndEncodedArray of type
arrow::run_end_encoded(arrow::int32(), arrow::utf8()),
length 3, offset 1, null count 0 |
|
The |
| class RunEndEncodedTypeClass(DataTypeClass): | ||
| is_parametric = True | ||
| type_printer = RunEndEncodedTypePrinter | ||
| scalar_printer = BaseListScalarPrinter |
There was a problem hiding this comment.
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)
| is_parametric = True | ||
| type_printer = RunEndEncodedTypePrinter | ||
| scalar_printer = BaseListScalarPrinter | ||
|
|
There was a problem hiding this comment.
Ideally we would also define a array_data_printer to actually print out the array's contents but the current PR is obviously better than supporting REE at all.
| Type.RUN_END_ENCODED: DataTypeTraits(RunEndEncodedTypeClass, | ||
| 'RunEndEncodedType'), |
There was a problem hiding this comment.
Nit: since REE is not a list type, it would be better to move this below with Dictionary and Extension.
Rationale for this change
The Arrow GDB pretty-printers do not support run-end encoded data types.
What changes are included in this PR?
Add GDB pretty-printer support and tests for
run-end encodedtypes, scalars, and arrays.Are these changes tested?
Yes.
Are there any user-facing changes?
No.
gdb_arrow.py#50658