@@ -9,9 +9,10 @@ use optd_core::rel_node::RelNode;
99use optd_datafusion_repr:: {
1010 plan_nodes:: {
1111 BetweenExpr , BinOpExpr , BinOpType , CastExpr , ColumnRefExpr , ConstantExpr , Expr , ExprList ,
12- FuncExpr , FuncType , JoinType , LogOpExpr , LogOpType , LogicalAgg , LogicalEmptyRelation ,
13- LogicalFilter , LogicalJoin , LogicalLimit , LogicalProjection , LogicalScan , LogicalSort ,
14- OptRelNode , OptRelNodeRef , OptRelNodeTyp , PlanNode , SortOrderExpr , SortOrderType ,
12+ FuncExpr , FuncType , JoinType , LikeExpr , LogOpExpr , LogOpType , LogicalAgg ,
13+ LogicalEmptyRelation , LogicalFilter , LogicalJoin , LogicalLimit , LogicalProjection ,
14+ LogicalScan , LogicalSort , OptRelNode , OptRelNodeRef , OptRelNodeTyp , PlanNode ,
15+ SortOrderExpr , SortOrderType ,
1516 } ,
1617 Value ,
1718} ;
@@ -54,7 +55,9 @@ impl OptdPlanContext<'_> {
5455 Operator :: Eq => BinOpType :: Eq ,
5556 Operator :: NotEq => BinOpType :: Neq ,
5657 Operator :: LtEq => BinOpType :: Leq ,
58+ Operator :: Lt => BinOpType :: Lt ,
5759 Operator :: GtEq => BinOpType :: Geq ,
60+ Operator :: Gt => BinOpType :: Gt ,
5861 Operator :: And => BinOpType :: And ,
5962 Operator :: Plus => BinOpType :: Add ,
6063 Operator :: Minus => BinOpType :: Sub ,
@@ -101,6 +104,10 @@ impl OptdPlanContext<'_> {
101104 let x = x. as_ref ( ) . unwrap ( ) ;
102105 Ok ( ConstantExpr :: int64 ( * x) . into_expr ( ) )
103106 }
107+ ScalarValue :: Float64 ( x) => {
108+ let x = x. as_ref ( ) . unwrap ( ) ;
109+ Ok ( ConstantExpr :: float64 ( * x) . into_expr ( ) )
110+ }
104111 ScalarValue :: Utf8 ( x) => {
105112 let x = x. as_ref ( ) . unwrap ( ) ;
106113 Ok ( ConstantExpr :: string ( x) . into_expr ( ) )
@@ -166,12 +173,24 @@ impl OptdPlanContext<'_> {
166173 let data_type = x. data_type . clone ( ) ;
167174 let val = match data_type {
168175 arrow_schema:: DataType :: Int8 => Value :: Int8 ( 0 ) ,
176+ arrow_schema:: DataType :: Int16 => Value :: Int16 ( 0 ) ,
177+ arrow_schema:: DataType :: Int32 => Value :: Int32 ( 0 ) ,
178+ arrow_schema:: DataType :: Int64 => Value :: Int64 ( 0 ) ,
179+ arrow_schema:: DataType :: UInt8 => Value :: UInt8 ( 0 ) ,
180+ arrow_schema:: DataType :: UInt16 => Value :: UInt16 ( 0 ) ,
181+ arrow_schema:: DataType :: UInt32 => Value :: UInt32 ( 0 ) ,
182+ arrow_schema:: DataType :: UInt64 => Value :: UInt64 ( 0 ) ,
169183 arrow_schema:: DataType :: Date32 => Value :: Date32 ( 0 ) ,
170184 arrow_schema:: DataType :: Decimal128 ( _, _) => Value :: Decimal128 ( 0 ) ,
171185 other => unimplemented ! ( "unimplemented datatype {:?}" , other) ,
172186 } ;
173187 Ok ( CastExpr :: new ( expr, val) . into_expr ( ) )
174188 }
189+ Expr :: Like ( x) => {
190+ let expr = self . conv_into_optd_expr ( x. expr . as_ref ( ) , context) ?;
191+ let pattern = self . conv_into_optd_expr ( x. pattern . as_ref ( ) , context) ?;
192+ Ok ( LikeExpr :: new ( x. negated , x. case_insensitive , expr, pattern) . into_expr ( ) )
193+ }
175194 _ => bail ! ( "Unsupported expression: {:?}" , expr) ,
176195 }
177196 }
0 commit comments