MCPcopy Create free account
hub / github.com/apache/datafusion / try_plan_map_literal

Method try_plan_map_literal

datafusion/sql/src/expr/mod.rs:788–808  ·  view source on GitHub ↗
(
        &self,
        entries: Vec<MapEntry>,
        schema: &DFSchema,
        planner_context: &mut PlannerContext,
    )

Source from the content-addressed store, hash-verified

786 }
787
788 fn try_plan_map_literal(
789 &self,
790 entries: Vec<MapEntry>,
791 schema: &DFSchema,
792 planner_context: &mut PlannerContext,
793 ) -> Result<Expr> {
794 let mut exprs: Vec<_> = entries
795 .into_iter()
796 .flat_map(|entry| vec![entry.key, entry.value].into_iter())
797 .map(|expr| self.sql_expr_to_logical_expr(*expr, schema, planner_context))
798 .collect::<Result<Vec<_>>>()?;
799 for planner in self.context_provider.get_expr_planners() {
800 match planner.plan_make_map(exprs)? {
801 PlannerResult::Planned(expr) => {
802 return Ok(expr);
803 }
804 PlannerResult::Original(expr) => exprs = expr,
805 }
806 }
807 not_impl_err!("MAP not supported by ExprPlanner: {exprs:?}")
808 }
809
810 // Handles a call to struct(...) where the arguments are named. For example
811 // `struct (v as foo, v2 as bar)` by creating a call to the `named_struct` function

Callers 1

Calls 5

mapMethod · 0.45
into_iterMethod · 0.45
get_expr_plannersMethod · 0.45
plan_make_mapMethod · 0.45

Tested by

no test coverage detected