-
Notifications
You must be signed in to change notification settings - Fork 823
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
Create Specific builder for typed builder trait and easier to use for lists #6863
base: main
Are you sure you want to change the base?
Conversation
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.
I'm not sure about this, a lot of this functionality already exists
I wonder if you've given thought to a TypedListArray abstraction much like we have for DictionaryArray, ultimately the issue boils down to it being fiddly to iterate a ListArray, it isn't really a limitation of the builders
@@ -352,6 +352,18 @@ impl ArrayAccessor for &BooleanArray { | |||
} | |||
} | |||
|
|||
impl ArrayAccessor for BooleanArray { |
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 shouldn't be necessary as this is already implemented for &BooleanArray
@@ -219,6 +219,49 @@ impl ArrayBuilder for BooleanBuilder { | |||
} | |||
} | |||
|
|||
|
|||
impl SpecificArrayBuilder for BooleanBuilder { |
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.
The functionality of this trait seems to overlap with the existing extend functionality, I'm not sure what it is adding
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.
nothing, the only thing it add is for the list builder to use those functions as it expect a SpecificArrayBuilder trait
if output.is_null(i) { | ||
self.append_null(); | ||
} else { | ||
let current_value = output.value(i); |
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.
The performance of this will be very suboptimal, it would be better to iterate the offsets directly
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.
thanks, I did not try to make it fast now, just to make it work as a proof of concept
I think typed list array would be a great solution, my codebase knowledge is very limited |
@tustvold I was unable to add Also my solution does not work when creating the builder using |
ListBuilder already implements Extend, and adding FromIterator should be a trivial extension. The issue from your example concerns being able to extract an iterator of values from a list array, this will require adding a TypedListArray abstraction that can downcast the type-erased ListArray. I can try to find some time to write this up more properly over the next week or so |
Which issue does this PR close?
This doesn't close #6846 but it help get there
Rationale for this change
It's really hard to build nested lists, hopefully this makes it easier
What changes are included in this PR?
Created
SpecificArrayBuilder
and implement it for some of the builders, I was not able to implement it for all the buildersI implement for the following:
boolean_builder
fixed_size_binary_builder
fixed_size_list_builder
generic_bytes_builder
generic_bytes_view_builder
generic_list_builder
null_builder
primitive_builder
Are there any user-facing changes?
Yes, before documentation I would like to get your feedback
Possible breaking changes as now there are 2 functions with the same name so users will be prompted to select the trait to use (I think)
TODOs