feat: create an arrow-scalar crate utilizing arrow-row and arrow-data#5955
feat: create an arrow-scalar crate utilizing arrow-row and arrow-data#5955westonpace merged 4 commits intolance-format:mainfrom
Conversation
…he comparison and serialization.
PR Review: arrow-scalar crateThis PR introduces a new P0/P1 Issues1. (P1) Missing BinaryView/Utf8View serialization test coverage 2. (P1) Potential panic on invalid buffer counts during decode 3. (P0) Boolean arrays have no value buffer when using packed bits let b = ArrowScalar::from(true);
let encoded = b.encode().unwrap();
let decoded = ArrowScalar::decode(&encoded).unwrap();
assert_eq!(b, decoded);Minor Notes (not blocking)
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| [dependencies] | ||
| arrow-array = { workspace = true } |
There was a problem hiding this comment.
If you want to be defensive, might want to leave a brief comment that you want to keep the dependency list here small.
wjones127
left a comment
There was a problem hiding this comment.
Looks reasonable and small.
This provides an
ArrowScalarwhich supports:Ord,Hash, andEqThe
Ord/Eqimplementations come fromarrow_rowwhich should provide the same comparison logic asarrow-rscompute functions (and thus Datafusion)The binary serialization uses the C data interface for optional serialization of the data type and then dumps the array data as-is. This should be a stable format.
My primary goal with this PR was to minimize the amount of code required (compared to something like datafusion's
ScalarValueto keep maintenance simple. There may be more performant options but since I don't expect scalars to be used in hot spots I think this will be ok. Also, the public API surface ofArrowScalaris pretty small so if we need to replace the internal implementation later for performance we can do so.