-
Notifications
You must be signed in to change notification settings - Fork 42
[rust] integration tests for MAP dt + restructure ITs for complex dts #560
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
fresh-borzoni
merged 2 commits into
apache:main
from
fresh-borzoni:feat/map-integration-tests-549
May 25, 2026
Merged
Changes from all commits
Commits
Show all changes
2 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,12 +22,11 @@ | |
| use crate::error::Error::RowConvertError; | ||
| use crate::error::{Error, Result}; | ||
| use crate::metadata::{DataType, RowType}; | ||
| use crate::row::FlussMap; | ||
| use crate::row::InternalRow; | ||
| use crate::row::datum::{ | ||
| MICROS_PER_MILLI, MILLIS_PER_SECOND, NANOS_PER_MILLI, append_decimal_to_builder, | ||
| millis_nanos_to_micros, millis_nanos_to_nanos, | ||
| }; | ||
| use crate::row::{FlussArray, FlussMap, InternalRow}; | ||
| use arrow::array::{ | ||
| ArrayBuilder, ArrayRef, BinaryBuilder, BooleanBuilder, Date32Builder, Decimal128Builder, | ||
| FixedSizeBinaryBuilder, Float32Builder, Float64Builder, Int8Builder, Int16Builder, | ||
|
|
@@ -928,8 +927,8 @@ fn write_map_into( | |
| let key_array = map.key_array(); | ||
| let value_array = map.value_array(); | ||
| for i in 0..map.size() { | ||
| key_writer.write_field_at(key_array, i)?; | ||
| value_writer.write_field_at(value_array, i)?; | ||
| write_array_element_into_column(key_writer, key_array, i)?; | ||
| write_array_element_into_column(value_writer, value_array, i)?; | ||
| } | ||
| let last = *offsets.last().unwrap(); | ||
| offsets.push( | ||
|
|
@@ -940,6 +939,57 @@ fn write_map_into( | |
| Ok(()) | ||
| } | ||
|
|
||
| // FlussArray carries no schema; nested row/map elements need the typed | ||
|
Member
Author
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. will be fixed with refactoring, now I need this for test to pass |
||
| // inherent accessors (get_row/get_map with explicit types). | ||
| fn write_array_element_into_column( | ||
| writer: &mut ColumnWriter, | ||
| array: &FlussArray, | ||
| index: usize, | ||
| ) -> Result<()> { | ||
| match &mut writer.inner { | ||
| TypedWriter::Struct { | ||
| field_writers, | ||
| validity, | ||
| row_type, | ||
| .. | ||
| } => { | ||
| if array.is_null_at(index) { | ||
| for child in field_writers.iter_mut() { | ||
| child.append_null(); | ||
| } | ||
| validity.push(false); | ||
| } else { | ||
| let nested = array.get_row(index, row_type)?; | ||
| for (j, child) in field_writers.iter_mut().enumerate() { | ||
| child.write_field_at(&nested, j)?; | ||
| } | ||
| validity.push(true); | ||
| } | ||
| Ok(()) | ||
| } | ||
| TypedWriter::Map { | ||
| key_writer, | ||
| value_writer, | ||
| key_type, | ||
| value_type, | ||
| offsets, | ||
| validity, | ||
| } => { | ||
| if array.is_null_at(index) { | ||
| validity.push(false); | ||
| let last = *offsets.last().unwrap(); | ||
| offsets.push(last); | ||
| } else { | ||
| let nested = array.get_map(index, key_type, value_type)?; | ||
| write_map_into(nested, key_writer, value_writer, offsets)?; | ||
| validity.push(true); | ||
| } | ||
| Ok(()) | ||
| } | ||
| _ => writer.write_field_at(array, index), | ||
| } | ||
| } | ||
|
|
||
| fn finish_struct_array( | ||
| fields: arrow_schema::Fields, | ||
| child_arrays: Vec<ArrayRef>, | ||
|
|
||
Oops, something went wrong.
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.
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.
so to confirm since not mentioned in PR description: i guess this will be a behaviour, correct? that users won't know schema mismatch when calling get_array on position
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.
Intentional. The old strict check tripped on lossy Arrow round-trips (e.g. TIMESTAMP_LTZ -> plain Arrow Timestamp) and rejected valid schemas.
Real shape mismatches still error from the per-element conversion below