mbutrovich commented on code in PR #1756: URL: https://github.com/apache/datafusion-comet/pull/1756#discussion_r2098980947
########## native/core/src/execution/planner.rs: ########## @@ -1108,6 +1108,44 @@ impl PhysicalPlanner { .map(|expr| self.create_expr(expr, Arc::clone(&required_schema))) .collect(); + let default_values: Option<HashMap<usize, ScalarValue>> = if !scan + .default_values + .is_empty() + { + // We have default values. Extract the two lists (same length) of values and + // indexes in the schema, and then create a HashMap to use in the SchemaMapper. + let default_values: Vec<ScalarValue> = scan + .default_values + .iter() + .map(|expr| { + let literal = self + .create_expr(expr, Arc::clone(&required_schema)) + .unwrap(); + literal + .as_any() + .downcast_ref::<DataFusionLiteral>() + .ok_or_else(|| { + GeneralError("Expected literal of default value.".to_string()) + }) + .map(|literal| literal.value().clone()) + .unwrap() + }) + .collect::<Vec<ScalarValue>>(); Review Comment: Looks good, thank you for the suggestion! -- 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