Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-15585

Calcite. Unexpected result with EXIST and subquery.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • sql

    Description

      statement ok
      CREATE TABLE integers(i INTEGER)
      
      statement ok
      INSERT INTO integers VALUES (1), (2), (3), (NULL)
      
      query IT
      SELECT i, EXISTS(SELECT i FROM integers WHERE i=i1.i) FROM integers i1 ORDER BY i NULLS FIRST;
      ----
      NULL	false
      1	true
      2	true
      3	true
      
      /subquery/exists/test_correlated_exists.test[_ignore]
      
      statement ok
      CREATE TABLE integers(i INTEGER)
      
      statement ok
      INSERT INTO integers VALUES (1), (2), (3), (NULL)
      
      # SUM on exists
      query R
      SELECT SUM(CASE WHEN EXISTS(SELECT i FROM integers WHERE i=i1.i) THEN 1 ELSE 0 END) FROM integers i1;
      ----
      3.000000
      

      checked with mysql, all ok there.

      Attachments

        Issue Links

          Activity

            People

              ivandasch Ivan Daschinsky
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m