liukun4515 commented on issue #2637:
URL: https://github.com/apache/arrow-rs/issues/2637#issuecomment-1236486886
@tustvold Do you means that you want to implement the `ArrowNativeType` for
?
I go through the code,
```
/// Trait bridging the dynamic-typed nature of Arrow (via [`DataType`]) with
the
/// static-typed nature of rust types ([`ArrowNativeType`]) for all types
that implement [`ArrowNativeType`].
pub trait ArrowPrimitiveType: 'static {
/// Corresponding Rust native type for the primitive type.
type Native: ArrowNativeType;
/// the corresponding Arrow data type of this primitive type.
const DATA_TYPE: DataType;
/// Returns the byte width of this primitive type.
fn get_byte_width() -> usize {
std::mem::size_of::<Self::Native>()
}
/// Returns a default value of this primitive type.
///
/// This is useful for aggregate array ops like `sum()`, `mean()`.
fn default_value() -> Self::Native {
Default::default()
}
}
```
But what's the `const DATA_TYPE: DataType;` for Decimal128Type?, just use
the default decimal128 type
```
const DEFAULT_TYPE: DataType =
DataType::Decimal128(DECIMAL128_MAX_PRECISION,
DECIMAL_DEFAULT_SCALE);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]