neilconway commented on PR #20426: URL: https://github.com/apache/datafusion/pull/20426#issuecomment-3926891792
@AlonSpivack The challenge with rejecting `text_col < 5` under this approach is that in `comparison_coercion`, we've already lost the fact that we're comparing a column with a literal. All we see is a comparison between a string-typed value and a numeric-typed value, which this approach would allow. If we want to reject `text_col < 5` and similar expressions, I think we need to remove the `comparison_coercion` logic for coercing string -> numeric and the like. We'd then have two options: 1. Introduce an "unknown" type. All string literals would have unknown type, and then would be coerced into a concrete type depending on the context in which they are used. This is roughly what Postgres does. 2. Don't introduce a distinct type, but just add some (perhaps ad-hoc) rules for coercing binary expressions where exactly one operand is a string literal and the other operand is a numeric-typed column reference. (1) is probably more principled, but I think it's too big of a change to undertake on short notice. (2) sounds plausible to me at first blush, but it needs more consideration. -- 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]
