@@ -52,14 +52,13 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
52
52
match plan {
53
53
LogicalPlanType :: Projection ( projection) => {
54
54
let input: LogicalPlan = convert_box_required ! ( projection. input) ?;
55
+ let x: Vec < Expr > = projection
56
+ . expr
57
+ . iter ( )
58
+ . map ( |expr| expr. try_into ( ) )
59
+ . collect :: < Result < Vec < _ > , _ > > ( ) ?;
55
60
LogicalPlanBuilder :: from ( & input)
56
- . project (
57
- & projection
58
- . expr
59
- . iter ( )
60
- . map ( |expr| expr. try_into ( ) )
61
- . collect :: < Result < Vec < _ > , _ > > ( ) ?,
62
- ) ?
61
+ . project ( x) ?
63
62
. build ( )
64
63
. map_err ( |e| e. into ( ) )
65
64
}
@@ -89,7 +88,7 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
89
88
. map ( |expr| expr. try_into ( ) )
90
89
. collect :: < Result < Vec < _ > , _ > > ( ) ?;
91
90
LogicalPlanBuilder :: from ( & input)
92
- . aggregate ( & group_expr, & aggr_expr) ?
91
+ . aggregate ( group_expr, aggr_expr) ?
93
92
. build ( )
94
93
. map_err ( |e| e. into ( ) )
95
94
}
@@ -148,7 +147,7 @@ impl TryInto<LogicalPlan> for &protobuf::LogicalPlanNode {
148
147
. map ( |expr| expr. try_into ( ) )
149
148
. collect :: < Result < Vec < Expr > , _ > > ( ) ?;
150
149
LogicalPlanBuilder :: from ( & input)
151
- . sort ( & sort_expr) ?
150
+ . sort ( sort_expr) ?
152
151
. build ( )
153
152
. map_err ( |e| e. into ( ) )
154
153
}
@@ -511,10 +510,10 @@ fn typechecked_scalar_value_conversion(
511
510
ScalarValue :: Date32 ( Some ( * v) )
512
511
}
513
512
( Value :: TimeMicrosecondValue ( v) , PrimitiveScalarType :: TimeMicrosecond ) => {
514
- ScalarValue :: TimeMicrosecond ( Some ( * v) )
513
+ ScalarValue :: TimestampMicrosecond ( Some ( * v) )
515
514
}
516
515
( Value :: TimeNanosecondValue ( v) , PrimitiveScalarType :: TimeMicrosecond ) => {
517
- ScalarValue :: TimeNanosecond ( Some ( * v) )
516
+ ScalarValue :: TimestampNanosecond ( Some ( * v) )
518
517
}
519
518
( Value :: Utf8Value ( v) , PrimitiveScalarType :: Utf8 ) => {
520
519
ScalarValue :: Utf8 ( Some ( v. to_owned ( ) ) )
@@ -547,10 +546,10 @@ fn typechecked_scalar_value_conversion(
547
546
PrimitiveScalarType :: LargeUtf8 => ScalarValue :: LargeUtf8 ( None ) ,
548
547
PrimitiveScalarType :: Date32 => ScalarValue :: Date32 ( None ) ,
549
548
PrimitiveScalarType :: TimeMicrosecond => {
550
- ScalarValue :: TimeMicrosecond ( None )
549
+ ScalarValue :: TimestampMicrosecond ( None )
551
550
}
552
551
PrimitiveScalarType :: TimeNanosecond => {
553
- ScalarValue :: TimeNanosecond ( None )
552
+ ScalarValue :: TimestampNanosecond ( None )
554
553
}
555
554
PrimitiveScalarType :: Null => {
556
555
return Err ( proto_error (
@@ -610,10 +609,10 @@ impl TryInto<datafusion::scalar::ScalarValue> for &protobuf::scalar_value::Value
610
609
ScalarValue :: Date32 ( Some ( * v) )
611
610
}
612
611
protobuf:: scalar_value:: Value :: TimeMicrosecondValue ( v) => {
613
- ScalarValue :: TimeMicrosecond ( Some ( * v) )
612
+ ScalarValue :: TimestampMicrosecond ( Some ( * v) )
614
613
}
615
614
protobuf:: scalar_value:: Value :: TimeNanosecondValue ( v) => {
616
- ScalarValue :: TimeNanosecond ( Some ( * v) )
615
+ ScalarValue :: TimestampNanosecond ( Some ( * v) )
617
616
}
618
617
protobuf:: scalar_value:: Value :: ListValue ( v) => v. try_into ( ) ?,
619
618
protobuf:: scalar_value:: Value :: NullListValue ( v) => {
@@ -776,10 +775,10 @@ impl TryInto<datafusion::scalar::ScalarValue> for protobuf::PrimitiveScalarType
776
775
protobuf:: PrimitiveScalarType :: LargeUtf8 => ScalarValue :: LargeUtf8 ( None ) ,
777
776
protobuf:: PrimitiveScalarType :: Date32 => ScalarValue :: Date32 ( None ) ,
778
777
protobuf:: PrimitiveScalarType :: TimeMicrosecond => {
779
- ScalarValue :: TimeMicrosecond ( None )
778
+ ScalarValue :: TimestampMicrosecond ( None )
780
779
}
781
780
protobuf:: PrimitiveScalarType :: TimeNanosecond => {
782
- ScalarValue :: TimeNanosecond ( None )
781
+ ScalarValue :: TimestampNanosecond ( None )
783
782
}
784
783
} )
785
784
}
@@ -829,10 +828,10 @@ impl TryInto<datafusion::scalar::ScalarValue> for &protobuf::ScalarValue {
829
828
ScalarValue :: Date32 ( Some ( * v) )
830
829
}
831
830
protobuf:: scalar_value:: Value :: TimeMicrosecondValue ( v) => {
832
- ScalarValue :: TimeMicrosecond ( Some ( * v) )
831
+ ScalarValue :: TimestampMicrosecond ( Some ( * v) )
833
832
}
834
833
protobuf:: scalar_value:: Value :: TimeNanosecondValue ( v) => {
835
- ScalarValue :: TimeNanosecond ( Some ( * v) )
834
+ ScalarValue :: TimestampNanosecond ( Some ( * v) )
836
835
}
837
836
protobuf:: scalar_value:: Value :: ListValue ( scalar_list) => {
838
837
let protobuf:: ScalarListValue {
@@ -962,6 +961,15 @@ impl TryInto<Expr> for &protobuf::LogicalExprNode {
962
961
let data_type = arrow_type. try_into ( ) ?;
963
962
Ok ( Expr :: Cast { expr, data_type } )
964
963
}
964
+ ExprType :: TryCast ( cast) => {
965
+ let expr = Box :: new ( parse_required_expr ( & cast. expr ) ?) ;
966
+ let arrow_type: & protobuf:: ArrowType = cast
967
+ . arrow_type
968
+ . as_ref ( )
969
+ . ok_or_else ( || proto_error ( "Protobuf deserialization error: CastNode message missing required field 'arrow_type'" ) ) ?;
970
+ let data_type = arrow_type. try_into ( ) ?;
971
+ Ok ( Expr :: TryCast { expr, data_type } )
972
+ }
965
973
ExprType :: Sort ( sort) => Ok ( Expr :: Sort {
966
974
expr : Box :: new ( parse_required_expr ( & sort. expr ) ?) ,
967
975
asc : sort. asc ,
0 commit comments