dharanad commented on code in PR #11780: URL: https://github.com/apache/datafusion/pull/11780#discussion_r1702122361
########## datafusion/sql/src/expr/mod.rs: ########## @@ -714,6 +717,37 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { not_impl_err!("Unsupported dictionary literal: {raw_expr:?}") } + fn try_plan_map_literal( + &self, + entries: Vec<MapEntry>, + schema: &DFSchema, + planner_context: &mut PlannerContext, + ) -> Result<Expr> { + let mut exprs = vec![]; + entries.into_iter().try_for_each(|entry| { + exprs.push(self.sql_expr_to_logical_expr( + *entry.key, + schema, + planner_context, + )?); + exprs.push(self.sql_expr_to_logical_expr( + *entry.value, + schema, + planner_context, + )?); + Ok::<_, DataFusionError>(()) + })?; Review Comment: Can we do something like this ? ```rust let mut exprs = entries.into_iter().flat_map(|entry| { let k = self.sql_expr_to_logical_expr( *entry.key, schema, planner_context, )?; let v = self.sql_expr_to_logical_expr( *entry.value, schema, planner_context, )?; vec![k,v] }).collect<>();; ``` Haven't tried it out just a pseudo code -- 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