-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more const evaluation for GenericBinaryArray
and GenericListArray
: add PREFIX
and data type constructor
#2327
Conversation
Signed-off-by: remzi <13716567376yh@gmail.com>
PREFIX
and data type constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a very nice cleanup to me -- thank you @HaoYang670
/// The data type constructor of list array. | ||
/// The input is the schema of the child array and | ||
/// the output is the [`DataType`], List or LargeList. | ||
pub const DATA_TYPE_CONSTRUCTOR: fn(Box<Field>) -> DataType = if OffsetSize::IS_LARGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub const DATA_TYPE_CONSTRUCTOR: fn(Box<Field>) -> DataType = if OffsetSize::IS_LARGE | |
pub const MAKE_DATA_TYPE: fn(Box<Field>) -> DataType = if OffsetSize::IS_LARGE |
DATA_TYPE_CONSTRUCTOR
was somewhat hard on my eyes when reading this PR. That being said while I might prefer something like MAKE_DATA_TYPE
it is only an opinion for your consideration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review @alamb. Personally, I prefer the name CONSTRUCTOR
, as ListArray
and LargeListArray
constructor tags of DataType
: https://en.wikipedia.org/wiki/Algebraic_data_type#:~:text=A%20general%20algebraic%20data%20type,factors%20of%20the%20product%20type.
use std::any::TypeId; | ||
|
||
let mut offset = vec![0]; | ||
let mut offset = vec![S::zero()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
PREFIX
and data type constructorGenericBinaryArray
and GenericListArray
: add PREFIX
and data type constructor
I am going to take this one into Arrow 20 as it is also an API change -- I am hoping one of these releases we'll be able to do a minor one ;) |
Benchmark runs are scheduled for baseline = 3ed0e28 and contender = b1e2bd9. b1e2bd9 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Signed-off-by: remzi 13716567376yh@gmail.com
Which issue does this PR close?
Closes #2311 .
Rationale for this change
More constant evaluation is better.
Less repeated code is better.
What changes are included in this PR?
PREFIX
for OffsetSizeTraitAre there any user-facing changes?
No.