jayzhan211 commented on PR #12853:
URL: https://github.com/apache/datafusion/pull/12853#issuecomment-2436897770
@notfilippo I think we need a way to know the physical types that we are
able to casted to given the Logical type.
For example, if we have signature which expect Logical::String, and it
accepts not only Utf8, LargeUtf8, Utf8View string family but also numeric int,
we need to cast the int to string so we need to know the _physical types_ given
a logical type. We don't know which DataType we should cast to if we only know
there is LogicalType::String
Therefore, I think we need to add another function that returns the physical
types for LogicalType. Note that the order matters if we would like the cast to
Utf8View, LargeUtf8 and then Utf8 in order.
Something like
```rust
fn decode_types(&self) -> Vec<DataType> {
vec![DataType::Utf8View, DataType::LargeUtf8, DataType::Utf8]
}
```
```
postgres=# select concat('string', 123);
concat
-----------
string123
(1 row)
```
is one of the example in postgres that cast a non-string to the stirng
What do you think?
--
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]