@@ -56,15 +56,15 @@ macro_rules! impl_primitive_from_variant {
5656 }
5757 }
5858 } ;
59- ( $arrow_type: ty $( , $variant_method : ident => $cast_fn: expr ) + ) => {
59+ ( $arrow_type: ty, $( $variant_type : pat => $variant_method : ident , $ cast_fn: expr ) ,+ $ ( , ) ? ) => {
6060 impl TimestampFromVariant for $arrow_type {
6161 fn from_variant( variant: & Variant <' _, ' _>) -> Option <Self :: Native > {
62- $ (
63- if let Some ( value ) = variant . $variant_method ( ) {
64- return Some ( $cast_fn( value ) ) ;
65- }
66- ) +
67- None
62+ match variant {
63+ $ (
64+ $variant_type => variant . $variant_method ( ) . map ( $cast_fn) ,
65+ ) +
66+ _ => None
67+ }
6868 }
6969 }
7070 } ;
@@ -88,11 +88,11 @@ impl_primitive_from_variant!(
8888) ;
8989impl_primitive_from_variant ! (
9090 datatypes:: TimestampMicrosecondType ,
91- as_timestamp_micros => |t| t) ;
91+ Variant :: TimestampNtzMicros ( _ ) | Variant :: TimestampMicros ( _ ) => as_timestamp_micros , |t| t) ;
9292impl_primitive_from_variant ! (
9393 datatypes:: TimestampNanosecondType ,
94- as_timestamp_micros => |t| 1000 * t,
95- as_timestamp_nanos => |t| t) ;
94+ Variant :: TimestampNtzMicros ( _ ) | Variant :: TimestampMicros ( _ ) => as_timestamp_micros , |t| 1000 * t,
95+ Variant :: TimestampNtzNanos ( _ ) | Variant :: TimestampNanos ( _ ) => as_timestamp_nanos , |t| t) ;
9696
9797/// Convert the value at a specific index in the given array into a `Variant`.
9898macro_rules! non_generic_conversion_single_value {
0 commit comments