You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2024/10/24 00:38:00 UTC

[jira] [Created] (CALCITE-6641) Compiling programs with ASOF joins can report obscure errors

Mihai Budiu created CALCITE-6641:
------------------------------------

             Summary: 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


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)