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

   Given a prepare statement: `PREPARE my_plan AS SELECT id, age FROM person 
WHERE age BETWEEN $1 AND $2`
   
   The generated logical plan would look like this:

   ``` 
   Prepare: "my_plan" [] 
     Projection: person.id, person.age
       Filter: person.age BETWEEN $1 AND $2
         TableScan: person
   ```  
   
   As you can see from the previous plan we don’t include the datatypes in it, 
so when we try to replace the params with values to assert the replacement it 
will fail. 
   
   replace params with values:
   ```rust
       let param_values = vec![ScalarValue::Int32(Some(10)), 
ScalarValue::Int32(Some(30))];
       let plan_with_params = plan.with_param_values(param_values).unwrap(); // 
This execution will fail as the input param values and the data types are of 
different size
   
       assert_snapshot!(
           plan_with_params,
           @r"
       Projection: person.id, person.age
         Filter: person.age BETWEEN Int32(10) AND Int32(30)
           TableScan: person
       "
       );
   ```
   
   It is expected the datatypes to be included in the logicalplan by inferring 
them when they are not explicitly declared. The discussion around this happened 
in the following [PR](https://github.com/apache/datafusion/pull/15743).


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