Skip to content

Wire DecimalArray into NumericArray, Array, Scalar with From impls - #182

Merged
pbower merged 2 commits into
feature/decimalfrom
MA-EPC86-DECIMAL-TSK377-NUMERIC-ENUM
Aug 31, 2026
Merged

Wire DecimalArray into NumericArray, Array, Scalar with From impls#182
pbower merged 2 commits into
feature/decimalfrom
MA-EPC86-DECIMAL-TSK377-NUMERIC-ENUM

Conversation

@pbower

@pbower pbower commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds Decimal32, Decimal64, Decimal128 variants to NumericArray with match arms across all 12 dispatch methods
  • Adds dec32()/try_dec32(), dec64()/try_dec64(), dec128()/try_dec128() accessors with cross-width widening
  • Adds Scalar::Decimal32/64/128 variants with scale-aware Display
  • Implements arrow_type() on DecimalArray (deferred from TSK375)
  • Adds From impls: owned and Arc for each width into NumericArray and Array, plus widening conversions between decimal widths
  • Cascades decimal arms across Array, FieldArray, Arena, XArray, views, broadcast, print, consolidate, byte_size, value, and macros
  • 39 new tests across numeric_array, array, scalar, and decimal modules

Test plan

  • cargo test --features decimal passes (775 tests)
  • cargo test without decimal passes (680 tests, no regression)
  • cargo test --all-features passes (1,672 tests)
  • cargo check --all-features clean

…m impls and tests (#182)

Phase 2 of EPC86. Adds Decimal32/64/128 variants gated behind
the `decimal` feature flag to NumericArray, Array, and Scalar enums.
Cascades match arms across all dispatch sites, adds typed accessors
(dec32/try_dec32, dec64/try_dec64, dec128/try_dec128), widening
conversions between decimal widths, and liberal From impls for
DecimalArray -> NumericArray -> Array.
@pbower pbower changed the title Wire DecimalArray into NumericArray, Array, Scalar with From impls (TSK377) Wire DecimalArray into NumericArray, Array, Scalar with From impls Aug 31, 2026
Comment thread src/enums/collections/numeric_array.rs Outdated
NumericArray::Decimal32(_) | NumericArray::Decimal64(_) | NumericArray::Decimal128(_) => {
Err(MinarrowError::TypeError {
from: "DecimalArray",
to: "IntegerArray<i32>",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly incorrect.

Comment thread src/enums/collections/numeric_array.rs Outdated
Err(MinarrowError::TypeError {
from: "DecimalArray",
to: "IntegerArray<i64>",
message: Some("decimal-to-integer conversion requires explicit .to_int64_array()".to_string()),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly incorrect.

Comment thread src/enums/collections/numeric_array.rs Outdated
Err(MinarrowError::TypeError {
from: "DecimalArray",
to: "IntegerArray<u32>",
message: Some("decimal-to-integer conversion requires explicit .to_uint32_array()".to_string()),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly incorrect.

Comment thread src/enums/collections/numeric_array.rs Outdated
Err(MinarrowError::TypeError {
from: "DecimalArray",
to: "IntegerArray<u64>",
message: Some("decimal-to-integer conversion requires explicit .to_uint64_array()".to_string()),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly incorrect.

Comment thread src/enums/collections/numeric_array.rs Outdated
NumericArray::Decimal32(_) | NumericArray::Decimal64(_) | NumericArray::Decimal128(_) => {
Err(MinarrowError::TypeError {
from: "DecimalArray",
to: "FloatArray<f32>",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly incorrect.

Comment thread src/enums/collections/numeric_array.rs Outdated
NumericArray::Decimal32(_) | NumericArray::Decimal64(_) | NumericArray::Decimal128(_) => {
Err(MinarrowError::TypeError {
from: "DecimalArray",
to: "BooleanArray<u8>",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly inconsistent.

Comment thread src/enums/collections/numeric_array.rs Outdated
#[cfg(feature = "decimal")]
NumericArray::Decimal32(_) | NumericArray::Decimal64(_) | NumericArray::Decimal128(_) => {
Err(MinarrowError::TypeError {
from: "DecimalArray",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clearly incorrect.

The try_i32/i64/u32/u64/f32/f64/bool/str methods and cow_into_f64
previously returned errors for decimal variants. Now they perform
scale-aware conversions consistent with every other numeric type.
@pbower
pbower merged commit e731814 into feature/decimal Aug 31, 2026
17 checks passed
@pbower
pbower deleted the MA-EPC86-DECIMAL-TSK377-NUMERIC-ENUM branch August 31, 2026 04:07
pbower added a commit that referenced this pull request Aug 31, 2026
* Add DecimalArray foundation and i128 trait impls (#181)

* Add Decimal32, Decimal64, Decimal128 variants to ArrowType (#180)

* Wire DecimalArray into NumericArray, Array, Scalar with From impls (#182)

* Wire DecimalArray into NumericArray, Array, and Scalar enums with From impls and tests (#182)

* Implement decimal conversion arms in NumericArray try_ accessors

* Add decimal FFI import/export with arrow-rs and Polars round-trips (#186)

* Add decimal FFI import/export with arrow-rs and Polars round-trips

* Integrate DecimalArray into Value, ArrayV, NumericArrayV, SuperArray, SuperArrayV, and Consolidate (#187)

* Add decimal broadcast dispatch and scale-aware print formatting (#184)

* Add decimal arithmetic kernels with checked overflow and auto-promotion + fix null mask drop on broadcasting (#185)

* Add decimal arithmetic kernels with checked overflow and auto-promotion
* Propagate null mask through broadcast for all array types

* Add DecimalArray type conversions and width conversion methods (#183)

* Add decimal support to pyo3 and minarrow-py Python bridges (#188)

* Add Decimal32 and Decimal64 round-trip tests for arrow-rs

* Add decimal support to pyo3 and minarrow-py Python bridges

* Make precision and scale report values for all numeric types
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.

1 participant