Skip to content

Conversation

liamzwbao
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Support strict casting for Decimal types, also fix the non-strict cast for temporal types where the results should be Variant:Null (Overflow) instead None (missing value)

Are these changes tested?

Yes

Are there any user-facing changes?

Yes, decimal casting now supports strict and non-strict modes

@github-actions github-actions bot added the parquet-variant parquet-variant* crates label Sep 27, 2025
run_test_with_options(values, expected, false);
}

#[test]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved above to group related tests together

@liamzwbao liamzwbao marked this pull request as ready for review September 27, 2025 18:18
@alamb
Copy link
Contributor

alamb commented Sep 29, 2025

@scovich since you filed #8303 can you please help review this PR?

Copy link
Contributor

@scovich scovich left a comment

Choose a reason for hiding this comment

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

LGTM, one nit

|array| -> arrow::array::Decimal32Array { array.as_primitive() },
|value| decimal_to_variant_decimal!(value, scale, i32, VariantDecimal4)
|value| -> Option<_> {
decimal_to_variant_decimal!(value, scale, i32, VariantDecimal4).map(Variant::from)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need these Variant::from calls?

The builder append_value should take impl Into<Variant>
and we already define the needed impl From<DecimalXX> for Variant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet-variant parquet-variant* crates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Variant] Support strict casting for all data types
3 participants