You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by tj...@apache.org on 2024/07/18 04:38:26 UTC

(calcite) branch calcite-6452 created (now e4a5c1036d)

This is an automated email from the ASF dual-hosted git repository.

tjbanghart pushed a change to branch calcite-6452
in repository https://gitbox.apache.org/repos/asf/calcite.git


      at e4a5c1036d Test case for [CALCITE-6452] Scalar sub-query that uses IS NOT DISTINCT FROM returns incorrect result

This branch includes the following new commits:

     new e4a5c1036d Test case for [CALCITE-6452] Scalar sub-query that uses IS NOT DISTINCT FROM returns incorrect result

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(calcite) 01/01: Test case for [CALCITE-6452] Scalar sub-query that uses IS NOT DISTINCT FROM returns incorrect result

Posted by tj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tjbanghart pushed a commit to branch calcite-6452
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit e4a5c1036dfb0a95b71683f2d41bf1cc56330f32
Author: TJ Banghart <tj...@gmail.com>
AuthorDate: Wed Jul 17 21:37:51 2024 -0700

    Test case for [CALCITE-6452] Scalar sub-query that uses IS NOT DISTINCT FROM returns incorrect result
---
 core/src/test/resources/sql/scalar.iq | 67 +++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/core/src/test/resources/sql/scalar.iq b/core/src/test/resources/sql/scalar.iq
index 365c90e4af..447dc4f6f9 100644
--- a/core/src/test/resources/sql/scalar.iq
+++ b/core/src/test/resources/sql/scalar.iq
@@ -239,4 +239,71 @@ select deptno, (select empno from "scott".emp order by empno limit 1) as x from
 
 !ok
 
+# Scalar subquery that joins on nullable column
+select e.ename,
+  (select count(*)
+    from emp as f
+    where f.comm is not distinct from e.comm) as c
+from emp as e;
++--------+----+
+| ENAME  | C  |
++--------+----+
+| ADAMS  |  0 |
+| ALLEN  | 10 |
+| BLAKE  |  0 |
+| CLARK  |  0 |
+| FORD   |  0 |
+| JAMES  |  0 |
+| JONES  |  0 |
+| KING   |  0 |
+| MARTIN | 10 |
+| MILLER |  0 |
+| SCOTT  |  0 |
+| SMITH  |  0 |
+| TURNER | 10 |
+| WARD   | 10 |
++--------+----+
+(14 rows)
+
+!ok
+
+# As above, with WHERE
+select e.ename,
+  (select count(*)
+    from emp as f
+    where f.comm is not distinct from e.comm) as c
+from emp as e
+where e.deptno = 10;
++--------+----+
+| ENAME  | C  |
++--------+----+
+| CLARK  |  0 |
+| KING   |  0 |
+| MILLER |  0 |
+| SCOTT  |  0 |
+| SMITH  |  0 |
+| TURNER | 10 |
+| WARD   | 10 |
++--------+----+
+(14 rows)
+
+!ok
+
+# Justification for previous result
+select comm, count(*) as c
+from emp
+group by comm;
++---------+----+
+| COMM    | C  |
++---------+----+
+|    0.00 |  1 |
+| 1400.00 |  1 |
+|  300.00 |  1 |
+|  500.00 |  1 |
+|         | 10 |
++---------+----+
+(5 rows)
+
+!ok
+
 # End scalar.iq