14 Commits
Author SHA1 Message Date
fenfeng9 6b1ad60ab5 GH-50658: [C++][Dev] Add RunEndEncoded support to gdb_arrow.py (#50768)
### 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.

* GitHub Issue: #50658

Authored-by: fenfeng9 <fenfeng9@qq.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-10-06 10:26:41 +02:00
fenfeng9 ee6ff0a1b6 GH-50660: [C++][Dev] Add Decimal32 and Decimal64 GDB pretty-printers (#50723)
### Rationale for this change
The Arrow GDB pretty-printers support `Decimal128` and `Decimal256`, but do not support `Decimal32` or `Decimal64`.

### What changes are included in this PR?
* Add GDB pretty-printer support and tests for `Decimal32` and `Decimal64`.
* Remove the unused `max_type_id` variable.

### Are these changes tested?
Yes.

### Are there any user-facing changes?
No.
* GitHub Issue: #50660

Authored-by: fenfeng9 <fenfeng9@qq.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-07-30 10:23:37 +02:00
fenfeng9 2ae036fdb6 GH-50680: [C++][Dev] Extend type IDs in gdb_arrow.py (#50683)
### Rationale for this change
`gdb_arrow.py` mirrors the C++ `arrow::Type::type` enum by position, but it is missing several newer type IDs.

The upcoming pretty-printer sub-issues(https://github.com/apache/arrow/issues/50656) share this dependency. 
### What changes are included in this PR?
Adds the missing `RunEndEncoded, BinaryView, ListView, and Decimal32/64` type IDs in the same order as the C++ enum.

Individual pretty-printer support will be implemented separately.
### Are these changes tested?

### Are there any user-facing changes?
No.
* GitHub Issue: #50680

Authored-by: fenfeng9 <fenfeng9@qq.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-07-28 14:31:48 +02:00
Antoine Pitrou 53e0c745ad GH-40153: [C++][Python] Fix test_gdb failures on 32-bit (#40293)
### Rationale for this change

`test_gdb.py` would fail on 32-bit platforms because the gdb extension errors out when a timestamp value is larger than the platform's time_t.

### What changes are included in this PR?

1. Catch `OverflowError` from the Python datetime module when trying to format a timestamp
2. Tweak the expected test results on 32-bit

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #40153

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2024-03-05 13:31:38 +01:00
Xiansen ChenandAntoine Pitrou c5f60a02fe GH-39864: [C++] DataType::ToString support optionally show metadata (#39888)
### Rationale for this change

Support showing metadata of  nested DataType which have child fields.

### What changes are included in this PR?

Add an optional argument "show_metadata" to the ToString() of DataType and other DataType derived class. And we also  add it to TypeHolder::ToString().

### Are these changes tested?

Yes, I add tests for changes.

### Are there any user-facing changes?
No.

Closes: #39864
* Closes: #39864

Lead-authored-by: xiansen.chen <xiansen.chen@openpie.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2024-02-27 20:22:12 +01:00
Antoine Pitrou 91ee6dad72 ARROW-17693: [C++] Remove string_view backport (#14177)
Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-09-21 10:11:50 +02:00
Antoine Pitrou decddbbf1a ARROW-17695: [C++] Remove Variant class (#14136)
Use std::variant instead.

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2022-09-17 05:20:21 +09:00
Antoine Pitrou 5e49174d69 ARROW-17694: [C++] Remove std::optional backport (#14105)
Just use the C++17 standard library version.

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-09-15 12:37:21 +02:00
Wes McKinneyandSutou Kouhei 6cc37cf2d1 ARROW-16757: [C++] Remove "scalar" output modality for ScalarKernel implementations, remove ValueDescr class (#13521)
This was a pretty painful refactoring project, but all for the better long term. 

I will do my best to improve the PR summary to explain changes as I go through the PR myself, but the basic summary is that argument shape is no longer part of kernel signatures (or expressions or anything else) -- the "all scalar" evaluation case is handled by promoting scalars to ArraySpan of length 1. This enabled the deletion of many "duplicate" kernel implementations and uncovered some bugs in some kernel implementations as a result of passing many sliced length-1 inputs up-promoted from scalars. 

This had painful knock-on effects because some scalar values -- sparse unions and some other non-primitive types -- were not "well-formed" enough to be able to be converted to ArraySpan without needing to allocate memory. As a result, I had to change the requirements (and in the case of sparse unions, the representation to correspond to a "single row view" of a SparseUnionArray -- i.e. the "value" for a sparse union is now a vector of scalars rather than a single scalar, even though only one of the values in the vector is the "active" scalar) of some scalar values to not allow null values. We should / could consider implementing scalars altogether internally as arrays of length 1 but we can discuss that as a follow up.

Some other interesting stuff in here is the new experimental `arrow::TypeHolder` struct which allows us to pass around either `const DataType*` or `std::shared_ptr<DataType>` in contexts where type ownership isn't strictly necessary. So now we can deal only with raw pointers when doing type signature checking / kernel dispatching, for example. We should look at refactoring other code where we deal with `shared_ptr<DataType>` (but don't necessarily need to preserve ownership) to use TypeHolder. 

There's some unfinished business here:

* The GLib bindings must be refactored to follow this work

Lead-authored-by: Wes McKinney <wesm@apache.org>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Wes McKinney <wesm@apache.org>
2022-07-07 22:06:54 -04:00
Sutou Kouhei 755fb9f31a ARROW-15422: [Packaging][RPM][deb] Add support for GDB plugin (#13477)
Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2022-07-03 14:48:33 +09:00
Antoine Pitrou 12490eb7a3 ARROW-15652: [C++] Fix GDB pretty-printing from inside parquet namespace
Expressions evaluated by GDB are evaluated in the scope of the C++ namespace of the currently selected frame.
Therefore, when inside a Parquet frame, `arrow::<some type>` would be looked up as `parquet::arrow::<some type>` and fail.

Closes #12434 from pitrou/ARROW-15652-gdb-parquet

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-02-16 13:14:40 +01:00
Antoine Pitrou ec3608c4f7 ARROW-15389: [C++][Dev] Improve Array preview in GDB plugin
When printing a arrow::Array or arrow::ArrayData, try to print the array contents as well as its metadata.

This is implemented for all primitive and binary-like types.
Other types will only display the array metadata.

Example:
```
(gdb) p *heap_binary_array.get()
$23 = arrow::BinaryArray of length 3, offset 0, null count 1 = {[0] = null, [1] = "abcd", [2] = "\000\037\377"}
```

Closes #12315 from pitrou/ARROW-15389-gdb-array-preview

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
2022-02-09 15:43:27 -05:00
Antoine Pitrou 443d09548b ARROW-15423: [C++][Dev] Make GDB plugin auto-load friendly
When auto-loaded, a GDB plugin should attach itself to the specific objfile being debugged.

This allows for potentially multiple inferiors being debugged at once, using different versions of Arrow C++.

Closes #12236 from pitrou/ARROW-15423-gdb-auto-load

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2022-01-25 06:56:38 +09:00
Antoine Pitrou a3efe72f99 ARROW-12735: [C++] Write GDB plugin
Add a GDB plugin (written in Python) that registers custom printers for common Arrow C++ types, and makes their values much more readable when printed on the GDB prompt.

Currently covered types are:
- `string_view`, `optional`, `Variant`
- `Status`, `Result`
- `Buffer` (and subclasses)
- `BasicDecimal{128,256}` (and subclasses)
- `DataType` (and subclasses), `Field`, `Schema`, `KeyValueMetadata`
- `Scalar` (and subclasses)
- `ArrayData`, `Array` (and subclasses)
- `ChunkedArray`, `RecordBatch`, `Table`, `Datum`

The plugin is tested using a test harness in PyArrow, for convenience.

Here is for example `arrow::util::Variant<int, bool, std::string>`:
* with the GDB plugin:
```gdb
(gdb) p int_variant
$1 = arrow::util::Variant of index 0 (actual type int), value 42
```
* without the GDB plugin:
```gdb
(gdb) p int_variant
$1 = {
  <arrow::util::detail::VariantImpl<arrow::util::Variant<int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {
    <arrow::util::detail::VariantImpl<arrow::util::Variant<int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {
      <arrow::util::detail::VariantImpl<arrow::util::Variant<int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {
        <arrow::util::detail::VariantImpl<arrow::util::Variant<int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {
          <arrow::util::detail::VariantStorage<int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {
[ snip more lines of inscrutable implementation details ]
```

Closes #12092 from pitrou/ARROW-12735-gdb

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-01-20 18:49:16 +01:00