Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Negative scale for Decimal and Decimal256 #1518

Open
xcharleslin opened this issue Jul 6, 2023 · 1 comment
Open

Negative scale for Decimal and Decimal256 #1518

xcharleslin opened this issue Jul 6, 2023 · 1 comment

Comments

@xcharleslin
Copy link

xcharleslin commented Jul 6, 2023

Analogous to apache/arrow-rs#1785.

Currently, Arrow2 Decimal and Decimal256 have scale typed as usize, which would not support negative scale.

As a driveby, precision is also currently typed as usize but could probably be typed as u8. It seems the max value for precision on pyarrow is 76.

@xcharleslin xcharleslin changed the title Negative scale for Decimal and Decimal128 Negative scale for Decimal and Decimal256 Jul 7, 2023
@xcharleslin
Copy link
Author

xcharleslin commented Jul 11, 2023

Somewhat related, currently impl From<PrimitiveType> for DataType has this https://github.com/jorgecarleitao/arrow2/blame/8ee5ad8c774e7355218376caf73d94bce2a769a6/src/datatypes/mod.rs#L493-L494

    Int128 => Decimal(32, 32),
    Int256 => Decimal256(32, 32),

Would Decimal(32, 32) only support 0.000000* to 0.999999*?

Also, would more precision be required to support Int128 and Int256? The maximum values for these are 39 and 78 digits long respectively (although it seems PyArrow only supports 38 and 76 for some reason).

    Int128 => Decimal(38, 0),
    Int256 => Decimal256(76, 0),

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant