Skip to content

Unambiguously equate decimal16 with SqlDecimal in Variant API#342

Merged
CurtHagenlocher merged 3 commits into
apache:mainfrom
CurtHagenlocher:GH-333
Apr 30, 2026
Merged

Unambiguously equate decimal16 with SqlDecimal in Variant API#342
CurtHagenlocher merged 3 commits into
apache:mainfrom
CurtHagenlocher:GH-333

Conversation

@CurtHagenlocher
Copy link
Copy Markdown
Contributor

What's Changed

Unambiguously equate decimal16 with SqlDecimal in Variant API

Closes #333.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Variant API to treat decimal16 as SqlDecimal at the API boundary, simplifying semantics and removing the prior dual decimal/SqlDecimal behavior for Decimal16.

Changes:

  • Change VariantValue.FromDecimal16 to accept SqlDecimal and make AsDecimal() unsupported for Decimal16 (use AsSqlDecimal() instead).
  • Remove IsSqlDecimalStorage and update unit tests to validate Decimal16 behavior via AsSqlDecimal().
  • Update JSON/shredding/parquet test paths to use SqlDecimal for Decimal16.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/Apache.Arrow.Scalars.Tests/VariantValueTests.cs Updates Decimal16 tests to use SqlDecimal and asserts AsDecimal() throws for Decimal16.
test/Apache.Arrow.Scalars.Tests/VariantSqlDecimalTests.cs Updates Decimal16-related assertions to use AsSqlDecimal() and aligns exception expectations.
test/Apache.Arrow.Scalars.Tests/ParquetTestingVectorTests.cs Uses AsSqlDecimal().ToDouble() when comparing Decimal16 values.
test/Apache.Arrow.Operations.Tests/Shredding/ShreddedVariantReaderTests.cs Aligns Decimal16 AsDecimal() behavior to throw InvalidOperationException.
src/Apache.Arrow.Scalars/Variant/VariantValue.cs Switches Decimal16 API surface to SqlDecimal, updates decimal accessors, removes IsSqlDecimalStorage.
src/Apache.Arrow.Operations/VariantJson/VariantJsonConverter.cs Serializes Decimal16 using AsSqlDecimal() and WriteRawValue.
src/Apache.Arrow.Operations/Shredding/VariantShredder.cs Changes Decimal16 typed extraction to go through AsSqlDecimal().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Apache.Arrow.Operations/VariantJson/VariantJsonConverter.cs
Comment thread src/Apache.Arrow.Operations/Shredding/VariantShredder.cs Outdated
Comment thread src/Apache.Arrow.Scalars/Variant/VariantValue.cs Outdated
Comment thread src/Apache.Arrow.Scalars/Variant/VariantValue.cs Outdated
Comment thread src/Apache.Arrow.Scalars/Variant/VariantValue.cs
Copy link
Copy Markdown
Contributor

@adamreeve adamreeve left a comment

Choose a reason for hiding this comment

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

Thanks Curt, this makes sense to me, I just noticed one possible issue.

Comment thread src/Apache.Arrow.Scalars/Variant/VariantValue.cs Outdated
@CurtHagenlocher CurtHagenlocher merged commit 3ea9aaa into apache:main Apr 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleanup VariantValue, decimal16 and SqlDecimal

3 participants