You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arrow specifies a particular format for decimals to be laid out, it would be nice to have a struct like Arrow's Decimal128/Decimal256 that allows us to construct them from integers and have a method ArrowArrayAppendDecimal.
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up - I think it's definitely in scope to add a decimal extractor and appender. We'd probably need a struct to define a decimal...maybe:
structArrowDecimal {
// Words defined from most-significant to least-significant or the other way around?// nanoarrow could take care of ensuring that these are copied in the right order on big endianint32_twords[8]; // or int64_t words[4]?int32_tprecision;
int32_tscale;
};
ArrowErrorCodeArrowArrayAppendDecimal(structArrowArray*array, structArrowDecimal*value);
voidArrowArrayViewGetDecimal(structArrowArrayView*array_view, structArrowDecimal*out);
Closes#170.
This is not designed to be a fully-featured performant decimal math
library, but is designed to help with byte shuffling and provide enough
support that users can write tests for decimal arrays (e.g., by
providing integer getters and setters for numbers that fit within the
int64 range).
Adds a `struct ArrowDecimal` and utility functions:
```c
static inline void ArrowDecimalInit(struct ArrowDecimal* decimal, int32_t bitwidth,
int32_t precision, int32_t scale);
static inline int64_t ArrowDecimalGetIntUnsafe(struct ArrowDecimal* decimal);
static inline void ArrowDecimalGetBytes(struct ArrowDecimal* decimal, uint8_t* out);
static inline int64_t ArrowDecimalSign(struct ArrowDecimal* decimal);
static inline void ArrowDecimalSetInt(struct ArrowDecimal* decimal, int64_t value);
static inline void ArrowDecimalSetBytes(struct ArrowDecimal* decimal,
const uint8_t* value);
```
...and adds a "getter" and an "appender":
```c
static inline ArrowErrorCode ArrowArrayAppendDecimal(struct ArrowArray* array,
struct ArrowDecimal* value);
static inline void ArrowArrayViewGetDecimalUnsafe(struct ArrowArrayView* array_view,
int64_t i, struct ArrowDecimal* out);
```
Arrow specifies a particular format for decimals to be laid out, it would be nice to have a struct like Arrow's Decimal128/Decimal256 that allows us to construct them from integers and have a method
ArrowArrayAppendDecimal
.The text was updated successfully, but these errors were encountered: