Skip to content
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 DataType::ListView and DataType::LargeListView #5493

Merged
merged 10 commits into from
Mar 13, 2024

Conversation

Kikkon
Copy link
Contributor

@Kikkon Kikkon commented Mar 10, 2024

Which issue does this PR close?

Closes #5492 .

Rationale for this change

Added DataType LargeListView & ListView, and for unimplemented types, a unimplement will be return.

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added parquet Changes to the parquet crate arrow Changes to the arrow crate labels Mar 10, 2024
@Kikkon Kikkon marked this pull request as draft March 10, 2024 13:46
@Kikkon Kikkon marked this pull request as ready for review March 10, 2024 14:06
@@ -119,12 +119,22 @@ pub(crate) fn new_buffers(data_type: &DataType, capacity: usize) -> [MutableBuff
buffer.push(0i32);
[buffer, empty_buffer]
}
DataType::ListView(_) => {
let mut buffer = MutableBuffer::new((1 + capacity) * mem::size_of::<i64>());
buffer.push(0i32);
Copy link
Contributor

@tustvold tustvold Mar 11, 2024

Choose a reason for hiding this comment

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

Is this correct? My reading of https://arrow.apache.org/docs/format/Columnar.html#listview-layout is that a ListView of length n will have an offsets and a sizes buffer both of length n, instead of a single buffer of length n + 1 like ListArray

Copy link
Contributor Author

@Kikkon Kikkon Mar 11, 2024

Choose a reason for hiding this comment

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

You are right, I will fix this later.
(:Originally, I planned to implement the method in the next pull request, so I overlooked this for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this correct? My reading of https://arrow.apache.org/docs/format/Columnar.html#listview-layout is that a ListView of length n will have an offsets and a sizes buffer both of length n, instead of a single buffer of length n + 1 like ListArray

Hi @tustvold
Based on the description in the documentation:https://arrow.apache.org/docs/format/Columnar.html#listview-layout, I modified the initialized buffer to be 2 * capacity, which means both the offset buffer and the size buffer, is that correct?

Comment on lines 123 to 124
MutableBuffer::new(2 * capacity * mem::size_of::<i32>()),
empty_buffer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MutableBuffer::new(2 * capacity * mem::size_of::<i32>()),
empty_buffer,
MutableBuffer::new(capacity * mem::size_of::<i32>()),
MutableBuffer::new(capacity * mem::size_of::<i32>()),

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @Kikkon -- this looks good to me. I left a small comment suggestion but otherwise 🚀

arrow-schema/src/datatype.rs Outdated Show resolved Hide resolved
arrow-schema/src/datatype.rs Outdated Show resolved Hide resolved
@tustvold tustvold merged commit ad3b4c9 into apache:master Mar 13, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DataType::ListView and DataType::LargeListView
3 participants