Ilya Korol created CALCITE-7766:
-----------------------------------

             Summary: Type-mismatch on nullability in 
JoinPushTransitivePredicatesRule for RIGHT join
                 Key: CALCITE-7766
                 URL: https://issues.apache.org/jira/browse/CALCITE-7766
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.42.0
            Reporter: Ilya Korol


CALCITE-5387 fixed the same failure for INNER and LEFT joins only, but for 
RIGHT joins issues is still there. For example the following query fails under 
assertions:

{code:sql}
WITH
non_null_table AS (
  SELECT DATE '2023-08-07' AS date_col_non_null FROM dept
),
null_table AS (
  SELECT CAST(null as DATE) AS date_col_null FROM dept
)
SELECT *
FROM null_table
RIGHT JOIN non_null_table
ON null_table.date_col_null = non_null_table.date_col_non_null
{code}

{noformat}
java.lang.AssertionError: type mismatch:
ref:
DATE NOT NULL
input:
DATE
      at 
org.apache.calcite.plan.RelOptUtil.eqUpToNullability(RelOptUtil.java:2279)
      at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:131)
      at org.apache.calcite.rel.core.Filter.isValid(Filter.java:165)
      at 
org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:141)
      at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1965)
      at 
org.apache.calcite.rel.rules.JoinPushTransitivePredicatesRule.onMatch(JoinPushTransitivePredicatesRule.java:88)
{noformat}



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

Reply via email to