klion26 commented on code in PR #8516:
URL: https://github.com/apache/arrow-rs/pull/8516#discussion_r2410341063


##########
parquet-variant-compute/src/type_conversion.rs:
##########
@@ -38,12 +39,40 @@ pub(crate) trait PrimitiveFromVariant: ArrowPrimitiveType {
     fn from_variant(variant: &Variant<'_, '_>) -> Option<Self::Native>;
 }
 
+/// Extension trait for Arrow timestamp types that can extract their native 
value from a Variant
+/// We can't use [`PrimitiveFromVariant`] directly because we might need to 
use methods that
+/// are only available on [`ArrowTimestampType`] (such as with_timezone_opt)
+pub(crate) trait TimestampFromVariant<const NTZ: bool>: ArrowTimestampType {
+    fn from_variant(variant: &Variant<'_, '_>) -> Option<Self::Native>;
+}
+
+/// Extension trait that `ArrowTimestampType` handle `DateTime<Utc>` like 
`NaiveDateTime`
+trait MakeValueTz: ArrowTimestampType {
+    fn make_value_tz(timestamp: DateTime<Utc>) -> Option<i64> {

Review Comment:
   Sorry for didn't add a comment for this, use `make_value_tz` here because it 
can't compile if I try to "overload" `make_value`, the compiler needs me to 
convert type to a specific type in `MakeValueTz::make_value` and macro 
`impl_timestamp_from_variant`(something like `<Self as 
ArrowTimestampType>::make_value(...)` and `<Self as 
MakeValueTz>::make_value(...)`. and googled that seems Rust didn't support 
"overload" with same func name and different parameters. not sure if I missed 
anything here



##########
parquet-variant-compute/src/type_conversion.rs:
##########
@@ -38,12 +39,40 @@ pub(crate) trait PrimitiveFromVariant: ArrowPrimitiveType {
     fn from_variant(variant: &Variant<'_, '_>) -> Option<Self::Native>;
 }
 
+/// Extension trait for Arrow timestamp types that can extract their native 
value from a Variant
+/// We can't use [`PrimitiveFromVariant`] directly because we might need to 
use methods that
+/// are only available on [`ArrowTimestampType`] (such as with_timezone_opt)
+pub(crate) trait TimestampFromVariant<const NTZ: bool>: ArrowTimestampType {

Review Comment:
   fixed



-- 
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]

Reply via email to