waynexia opened a new issue, #6696:
URL: https://github.com/apache/arrow-datafusion/issues/6696

   ### Is your feature request related to a problem or challenge?
   
   The place parses literal to `ScalarValue` doesn't care about the target data 
type. This may require somebody to cast the parsed `ScalarValue` to expected 
data type
   
   
https://github.com/apache/arrow-datafusion/blob/c2b260620718f1f6e67fdb32af87c3b3551bc0f0/datafusion/sql/src/expr/value.rs#L30
   
   ### Describe the solution you'd like
   
   Add a method to `ScalarValue` like:
   
   ```rust
   fn cast(&self, data_type: &DataType, force: bool) -> Option<ScalarValue>;
   ```
   
   The third parameter `force` is a switch to whether perform force cast like 
cast integer to float or string to number. Without `force` this method only 
perform lossless cast (i.e., only cast to bigger type)
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to