Skip to content

Conversation

@Weijun-H
Copy link
Member

@Weijun-H Weijun-H commented Jun 22, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

  • Introduced new types: VariantDecimal4, VariantDecimal8, and VariantDecimal16
  • These types encapsulate decimal values and ensure proper validation and wrapping

Are there any user-facing changes?

@github-actions github-actions bot added the parquet Changes to the parquet crate label Jun 22, 2025
@Weijun-H Weijun-H changed the title [WIP] feat: Add Validation for Variant Deciaml feat: Add Validation for Variant Deciaml Jun 22, 2025
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.

Thanks @Weijun-H -- this looks like a great start. I left some suggestions -- let me know what you think

@alamb
Copy link
Contributor

alamb commented Jun 23, 2025

@scovich and @friendlymatthew perhaps you have some time to review this PR as well

@Weijun-H Weijun-H force-pushed the 7697-variant-decimal-validation branch 2 times, most recently from 681e4f1 to 5826ca6 Compare June 24, 2025 12:40
@Weijun-H Weijun-H force-pushed the 7697-variant-decimal-validation branch from 5826ca6 to 2ed858b Compare June 24, 2025 12:41
@Weijun-H Weijun-H force-pushed the 7697-variant-decimal-validation branch from ca8b76e to e71f52f Compare June 24, 2025 12:51
@Weijun-H Weijun-H marked this pull request as draft June 24, 2025 13:17
@Weijun-H Weijun-H marked this pull request as ready for review June 24, 2025 14:07
@Weijun-H Weijun-H requested a review from alamb June 24, 2025 14:09
@alamb alamb changed the title feat: Add Validation for Variant Deciaml feat: [Variant] Add Validation for Variant Deciaml Jun 24, 2025
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 @Weijun-H -- this looks great to me

I am going to merge this one in so we minimize conflicts with @friendlymatthew 's PR

@alamb alamb merged commit 121371c into apache:main Jun 24, 2025
13 of 14 checks passed
@alamb
Copy link
Contributor

alamb commented Jun 24, 2025

I made a small follow on PR as well

alamb added a commit to alamb/arrow-rs that referenced this pull request Jun 24, 2025
carpecodeum pushed a commit to cmu-db/arrow-rs that referenced this pull request Jun 25, 2025
alamb added a commit that referenced this pull request Jun 25, 2025
…ing tests (#7776)

# Which issue does this PR close?

* Relates to #7697
* Part of #6736

# Rationale for this change

As a follow-up to #7738, we
should verify that the unscaled integer value fits in the max precision
(scale factor was already validated).

# What changes are included in this PR?

Add the missing checking, and add missing unit tests for both precision
and scale.

Also move the `VariantDecimalXX` structs to their own mod.

# Are these changes tested?

Yes, see above.

# Are there any user-facing changes?

No. Public re-rexport of the moved structs.

Co-authored-by: Andrew Lamb <[email protected]>
alamb added a commit that referenced this pull request Jun 27, 2025
…es (#7770)

# Which issue does this PR close?

We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.

- part of #6736

# Rationale for this change

I noticed this while reviewing @Weijun-H's PR
- #7738

I didn't know what part of the crate were using the fields directly and
thus what part could potentially be creating invalid variants. By making
the fields non `pub(crate)` I think it makes it clear these can not be
constructed invalidly

This also gave me a good excuse to write some more examples

# What changes are included in this PR?
1. make fields in `VariantDecimal*` private
2. Add doc examples examples

# Are these changes tested?
By CI 

# Are there any user-facing changes?

API change in a non-published crate, so no end user impact yet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Variant] Add input validation in VariantBuilder

2 participants