dharanad commented on code in PR #11780:
URL: https://github.com/apache/datafusion/pull/11780#discussion_r1702164075
##########
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:
Like i mentioned that was just pseudo code (i should have called it a rough
idea). I was try to suggest something like this
```rust
let arr = (1..10).step_by(2).into_iter().flat_map(|e|
vec![e,e+1]).collect::<Vec<_>>();
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
If we can do something like this the expressions iter can be rearrage to
`[k1, v1, k2, v2, ... ]`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]