alamb commented on PR #15110:
URL: https://github.com/apache/datafusion/pull/15110#issuecomment-2715747690
> I don't believe manipulating casts after-the-fact is the right approach.
>
> Given the query select * from t1 where column1 < '10'; where column1 is an
Int32, the literal '10' should be treated as unknown, and the preference should
be to cast that. The generated predicate should then be column1 < cast('10' as
int), and whatever const folding happens will then take care of parsing '10' as
an int during planning.
I agree @scsmithr -- For the case in
https://github.com/apache/datafusion/issues/15161 I agree that changing the
coercion rules as you suggest is a better plan than trying to fix it up
afterwards
However, I think the optimization in this PR is valuable for cases when the
user has ended up with the casts some other way and DataFusion is now
optimizing the expression
> @findepi sorry I didn't notice your comment and I just pushed a new
version with the unwrapping logic deleted.
>
> So you think the two optimizations **should** coexist?
That is my understanding and also what I think should happen
> > And it looks feasible -- the plan in #15110 (comment) IMO should work
>
> But we have no way to tell if the cast is set by the user or not in the
unwrap cast function. Doesn't this matter?
I don't think the source of the cast matters (for this particular
optimization)
--
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]