Skip to content

GH-50658: [C++][Dev] Add RunEndEncoded support to gdb_arrow.py - #50768

Open
fenfeng9 wants to merge 1 commit into
apache:mainfrom
fenfeng9:gh-50658-run-end-encoded-gdb
Open

GH-50658: [C++][Dev] Add RunEndEncoded support to gdb_arrow.py#50768
fenfeng9 wants to merge 1 commit into
apache:mainfrom
fenfeng9:gh-50658-run-end-encoded-gdb

Conversation

@fenfeng9

@fenfeng9 fenfeng9 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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 encoded types, scalars, and arrays.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@fenfeng9

fenfeng9 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Here are some examples from a local GDB session.

RunEndEncodedType

RunEndEncodedType 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())

RunEndEncodedScalar

auto 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 value

RunEndEncodedArray

// 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

@fenfeng9

fenfeng9 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

The null count 0 output is expected here and follows the existing ArrayData behavior. It counts only nulls in the top-level array. Run-end encoded arrays store nulls in the values child array, so this example decodes to three nulls even though the printer shows 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant