klion26 commented on code in PR #10157:
URL: https://github.com/apache/arrow-rs/pull/10157#discussion_r3637580553
##########
parquet-variant/src/variant/decimal.rs:
##########
@@ -174,6 +178,14 @@ macro_rules! impl_variant_decimal {
fn scale(&self) -> u8 {
self.scale()
}
+
+ fn as_integer(&self) -> Option<$native> {
+ if self.scale == 0 {
+ return Some(self.integer);
+ }
+ let divisor = <$native>::pow(10, self.scale as u32);
+ (self.integer % divisor == 0).then(|| self.integer / divisor)
+ }
Review Comment:
Enhanced the tests in `shred_variant.rs` and add a doc test for the function
<img width="1017" height="477" alt="image"
src="https://github.com/user-attachments/assets/d1f5d5d4-fe93-4a2a-82bd-8cf2bac32f66"
/>
--
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]