Add finish_preserve_values to ArrayBuilder trait#9601
Conversation
|
@albertlockett I wonder if you might have some time to review this PR and offer an opinion? |
7e1df01 to
9248def
Compare
albertlockett
left a comment
There was a problem hiding this comment.
LGTM, this look the right approach. Thanks for the contribution @adamreichold !
|
Friendly ping. With the positive feedback on the basic approach, I would be happy to fix any remaining technicalities so our project can make use of this via the planned 58.2.0 or 59.0.0 release. Thanks! |
finish_preserve_values to ArrayBuilder trait
alamb
left a comment
There was a problem hiding this comment.
Thank you @adamreichold and @albertlockett
I took a look and this PR makes sense to me and seems well tested
It is a little unfortnuate that now we end up with three versions of build for all arrays, but I don't have any good suggestion for this other than to make a more generic version that can pass an options struct Array::finish_opts(&self, opts: FinishOptions)
If we find we wand to pass more options to finish in the future, perhaps then we can deprecate finish_preserve_values and add something more like finsh_opt
To support delta dictionaries for nested builders, this adds a new method finish_preserve_values to the ArrayBuilder trait and wires it through to the relevant dictionary and composite builders.
9248def to
e44dddb
Compare
Pushed a rebase and the intra doc link fix. |
Yeah, it would be trickey |
|
🚀 |
# Which issue does this PR close? - Closes apache#9600. # Rationale for this change Delta dictionaries require user code to call `finish_preserve_values` instead of `finish` on the dictionary builders. But this is generally not possible if those builders are nested within composite builders like lists, maps or structs. Using the new trait method, user code can call this generically which has no effect on e.g. primitive builders due to the default implementation but forwards to this method for composite ones. # What changes are included in this PR? Adds a new method `finish_preserve_values` to `ArrayBuilder` with a default implementation that forwards to `finish`. Implements this method for dictionary and composite builders. # Are these changes tested? Adds tests where new `finish_preserve_values` inherent methods were created to check that the correct method on the constituent builders is called using a shared mock builder `PreserveValuesMock`. # Are there any user-facing changes? This adds a new method `finish_preserve_values` to the central `ArrayBuilder` trait, but it has a default implementation so this should be backwards compatible.
Which issue does this PR close?
Rationale for this change
Delta dictionaries require user code to call
finish_preserve_valuesinstead offinishon the dictionary builders. But this is generally not possible if those builders are nested within composite builders like lists, maps or structs. Using the new trait method, user code can call this generically which has no effect on e.g. primitive builders due to the default implementation but forwards to this method for composite ones.What changes are included in this PR?
Adds a new method
finish_preserve_valuestoArrayBuilderwith a default implementation that forwards tofinish.Implements this method for dictionary and composite builders.
Are these changes tested?
Adds tests where new
finish_preserve_valuesinherent methods were created to check that the correct method on the constituent builders is called using a shared mock builderPreserveValuesMock.Are there any user-facing changes?
This adds a new method
finish_preserve_valuesto the centralArrayBuildertrait, but it has a default implementation so this should be backwards compatible.