File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -1445,25 +1445,23 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
14451445 . map ( |order_by_expr| {
14461446 let ordered_expr = & order_by_expr. expr ;
14471447 let ordered_expr = ordered_expr. to_owned ( ) ;
1448- let ordered_expr = self
1449- . sql_expr_to_logical_expr (
1450- ordered_expr,
1451- schema,
1452- planner_context,
1453- )
1454- . unwrap ( ) ;
1448+ let ordered_expr = self . sql_expr_to_logical_expr (
1449+ ordered_expr,
1450+ schema,
1451+ planner_context,
1452+ ) ?;
14551453 let asc = order_by_expr. options . asc . unwrap_or ( true ) ;
14561454 let nulls_first =
14571455 order_by_expr. options . nulls_first . unwrap_or_else ( || {
14581456 self . options . default_null_ordering . nulls_first ( asc)
14591457 } ) ;
14601458
1461- SortExpr :: new ( ordered_expr, asc, nulls_first)
1459+ Ok ( SortExpr :: new ( ordered_expr, asc, nulls_first) )
14621460 } )
1463- . collect :: < Vec < SortExpr > > ( ) ;
1464- result
1461+ . collect :: < Result < Vec < SortExpr > > > ( ) ? ;
1462+ Ok ( result)
14651463 } )
1466- . collect :: < Vec < Vec < SortExpr > > > ( ) ;
1464+ . collect :: < Result < Vec < Vec < SortExpr > > > > ( ) ? ;
14671465
14681466 return Ok ( results) ;
14691467 }
Original file line number Diff line number Diff line change @@ -766,6 +766,13 @@ physical_plan DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/
766766query error DataFusion error: Error during planning: Column a is not in schema
767767CREATE EXTERNAL TABLE dt (a_id integer, a_str string, a_bool boolean) STORED AS CSV WITH ORDER (a ASC) LOCATION 'file://path/to/table';
768768
769+
770+ # Create external table with order column expression that can't be planned
771+ # This is currently expected to fail, but should not panic
772+ query error DataFusion error: Schema error: No field named a\.
773+ CREATE EXTERNAL TABLE dt STORED AS CSV WITH ORDER (a || b) LOCATION 'file://path/to/table';
774+
775+
769776# Sort with duplicate sort expressions
770777# Table is sorted multiple times on the same column name and should not fail
771778statement ok
You can’t perform that action at this time.
0 commit comments