alamb commented on code in PR #5814:
URL: https://github.com/apache/arrow-datafusion/pull/5814#discussion_r1154805330
##########
datafusion/sql/src/relation/mod.rs:
##########
@@ -33,7 +33,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
// normalize name and alias
let table_ref = self.object_name_to_table_reference(name)?;
let table_name = table_ref.to_string();
- let cte = planner_context.ctes.get(&table_name);
+ let cte = planner_context.get_cte(&table_name);
Review Comment:
this is the use of `cte`s -- and 4 lines below it is immediately `clone()`d
##########
datafusion/sql/src/planner.rs:
##########
@@ -100,15 +102,52 @@ impl PlannerContext {
}
}
- /// Create a new PlannerContext with provided prepare_param_data_types
- pub fn new_with_prepare_param_data_types(
+ /// Update the PlannerContext with provided prepare_param_data_types
+ pub fn with_prepare_param_data_types(
+ mut self,
prepare_param_data_types: Vec<DataType>,
) -> Self {
- Self {
- prepare_param_data_types,
- ctes: HashMap::new(),
- outer_query_schema: None,
- }
+ self.prepare_param_data_types = prepare_param_data_types;
+ self
+ }
+
+ // return a reference to the outer queries schema
+ pub fn outer_query_schema(&self) -> Option<&DFSchema> {
+ self.outer_query_schema.as_ref()
+ }
+
+ /// sets the outer query schema, returning the existing one, if
Review Comment:
I think having accessors also is a good place to put documentation about
what they do
--
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]