Skip to content

fix(cast): Trying to fix cast losting schema problem#10005

Merged
alamb merged 2 commits into
apache:mainfrom
mapleFU:trying-to-fix-cast-lost-schema
May 21, 2026
Merged

fix(cast): Trying to fix cast losting schema problem#10005
alamb merged 2 commits into
apache:mainfrom
mapleFU:trying-to-fix-cast-lost-schema

Conversation

@mapleFU
Copy link
Copy Markdown
Member

@mapleFU mapleFU commented May 21, 2026

Which issue does this PR close?

Rationale for this change

Previously, just data_type is considered. Now the field is taking into account.

What changes are included in this PR?

Previously, just data_type is considered. Now the field is taking into account.

Are these changes tested?

Yes

Are there any user-facing changes?

Maybe cast would be a bit more strict

@github-actions github-actions Bot added the arrow Changes to the arrow crate label May 21, 2026
@mapleFU mapleFU force-pushed the trying-to-fix-cast-lost-schema branch from 6cb0888 to b3c3ba3 Compare May 21, 2026 05:03
@mapleFU mapleFU requested review from Jefffrey and alamb and removed request for Jefffrey May 21, 2026 09:28
Copy link
Copy Markdown
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 @mapleFU -- looks good to me

for target_type in &target_types {
let result = cast(&src, target_type).unwrap();
assert_eq!(
result.data_type(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I verified this test covers the change by removing the code change and running the test (it fails like this):

thread 'cast::tests::test_cast_fixed_size_list_to_list_preserves_field_metadata' (76333843) panicked at arrow-cast/src/cast/mod.rs:9068:13:
assertion `left == right` failed: Cast to List(Field { name: "element", data_type: Float32, nullable: true, metadata: {"PARQUET:field_id": "89"} }) should preserve field metadata
  left: List(Field { data_type: Float32, nullable: true })
 right: List(Field { name: "element", data_type: Float32, nullable: true, metadata: {"PARQUET:field_id": "89"} })


failures:
    cast::tests::test_cast_fixed_size_list_to_list_preserves_field_metadata

test result: FAILED. 341 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

@alamb alamb merged commit c46f419 into apache:main May 21, 2026
26 checks passed
@mapleFU mapleFU deleted the trying-to-fix-cast-lost-schema branch May 22, 2026 14:24
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cast FixedSizeList to List will lost datatype metadata in list

2 participants