-
Notifications
You must be signed in to change notification settings - Fork 117
fix[array]: correct the handling of to_arrow execution and struct casting #5867
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ use arrow_array::StructArray; | |
| use arrow_buffer::NullBuffer; | ||
| use arrow_schema::DataType; | ||
| use arrow_schema::Fields; | ||
| use itertools::Itertools; | ||
| use vortex_compute::arrow::IntoArrow; | ||
| use vortex_dtype::DType; | ||
| use vortex_dtype::StructFields; | ||
|
|
@@ -93,7 +94,7 @@ fn create_from_fields( | |
| session: &VortexSession, | ||
| ) -> VortexResult<ArrowArrayRef> { | ||
| let mut arrow_fields = Vec::with_capacity(vortex_fields.len()); | ||
| for (field, vx_field) in fields.iter().zip(vortex_fields.into_iter()) { | ||
| for (field, vx_field) in fields.iter().zip_eq(vortex_fields.into_iter()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| let arrow_field = vx_field.execute_arrow(field.data_type(), session)?; | ||
| vortex_ensure!( | ||
| field.is_nullable() || arrow_field.null_count() == 0, | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ use futures::stream; | |
| use object_store::ObjectStore; | ||
| use object_store::path::Path; | ||
| use tracing::Instrument; | ||
| use vortex::array::Array; | ||
| use vortex::array::ArrayRef; | ||
| use vortex::array::arrow::ArrowArrayExecutor; | ||
| use vortex::dtype::FieldName; | ||
|
|
@@ -111,10 +112,9 @@ impl FileOpener for VortexOpener { | |
| Some(indices) => Arc::new(table_schema.file_schema().project(indices)?), | ||
| }; | ||
|
|
||
| let schema_adapter = self.schema_adapter_factory.create( | ||
| projected_schema.clone(), | ||
| table_schema.table_schema().clone(), | ||
| ); | ||
| let schema_adapter = self | ||
| .schema_adapter_factory | ||
| .create(projected_schema, table_schema.table_schema().clone()); | ||
|
|
||
| // Update partition column access in the filter to use literals instead | ||
| let partition_fields = self.table_schema.table_partition_cols().clone(); | ||
|
|
@@ -295,7 +295,8 @@ impl FileOpener for VortexOpener { | |
| .with_ordered(has_output_ordering) | ||
| .map(move |chunk| { | ||
| if *USE_VORTEX_OPERATORS { | ||
| chunk.execute_record_batch(&projected_schema, &chunk_session) | ||
| let schema = chunk.dtype().to_arrow_schema()?; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can get the schema once from the scan and projection expression and use it here (I'm doing it in the DF52 PR, so not a blocker) |
||
| chunk.execute_record_batch(&schema, &chunk_session) | ||
| } else { | ||
| RecordBatch::try_from(chunk.as_ref()) | ||
| } | ||
|
|
@@ -809,11 +810,9 @@ mod tests { | |
| // struct column. | ||
| let data = opener | ||
| .open(PartitionedFile::new(file_path.to_string(), data_size))? | ||
| .await | ||
| .unwrap() | ||
| .await? | ||
| .try_collect::<Vec<_>>() | ||
| .await | ||
| .unwrap(); | ||
| .await?; | ||
|
|
||
| assert_eq!(data.len(), 1); | ||
| assert_eq!(data[0].num_rows(), 3); | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Why is
derive(debug)needed?