Skip to content

Apache DataFusion SQL Query Engine

Minor: Return InternalError rather than panic for `NamedStructField should be rewritten in OperatorToFunction` (#9968)

Andrew Lambd201ec742b08
diff --git a/datafusion/physical-expr/src/planner.rs b/datafusion/physical-expr/src/planner.rs
index 44c9d33d60..aefbd54f8e 100644
--- a/datafusion/physical-expr/src/planner.rs
+++ b/datafusion/physical-expr/src/planner.rs
@@ -283,25 +283,23 @@ pub fn create_physical_expr(
input_dfschema,
execution_props,
)?),
- Expr::GetIndexedField(GetIndexedField { expr: _, field }) => {
- match field {
- GetFieldAccess::NamedStructField { name: _ } => {
- unreachable!(
- "NamedStructField should be rewritten in OperatorToFunction"
- )
- }
- GetFieldAccess::ListIndex { key: _ } => {
- unreachable!("ListIndex should be rewritten in OperatorToFunction")
- }
- GetFieldAccess::ListRange {
- start: _,
- stop: _,
- stride: _,
- } => {
- unreachable!("ListRange should be rewritten in OperatorToFunction")
- }
- };
- }
+ Expr::GetIndexedField(GetIndexedField { expr: _, field }) => match field {
+ GetFieldAccess::NamedStructField { name: _ } => {
+ internal_err!(
+ "NamedStructField should be rewritten in OperatorToFunction"
+ )
+ }
+ GetFieldAccess::ListIndex { key: _ } => {
+ internal_err!("ListIndex should be rewritten in OperatorToFunction")
+ }
+ GetFieldAccess::ListRange {
+ start: _,
+ stop: _,
+ stride: _,
+ } => {
+ internal_err!("ListRange should be rewritten in OperatorToFunction")
+ }
+ },
Expr::ScalarFunction(ScalarFunction { func_def, args }) => {
let physical_args =