Add ColumnarValue::to_array_variant method (follow-up to #22784)#22934
Open
nathanb9 wants to merge 1 commit into
Open
Add ColumnarValue::to_array_variant method (follow-up to #22784)#22934nathanb9 wants to merge 1 commit into
nathanb9 wants to merge 1 commit into
Conversation
Jefffrey
reviewed
Jun 13, 2026
Jefffrey
left a comment
Contributor
There was a problem hiding this comment.
personally i'm not sure about introducing this method, as it seems to goes against the purpose of a ColumnarValue in representing scalars and arrays distinctly 🤔
it would be better for the use case to manually unwrap to just an array if it can only operate on arrays instead of doing this conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Follow-up to #22784, addressing a review comment from @alamb suggesting the
expand_if_scalarhelper would make a good method onColumnarValue.Rationale for this change
map.rshad a privateexpand_if_scalarhelper that expands aScalarto an array while leaving anArrayas is, keeping the value wrapped as aColumnarValue. This is generally useful for functions that thread aColumnarValuebut need to assume a non-scalar input, so it belongs onColumnarValuerather than in one function file.What changes are included in this PR?
ColumnarValue::to_array_variant(&self, num_rows), which returns aColumnarValueguaranteed to be theArrayvariant. It reuses the existingto_array, so aScalaris expanded tonum_rowsand anArrayis returned unchanged (no length validation).expand_if_scalarfrommap.rsand call the new method instead.Are these changes tested?
Yes. Added a unit test for
to_array_variantcovering scalar expansion, array pass-through, and that an existing array is not length validated. Existingmapunit tests and sqllogictests continue to pass.Are there any user-facing changes?
Adds one public method to
ColumnarValue. No behavior changes.