Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5930

When sqlToRel is converted from in to join, condition '=' on both sides will have inconsistent data types.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      Wrong calculation result

      select *
      from dept
      where deptno in (
        select count(*)
        from emp
        where comm is null);
      +--------+------------+----------+
      | DEPTNO |   DNAME    |   LOC    |
      +--------+------------+----------+
      +--------+------------+----------+ 

      Correct calculation results

      select *
      from dept
      where cast(deptno as bigint) in (
        select count(*)
        from emp
        where comm is null); 
      
      +--------+------------+----------+
      | DEPTNO | DNAME      | LOC      |
      +--------+------------+----------+
      |     10 | ACCOUNTING | NEW YORK |
      +--------+------------+----------+

      The above two cases can be reproduced in agg.iq.

      Or look at this submission https://github.com/apache/calcite/commit/6cef259f29884fbda3f165d579232285998d1b46.

       
       
       
       
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              leepb libopeng
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: