Unambiguously equate decimal16 with SqlDecimal in Variant API#342
Merged
Conversation
There was a problem hiding this comment.
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.FromDecimal16to acceptSqlDecimaland makeAsDecimal()unsupported forDecimal16(useAsSqlDecimal()instead). - Remove
IsSqlDecimalStorageand update unit tests to validateDecimal16behavior viaAsSqlDecimal(). - Update JSON/shredding/parquet test paths to use
SqlDecimalforDecimal16.
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.
adamreeve
reviewed
Apr 29, 2026
Contributor
adamreeve
left a comment
There was a problem hiding this comment.
Thanks Curt, this makes sense to me, I just noticed one possible issue.
adamreeve
approved these changes
Apr 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's Changed
Unambiguously equate
decimal16withSqlDecimalin Variant APICloses #333.