pitrou commented on a change in pull request #12315:
URL: https://github.com/apache/arrow/pull/12315#discussion_r802401464
##########
File path: python/pyarrow/tests/test_gdb.py
##########
@@ -772,27 +784,227 @@ def test_scalars_heap(gdb_arrow):
def test_array_data(gdb_arrow):
check_stack_repr(
gdb_arrow, "int32_array_data",
- "arrow::ArrayData of type arrow::int32(), length 4, null count 1")
+ ("arrow::ArrayData of type arrow::int32(), length 4, offset 0, "
+ "null count 1 = {[0] = -5, [1] = 6, [2] = null, [3] = 42}"))
def test_arrays_stack(gdb_arrow):
check_stack_repr(
gdb_arrow, "int32_array",
- "arrow::Int32Array of length 4, null count 1")
+ ("arrow::Int32Array of length 4, offset 0, null count 1 = "
+ "{[0] = -5, [1] = 6, [2] = null, [3] = 42}"))
check_stack_repr(
gdb_arrow, "list_array",
("arrow::ListArray of type arrow::list(arrow::int64()), "
- "length 3, null count 1"))
+ "length 3, offset 0, null count 1"))
def test_arrays_heap(gdb_arrow):
+ # Null
+ check_heap_repr(
+ gdb_arrow, "heap_null_array",
+ "arrow::NullArray of length 2, offset 0, null count 2")
+
+ # Primitive
check_heap_repr(
gdb_arrow, "heap_int32_array",
- "arrow::Int32Array of length 4, null count 1")
+ ("arrow::Int32Array of length 4, offset 0, null count 1 = {"
+ "[0] = -5, [1] = 6, [2] = null, [3] = 42}"))
+ check_heap_repr(
+ gdb_arrow, "heap_int32_array_no_nulls",
+ ("arrow::Int32Array of length 4, offset 0, null count 0 = {"
+ "[0] = -5, [1] = 6, [2] = 3, [3] = 42}"))
+ check_heap_repr(
+ gdb_arrow, "heap_int32_array_sliced_1_9",
+ ("arrow::Int32Array of length 9, offset 1, unknown null count = {"
+ "[0] = 2, [1] = -3, [2] = 4, [3] = null, [4] = -5, [5] = 6, "
+ "[6] = -7, [7] = 8, [8] = null}"))
+ check_heap_repr(
+ gdb_arrow, "heap_int32_array_sliced_2_6",
+ ("arrow::Int32Array of length 6, offset 2, unknown null count = {"
+ "[0] = -3, [1] = 4, [2] = null, [3] = -5, [4] = 6, [5] = -7}"))
+ check_heap_repr(
+ gdb_arrow, "heap_int32_array_sliced_8_4",
+ ("arrow::Int32Array of length 4, offset 8, unknown null count = {"
+ "[0] = 8, [1] = null, [2] = -9, [3] = -10}"))
+ check_heap_repr(
+ gdb_arrow, "heap_int32_array_sliced_empty",
+ "arrow::Int32Array of length 0, offset 6, unknown null count")
+
+ check_heap_repr(
+ gdb_arrow, "heap_double_array",
+ ("arrow::DoubleArray of length 2, offset 0, null count 1 = {"
+ "[0] = -1.5, [1] = null}"))
+ check_heap_repr(
+ gdb_arrow, "heap_float16_array",
+ ("arrow::HalfFloatArray of length 2, offset 0, null count 0 = {"
+ "[0] = 0.0, [1] = -1.5}"))
+
+ # Boolean
+ check_heap_repr(
+ gdb_arrow, "heap_bool_array",
+ ("arrow::BooleanArray of length 18, offset 0, null count 6 = {"
+ "[0] = false, [1] = false, [2] = true, [3] = true, [4] = null, "
+ "[5] = null, [6] = false, [7] = false, [8] = true, [9] = true, "
+ "[10] = null, [11] = null, [12] = false, [13] = false, "
+ "[14] = true, [15] = true, [16] = null, [17] = null}"))
Review comment:
AFAIU, gdb does that automatically with the results we provide it. See
the doc for the `children()` method:
https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing-API.html
> For efficiency, the children method should lazily compute its results.
This will let GDB read as few elements as necessary, for example when various
print settings (see [Print
Settings](https://sourceware.org/gdb/onlinedocs/gdb/Print-Settings.html#Print-Settings))
or -var-list-children (see [GDB/MI Variable
Objects](https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects))
limit the number of elements to be displayed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]