jonahgao commented on code in PR #11214: URL: https://github.com/apache/datafusion/pull/11214#discussion_r1664436314
########## datafusion/sql/src/expr/mod.rs: ########## @@ -619,10 +620,45 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { } }, ))), + SQLExpr::Dictionary(fields) => { + let mut keys = vec![]; + let mut values = vec![]; + for field in fields { + let key = lit(field.key.value); + let value = self.sql_expr_to_logical_expr( + *field.value, + schema, + planner_context, + )?; + keys.push(key); + values.push(value); + } + + let expr = RawDictionaryExpr { keys, values }; + self.try_plan_dictionary_literal(expr, schema) + } _ => not_impl_err!("Unsupported ast node in sqltorel: {sql:?}"), } } + fn try_plan_dictionary_literal( + &self, + expr: RawDictionaryExpr, + schema: &DFSchema, + ) -> Result<Expr> { + let mut raw_expr = expr; + for planner in self.planners.iter() { + match planner.plan_dictionary_literal(raw_expr, schema)? { + PlannerResult::Planned(expr) => { + return Ok(expr); + } + PlannerResult::Original(expr) => raw_expr = expr, + } + } + + internal_err!("Expected a simplified result, but none was found") Review Comment: Would it be better to return a `not_impl_err` error? User may only use `SqlToRel` without a `SessionState`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org