[ 
https://issues.apache.org/jira/browse/CALCITE-6401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ulrich Kramer updated CALCITE-6401:
-----------------------------------
    Description: 
JDBC adapter (in JdbcJoinRule) cannot push down joins with conditions which 
include operations not listed in {{JdbcJoinRule::canJoinOnCondition}}. 

See also CALCITE-4907

For example the following statement is executed using an 
{{EnumerableNestedLoopJoin}}

{code:SQL}
SELECT
  *
FROM
   A
  JOIN (
    SELECT
      D."userId",
      MAX(D."id") as "id"
    FROM
       D
    GROUP BY
      D."userId"
  ) B ON (
     A."id"  = B."id" AND A."userId" IS NOT NULL
  )
  OR (
    A."userId"  = B."userId" AND A."id" IS NOT NULL
  )
{code}

Adding the cases {{IS_NULL}} and {{IS_NOT_NULL}} to 
{{JdbcJoinRule::canJoinOnCondition}} fixes the problem for this statement. But 
I was not able to find out which cases are also missing here. E.g. a join 
condition which compares a RexInputRef with a RexLiteral also fails.

Where could I find the associated code in {{JdbcJoin::implement}} that makes it 
impossible to create an appropriate SQL statement if all operations were 
allowed?

  was:
JDBC adapter (in JdbcJoinRule) cannot push down joins with conditions which 
include operations not listed in {{JdbcJoinRule::canJoinOnCondition}}. 

See also CALCITE-4907

For example the following statement is executed using an 
{{EnumerableNestedLoopJoin}}

{code:SQL}
SELECT
  *
FROM
   A
  JOIN (
    SELECT
      D."userId",
      MAX(D."id") as "id"
    FROM
       D
    GROUP BY
      D."userId"
  ) B ON (
     A."id"  = B."id" AND A."userId" IS NOT NULL
  )
  OR (
    A."userId"  = B."userId" AND A."id" IS NOT NULL
  )
{code}

Adding the cases {{IS_NULL}} and {{IS_NOT_NULL}} to 
{{JdbcJoinRule::canJoinOnCondition}} fixes the problem for this statement. But 
I was not able to find out which cases are also missing here. 

Where could I find the associated code in {{JdbcJoin::implement}} that makes it 
impossible to create an appropriate SQL statement if all operations were 
allowed?


> JDBC adapter cannot push down joins with complex JOIN condition
> ---------------------------------------------------------------
>
>                 Key: CALCITE-6401
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6401
>             Project: Calcite
>          Issue Type: Improvement
>    Affects Versions: 1.36.0
>            Reporter: Ulrich Kramer
>            Priority: Major
>
> JDBC adapter (in JdbcJoinRule) cannot push down joins with conditions which 
> include operations not listed in {{JdbcJoinRule::canJoinOnCondition}}. 
> See also CALCITE-4907
> For example the following statement is executed using an 
> {{EnumerableNestedLoopJoin}}
> {code:SQL}
> SELECT
>   *
> FROM
>    A
>   JOIN (
>     SELECT
>       D."userId",
>       MAX(D."id") as "id"
>     FROM
>        D
>     GROUP BY
>       D."userId"
>   ) B ON (
>      A."id"  = B."id" AND A."userId" IS NOT NULL
>   )
>   OR (
>     A."userId"  = B."userId" AND A."id" IS NOT NULL
>   )
> {code}
> Adding the cases {{IS_NULL}} and {{IS_NOT_NULL}} to 
> {{JdbcJoinRule::canJoinOnCondition}} fixes the problem for this statement. 
> But I was not able to find out which cases are also missing here. E.g. a join 
> condition which compares a RexInputRef with a RexLiteral also fails.
> Where could I find the associated code in {{JdbcJoin::implement}} that makes 
> it impossible to create an appropriate SQL statement if all operations were 
> allowed?



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

Reply via email to