File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ use datafusion::common::tree_node::Transformed;
66use datafusion:: common:: Column ;
77use datafusion:: common:: DFSchema ;
88use datafusion:: common:: Result ;
9- use datafusion:: error:: DataFusionError ;
109use datafusion:: logical_expr:: expr:: { Alias , Cast , Expr , ScalarFunction } ;
1110use datafusion:: logical_expr:: expr_rewriter:: FunctionRewrite ;
1211use datafusion:: logical_expr:: planner:: { ExprPlanner , PlannerResult , RawBinaryExpr } ;
@@ -107,17 +106,14 @@ enum JsonOperator {
107106}
108107
109108impl TryFrom < & BinaryOperator > for JsonOperator {
110- type Error = DataFusionError ;
109+ type Error = ( ) ;
111110
112- fn try_from ( op : & BinaryOperator ) -> Result < Self > {
111+ fn try_from ( op : & BinaryOperator ) -> Result < Self , Self :: Error > {
113112 match op {
114113 BinaryOperator :: Arrow => Ok ( JsonOperator :: Arrow ) ,
115114 BinaryOperator :: LongArrow => Ok ( JsonOperator :: LongArrow ) ,
116115 BinaryOperator :: Question => Ok ( JsonOperator :: Question ) ,
117- _ => Err ( DataFusionError :: Internal ( format ! (
118- "Unexpected operator {:?} in JSON function rewriter" ,
119- op
120- ) ) ) ,
116+ _ => Err ( ( ) ) ,
121117 }
122118 }
123119}
Original file line number Diff line number Diff line change @@ -819,21 +819,21 @@ async fn test_long_arrow_eq_str() {
819819 assert_batches_eq ! ( expected, & batches) ;
820820}
821821
822+ /// Test column name / alias creation with a cast in the needle / key
822823#[ tokio:: test]
823824async fn test_arrow_cast_key_text ( ) {
824- let sql = r#"select ('{"foo": 42}'->('foo'::text))"# ;
825+ let sql = r#"select ('{"foo": 42}'->> ('foo'::text))"# ;
825826 let batches = run_query ( sql) . await . unwrap ( ) ;
826827
827828 let expected = [
828- "+------------------------+" ,
829- "| '{\" foo\" : 42}' -> 'foo' |" ,
830- "+------------------------+" ,
831- "| {int=42} |" ,
832- "+------------------------+" ,
829+ "+------------------------- +" ,
830+ "| '{\" foo\" : 42}' ->> 'foo' |" ,
831+ "+------------------------- +" ,
832+ "| 42 |" ,
833+ "+------------------------- +" ,
833834 ] ;
834- assert_batches_eq ! ( expected, & batches) ;
835835
836- assert_eq ! ( display_val ( batches ) . await , ( DataType :: Int64 , "42" . to_string ( ) ) ) ;
836+ assert_batches_eq ! ( expected , & batches ) ;
837837}
838838
839839#[ tokio:: test]
You can’t perform that action at this time.
0 commit comments