dharanad commented on code in PR #11780:
URL: https://github.com/apache/datafusion/pull/11780#discussion_r1702166038


##########
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:
   We can also do something like this (again this is a rough idea)
   
   ```rust
   
   let exprs: Result<Vec<_>, DataFusionError> = entries
       .into_iter()
       .flat_map(|entry| {
           vec![
               self.sql_expr_to_logical_expr(*entry.key, schema, 
planner_context),
               self.sql_expr_to_logical_expr(*entry.value, schema, 
planner_context),
           ]
       })
       .collect()?;
   ```



-- 
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

Reply via email to