cetra3 commented on issue #22506:
URL: https://github.com/apache/datafusion/issues/22506#issuecomment-4560871739

   The reason this fails with prepared statements is that this is failing in 
`get_parameter_fields` which tries to create a hashmap:
   
   
https://github.com/apache/datafusion/blob/3f501f4b9e6bf8616556fbf6c832da7e364680a4/datafusion/expr/src/logical_plan/plan.rs#L1622-L1654
   
   The "normal" code doesn't need to create a hashmap and so I think treats 
each param expr instance as separate.  I.e, you can have one be `Utf8` and one 
be `Utf8View`
   
   Claude had some code that would "widen" the type in the hash map with 
`type_union_resolution` but I don't know if that is the right approach here 
(maybe it is!):
   
   ```rust
   fn widen_parameter_field(prev: &FieldRef, new: &FieldRef) -> 
Option<FieldRef> {
       if !prev.metadata().is_empty() || !new.metadata().is_empty() {
           return None;
       }
       let common =
           type_union_resolution(&[prev.data_type().clone(), 
new.data_type().clone()])?;
       Some(Arc::new(Field::new(
           prev.name(),
           common,
           prev.is_nullable() || new.is_nullable(),
       )))
   
   ```
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to