Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cpp/gdb_arrow.py

@Reranko05 Reranko05 Jul 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlaps with GH-50662 since both PRs modify the same Type enum definition in gdb_arrow.py. They will likely conflict when merged. Could you rebase one after the other lands (or combine them if appropriate)?

Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@
'EXTENSION', 'FIXED_SIZE_LIST', 'DURATION', 'LARGE_STRING',
'LARGE_BINARY', 'LARGE_LIST', 'INTERVAL_MONTH_DAY_NANO']

_type_id_tuples = [(name, i) for i, name in enumerate(_type_ids)]
_type_id_tuples.extend([('LIST_VIEW', 41), ('LARGE_LIST_VIEW', 42)])

# Mirror the C++ Type::type enum
Type = enum.IntEnum('Type', _type_ids, start=0)
Type = enum.IntEnum('Type', _type_id_tuples)

# Mirror the C++ TimeUnit::type enum
TimeUnit = enum.IntEnum('TimeUnit', ['SECOND', 'MILLI', 'MICRO', 'NANO'],
Expand Down Expand Up @@ -1046,6 +1049,8 @@ def num_rows(self):
'FixedSizeBinaryType': 'fixed_size_binary',
'ListType': 'list',
'LargeListType': 'large_list',
'ListViewType': 'list_view',
'LargeListViewType': 'large_list_view',
'FixedSizeListType': 'fixed_size_list',
'MapType': 'map',
'StructType': 'struct_',
Expand Down Expand Up @@ -2064,6 +2069,8 @@ class ExtensionTypeClass(DataTypeClass):

Type.LIST: DataTypeTraits(BaseListTypeClass, 'ListType'),
Type.LARGE_LIST: DataTypeTraits(BaseListTypeClass, 'LargeListType'),
Type.LIST_VIEW: DataTypeTraits(BaseListTypeClass, 'ListViewType'),
Type.LARGE_LIST_VIEW: DataTypeTraits(BaseListTypeClass, 'LargeListViewType'),
Type.FIXED_SIZE_LIST: DataTypeTraits(FixedSizeListTypeClass,
'FixedSizeListType'),
Type.MAP: DataTypeTraits(MapTypeClass, 'MapType'),
Expand Down
15 changes: 15 additions & 0 deletions python/pyarrow/src/arrow/python/gdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,12 @@ void TestSession() {

ListType list_type(uint8());
LargeListType large_list_type(large_utf8());
ListViewType list_view_type(uint8());
LargeListViewType large_list_view_type(large_utf8());
auto heap_list_type = list(uint8());
auto heap_large_list_type = large_list(large_utf8());
auto heap_list_view_type = list_view(uint8());
auto heap_large_list_view_type = large_list_view(large_utf8());

FixedSizeListType fixed_size_list_type(float64(), 3);
auto heap_fixed_size_list_type = fixed_size_list(float64(), 3);
Expand Down Expand Up @@ -332,6 +336,12 @@ void TestSession() {
LargeListScalar large_list_scalar{list_value_array};
LargeListScalar large_list_scalar_null{list_zero_length, large_list(int32()),
/*is_valid=*/false};
ListViewScalar list_view_scalar{list_value_array};
ListViewScalar list_view_scalar_null{list_zero_length, list_view(int32()),
/*is_valid=*/false};
LargeListViewScalar large_list_view_scalar{list_value_array};
LargeListViewScalar large_list_view_scalar_null{
list_zero_length, large_list_view(int32()), /*is_valid=*/false};
FixedSizeListScalar fixed_size_list_scalar{list_value_array};
FixedSizeListScalar fixed_size_list_scalar_null{
list_value_array, fixed_size_list(int32(), 3), /*is_valid=*/false};
Expand Down Expand Up @@ -394,6 +404,11 @@ void TestSession() {

auto heap_list_array = SliceArrayFromJSON(list(int64()), "[[1, 2], null, []]");
ListArray list_array{heap_list_array->data()};
auto heap_list_view_array =
SliceArrayFromJSON(list_view(int64()), "[[1, 2], null, []]");
ListViewArray list_view_array{heap_list_view_array->data()};
auto heap_large_list_view_array =
SliceArrayFromJSON(large_list_view(int64()), "[[1, 2], null, []]");

const char* json_double_array = "[-1.5, null]";
auto heap_double_array = SliceArrayFromJSON(float64(), json_double_array);
Expand Down
36 changes: 36 additions & 0 deletions python/pyarrow/tests/test_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ def test_types_stack(gdb_arrow):
"arrow::list(arrow::uint8())")
check_stack_repr(gdb_arrow, "large_list_type",
"arrow::large_list(arrow::large_utf8())")
check_stack_repr(gdb_arrow, "list_view_type",
"arrow::list_view(arrow::uint8())")
check_stack_repr(gdb_arrow, "large_list_view_type",
"arrow::large_list_view(arrow::large_utf8())")
check_stack_repr(gdb_arrow, "fixed_size_list_type",
"arrow::fixed_size_list(arrow::float64(), 3)")
check_stack_repr(
Expand Down Expand Up @@ -432,6 +436,10 @@ def test_types_heap(gdb_arrow):
"arrow::list(arrow::uint8())")
check_heap_repr(gdb_arrow, "heap_large_list_type",
"arrow::large_list(arrow::large_utf8())")
check_heap_repr(gdb_arrow, "heap_list_view_type",
"arrow::list_view(arrow::uint8())")
check_heap_repr(gdb_arrow, "heap_large_list_view_type",
"arrow::large_list_view(arrow::large_utf8())")
check_heap_repr(gdb_arrow, "heap_fixed_size_list_type",
"arrow::fixed_size_list(arrow::float64(), 3)")
check_heap_repr(
Expand Down Expand Up @@ -680,6 +688,22 @@ def test_scalars_stack(gdb_arrow):
gdb_arrow, "large_list_scalar_null",
('arrow::LargeListScalar of type arrow::large_list(arrow::int32()), '
'null value'))
check_stack_repr(
gdb_arrow, "list_view_scalar",
('arrow::ListViewScalar of value arrow::Int32Array of '
'length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}'))
check_stack_repr(
gdb_arrow, "list_view_scalar_null",
('arrow::ListViewScalar of type arrow::list_view(arrow::int32()), '
'null value'))
check_stack_repr(
gdb_arrow, "large_list_view_scalar",
('arrow::LargeListViewScalar of value arrow::Int32Array of '
'length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}'))
check_stack_repr(
gdb_arrow, "large_list_view_scalar_null",
('arrow::LargeListViewScalar of type '
'arrow::large_list_view(arrow::int32()), null value'))
check_stack_repr(
gdb_arrow, "fixed_size_list_scalar",
('arrow::FixedSizeListScalar of value arrow::Int32Array of '
Expand Down Expand Up @@ -765,6 +789,10 @@ def test_arrays_stack(gdb_arrow):
gdb_arrow, "list_array",
("arrow::ListArray of type arrow::list(arrow::int64()), "
"length 3, offset 0, null count 1"))
check_stack_repr(
gdb_arrow, "list_view_array",
("arrow::ListViewArray of type arrow::list_view(arrow::int64()), "
"length 3, offset 0, null count 1"))


def test_arrays_heap(gdb_arrow):
Expand Down Expand Up @@ -1002,6 +1030,14 @@ def test_arrays_heap(gdb_arrow):
gdb_arrow, "heap_list_array",
("arrow::ListArray of type arrow::list(arrow::int64()), "
"length 3, offset 0, null count 1"))
check_heap_repr(
gdb_arrow, "heap_list_view_array",
("arrow::ListViewArray of type arrow::list_view(arrow::int64()), "
"length 3, offset 0, null count 1"))
check_heap_repr(
gdb_arrow, "heap_large_list_view_array",
("arrow::LargeListViewArray of type arrow::large_list_view(arrow::int64()), "
"length 3, offset 0, null count 1"))


def test_schema(gdb_arrow):
Expand Down