Lordworms commented on PR #10746:
URL: https://github.com/apache/datafusion/pull/10746#issuecomment-2143625294
> I guess I should have added more examples in #10743. So I would argue that
it would be better if the following expressions produced equivalent results:
>
> 1. SELECT '12345'::VARCHAR(2)
> 2. SELECT s::VARCHAR(2) FROM (VALUES ('12345')) t(s)
> 3. SELECT s::VARCHAR(2) FROM vals
>
> But this PR only addresses the first case.
Currently, I think it is tricky to do 2 and 3 since Datafusion would
transform the ast::DataType into arrow::DataType in function
sql_expr_to_logical_expr_internal, however, instead of directing knowing the
string in 1, 2, and 3 would generate a different AST tree like
<img width="976" alt="image"
src="https://github.com/apache/datafusion/assets/48054792/a25e00a5-c295-4e4d-9d71-2fce96e443ce">
if we want to do the validation on 2 and 3, we need to keep the information
of ast::DataType::Varchar(Some(IntegerLength { length, .. })), but I don't know
whether it is a need currently.
--
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]