[ 
https://issues.apache.org/jira/browse/CALCITE-6641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17892352#comment-17892352
 ] 

Mihai Budiu commented on CALCITE-6641:
--------------------------------------

The solution is to relax a bit the validator rules and to allow casts that 
involve columns from the two relations in the join conditions.

> Compiling programs with ASOF joins can report obscure errors
> ------------------------------------------------------------
>
>                 Key: CALCITE-6641
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6641
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.38.0
>            Reporter: Mihai Budiu
>            Assignee: Mihai Budiu
>            Priority: Minor
>
> A program like the following:
> {code:sql}
> SELECT * 
> FROM B
> LEFT ASOF JOIN S
> MATCH_CONDITION B.p_time >= S.date_time
> ON B.mod = S.key
> {code}
> can report an error such as:
> {code}
> Error in SQL statement: ASOF JOIN condition must be a conjunction of equality 
> comparisons
> ON B.mod = S.key;
>    ^^^^^^^^^^^^^
> {code}
> This looks like a conjunction of equality comparisons, so the error is very 
> strange; internally the program represents this expression as (CAST B.mod as 
> BIGINT) = S.key.
> This situation should be improved by either 
> - giving an error message that explains why the compiler does not like this 
> expression, or, better, 
> - having the ASOF join actually accept expressions that involve casts.
> This is yet another problem caused by the new TypeCoercion improvements. When 
> the ASOF join was merged there were no casts at this point in the validation. 
> As was discussed briefly in [CALCITE-6639], the ASOF joins look rather 
> brittle.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to