kczimm opened a new issue, #15863:
URL: https://github.com/apache/datafusion/issues/15863

   ### Describe the bug
   
   Placeholders datatypes in `IN` lists are not inferred:
   
   Example:
   ```sql
   SELECT * FROM employees WHERE department_id IN ($1, $2, $3);
   ```
   
   ### To Reproduce
   
   ```rust
   let column = col("department_id");
   let param_placeholders = vec![
       Expr::Placeholder(Placeholder {
           id: "$1".to_string(),
           data_type: None,
       }),
       Expr::Placeholder(Placeholder {
           id: "$2".to_string(),
           data_type: None,
       }),
       Expr::Placeholder(Placeholder {
           id: "$3".to_string(),
           data_type: None,
       }),
   ];
   let in_list = Expr::InList(InList {
       expr: Box::new(column),
       list: param_placeholders,
       negated: false,
   });
   
   let schema = Arc::new(Schema::new(vec![
       Field::new("name", DataType::Utf8, true),
       Field::new("department_id", DataType::Int32, true),
   ]));
   let df_schema = DFSchema::try_from(schema).unwrap();
   
   let (inferred_expr, contains_placeholder) =
       in_list.infer_placeholder_types(&df_schema).unwrap();
   ```
   
   `inferred_expr` has `Placeholder` with `data_type = None`.
   
   ### Expected behavior
   
   `Placeholder` should have `data_type = Int32`
   
   ### Additional context
   
   _No response_


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