Skip to content

feat: support ListView and LargeListView in ScalarValue#21669

Open
Jefffrey wants to merge 10 commits intoapache:mainfrom
Jefffrey:scalarvalue-listview
Open

feat: support ListView and LargeListView in ScalarValue#21669
Jefffrey wants to merge 10 commits intoapache:mainfrom
Jefffrey:scalarvalue-listview

Conversation

@Jefffrey
Copy link
Copy Markdown
Contributor

@Jefffrey Jefffrey commented Apr 16, 2026

Which issue does this PR close?

Rationale for this change

More support for listview types in the codebase

What changes are included in this PR?

Added ListView and LargeListView to ScalarValue with all accompanying changes

Support ListView and LargeListView in proto, both for the arrow datatype & the newly introduced scalarvalue variants.

Are these changes tested?

Yes, added tests

Are there any user-facing changes?

No

@github-actions github-actions bot added sql SQL Planner common Related to common crate proto Related to proto crate labels Apr 16, 2026
3,
),
)),
ScalarValue::ListView(Arc::new(ListViewArray::from_iter_primitive::<
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only change in this file is adding cases for listview & largelistview; other changes is indent change. Would recommend reviewing with whitespace off

@Jefffrey Jefffrey marked this pull request as ready for review April 16, 2026 12:39
Comment thread datafusion/common/src/scalar/mod.rs
Copy link
Copy Markdown
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jefffrey one nit: to check if list/listview branches can be combined into a single branch, if possible

Comment thread datafusion/common/src/scalar/mod.rs
Comment thread datafusion/common/src/scalar/mod.rs
Comment thread datafusion/common/src/scalar/mod.rs
Comment thread datafusion/common/src/scalar/mod.rs Outdated
}
ScalarValue::ListView(arr) => {
let array = copy_array_data(&arr.to_data());
*Arc::make_mut(arr) = ListViewArray::from(array);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*Arc::make_mut(arr) = ListViewArray::from(array);
*Arc::make_mut(arr) = ListViewArray::from(array)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a value add here; it's valid syntax

Comment thread datafusion/common/src/scalar/mod.rs Outdated
Comment thread datafusion/common/src/utils/mod.rs Outdated
pub fn build_list_view_array(self) -> ListViewArray {
let (field, arr) = self.into_field_and_arr();
let offsets = ScalarBuffer::from(vec![0]);
let sizes = ScalarBuffer::from(vec![arr.len() as i32]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use a checked API for the cast here because this may silently truncate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to use checked API; it'll panic if overflow but I don't think that'll be a common usage

Comment thread datafusion/common/src/scalar/mod.rs Outdated
let empty_arr = new_empty_array(field.data_type());
let values = Arc::new(
SingleRowListArrayBuilder::new(empty_arr)
.with_nullable(field.is_nullable())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason the field name to be ignored here ?
I see none of the similar logic above/below uses

Suggested change
.with_nullable(field.is_nullable())
.with_field(field)

which would preserve both the field's name and is_nullable properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to use with_field, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate proto Related to proto crate sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ListView, LargeListView in ScalarValue

4 participants