You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "waynexia (via GitHub)" <gi...@apache.org> on 2023/06/16 07:02:35 UTC
[GitHub] [arrow-datafusion] waynexia opened a new issue, #6696: add `cast()` to `ScalarValue`
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: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] add `cast()` to `ScalarValue` [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on issue #6696:
URL: https://github.com/apache/datafusion/issues/6696#issuecomment-3585954530
See #9001 and #13122
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] add `cast()` to `ScalarValue` [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #6696: add `cast()` to `ScalarValue`
URL: https://github.com/apache/datafusion/issues/6696
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org