brayanjuls commented on code in PR #15743:
URL: https://github.com/apache/datafusion/pull/15743#discussion_r2080599583


##########
datafusion/sql/src/statement.rs:
##########
@@ -710,6 +710,25 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                     *statement,
                     &mut planner_context,
                 )?;
+
+                //Get inferred data_types from the plan if it is empty in the 
prepare statement
+                let data_types = match data_types.is_empty() {
+                    true => {
+                        let mut data_types: Vec<DataType> = plan
+                            .get_parameter_types()?
+                            .iter()
+                            .filter_map(|d| match d {
+                                (_, Some(v)) => Some(v.clone()),
+                                _ => None,
+                            })
+                            .collect::<Vec<DataType>>();
+                        data_types.sort();
+                        
planner_context.with_prepare_param_data_types(data_types.clone());
+                        data_types
+                    }
+                    false => data_types,
+                };
+

Review Comment:
   thanks for the feedback I really appreciate it, I will create a new issue 
and move the statement changes to a different PR. I will only put back the 
original function names and include the `PREPARE` clause in this PR. 



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