Conversation
Adds a new introspection function that returns a struct containing the complete Arrow Field information for any expression: name, data_type, nullable, and metadata. This unifies what `arrow_typeof`, `arrow_metadata`, and `is_nullable` provide individually. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThis pull request adds a new DataFusion scalar UDF named ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review:
|
🤖 Augment PR SummarySummary: Adds a new scalar UDF, Changes:
Technical Notes: The function returns a scalar Struct value (constant per expression schema) and represents the Arrow data type as its Display string. 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Code Review
This pull request introduces the arrow_field scalar function, which provides detailed Arrow field information for expressions, including name, data type, nullability, and metadata. The PR includes comprehensive documentation and SQL logic tests. A critical bug was identified in the implementation of the metadata map field names, which must be singular ('key' and 'value') to avoid a runtime panic due to type mismatch with the MapBuilder output.
| Field::new("keys", DataType::Utf8, false), | ||
| Field::new("values", DataType::Utf8, true), |
There was a problem hiding this comment.
The field names for the internal struct of an Arrow Map type should be key and value (singular) to be consistent with the standard Arrow Map representation and the output of MapBuilder. Using keys and values (plural) will cause a data type mismatch and a panic when StructArray::new is called in invoke_with_args (line 147), as the MapBuilder used there produces a MapArray with the standard singular field names.
| Field::new("keys", DataType::Utf8, false), | |
| Field::new("values", DataType::Utf8, true), | |
| Field::new("key", DataType::Utf8, false), | |
| Field::new("value", DataType::Utf8, true), |
There was a problem hiding this comment.
value:annoying; category:bug; feedback: The Gemini AI reviewer is not correct! The arrow-rs MapBuilder actually uses "keys" and "values" by default - https://github.com/apache/arrow-rs/blob/68851ef953fd771cc310203c446e54145d4407e1/arrow-array/src/builder/map_builder.rs#L83-L84
value:annoying; category:bug; feedback: The Claude AI reviewer is not correct! The arrow-rs MapBuilder actually uses "keys" and "values" by default - https://github.com/apache/arrow-rs/blob/68851ef953fd771cc310203c446e54145d4407e1/arrow-array/src/builder/map_builder.rs#L83-L84 |
21389: To review by AI