apache / apache/arrow

[C++][Python] Improve the ToString repr of FieldRef

Open
#39,095 0 comments 0 reactions 0 assignees View on GitHub
Component: C++
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

Currently the `FieldRef` string representation looks like `"FieldRef.Name(col)"` or `"FieldRef.Nested(FieldRef.Name(col) FieldRef.Name(field1))"`.

While being explicit and descriptive, those representations also show up in error messages (also on the Python side), eg when a certain field reference is not found in the schema, or show up in the repr of expressions.

I don't what would be the best tradeoff between still descriptive and clear but also concise and nice to read, but I think I would prefer something like `FieldRef("col")` or `FieldRef(("col", "field1"))` (I don't know if it is a problem that the repr would include quotes, and this also doesn't yet include field paths).
Or even an option to just get the name `"col"`, such that you can combine that more in a sentence like "No match for field ref ".

Where this is currently implemented:

https://github.com/apache/arrow/blob/1cc1f4c752895301371ee59d315ebffe74224c66/cpp/src/arrow/type.cc#L2054-L2072

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.