Zhen Chen created CALCITE-7389:
----------------------------------

             Summary: PruneJoinSingleValue rule causes type mismatch in EXISTS 
                 Key: CALCITE-7389
                 URL: https://issues.apache.org/jira/browse/CALCITE-7389
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Zhen Chen


Using CoreQuidemTest2 to test the following SQL will result in an error.

 
{code:java}
!use scott
select count(*) as c from "scott".dept where exists (select 1);
+---+
| C |
+---+
| 4 |
+---+
(1 row)

!ok {code}
Error message:

 

> Caused by: java.lang.RuntimeException: Error occurred while applying rule 
> PruneJoinSingleValue(right)
>     at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:157)
>     at 
> org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:273)
>     at 
> org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:288)
>     at 
> org.apache.calcite.rel.rules.SingleValuesOptimizationRules$PruneSingleValueRule.onMatch(SingleValuesOptimizationRules.java:275)
>     at 
> org.apache.calcite.rel.rules.SingleValuesOptimizationRules$JoinRightSingleRuleConfig$1.onMatch(SingleValuesOptimizationRules.java:318)
>     at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:223)
>     ... 24 more
> Caused by: java.lang.IllegalArgumentException: Type mismatch: the field sizes 
> are not equal.
> rel rowtype: RecordType(TINYINT NOT NULL DEPTNO, INTEGER NOT NULL $f1) NOT 
> NULL
> equiv rowtype: RecordType(TINYINT NOT NULL DEPTNO) NOT NULL
>     at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:594)
>     at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:615)
>     at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:144)



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

Reply via email to