You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "xiedeyantu (via GitHub)" <gi...@apache.org> on 2025/05/10 10:41:17 UTC
[PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
xiedeyantu opened a new pull request, #4368:
URL: https://github.com/apache/calcite/pull/4368
JIRA link: [CALCITE-7006](https://issues.apache.org/jira/browse/CALCITE-7006)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu closed pull request #4368: [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan
URL: https://github.com/apache/calcite/pull/4368
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2868746576
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4368) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4368&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4368&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4368&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4368&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4368&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4368)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2868960898
> I will merge this once CI passes; it's a serious bug. Surprising it wasn't found earlier.
Please wait for me to squish these commits. The reason is that previously it was `is not distinct from` and could not match null values. After implementing `IsNotDistinctitFromImplementer,` the `equal` method was not implemented correctly, which led to this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4368:
URL: https://github.com/apache/calcite/pull/4368#discussion_r2083218082
##########
core/src/test/resources/sql/join.iq:
##########
@@ -854,4 +854,154 @@ EnumerableCalc(expr#0..1=[{inputs}], A=[$t0])
EnumerableValues(tuples=[[{ 1 }, { null }]])
!plan
+# Test for Double
+SELECT t1.a
Review Comment:
the test for DECIMAL was good too, but it's also covered by the ARRAY tests below
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on code in PR #4368:
URL: https://github.com/apache/calcite/pull/4368#discussion_r2083214395
##########
core/src/test/resources/sql/join.iq:
##########
@@ -854,4 +854,154 @@ EnumerableCalc(expr#0..1=[{inputs}], A=[$t0])
EnumerableValues(tuples=[[{ 1 }, { null }]])
!plan
+# Test for Double
+SELECT t1.a
+FROM (VALUES (1.0), (2.0), (null)) AS t1(a)
+JOIN (VALUES (1.0), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++-----+
+| A |
++-----+
+| 1.0 |
+| |
++-----+
+(2 rows)
+
+!ok
+
+# Test for Int
+SELECT t1.a
+FROM (VALUES (1), (2), (null)) AS t1(a)
+JOIN (VALUES (1), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---+
+| A |
++---+
+| 1 |
+| |
++---+
+(2 rows)
+
+!ok
+
+# Test for Varchar/Char
+SELECT t1.a
+FROM (VALUES ('x'), ('y'), (null)) AS t1(a)
+JOIN (VALUES ('x'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---+
+| A |
++---+
+| x |
+| |
++---+
+(2 rows)
+
+!ok
+
+# Test for Boolean
+SELECT t1.a
+FROM (VALUES (true), (false), (null)) AS t1(a)
+JOIN (VALUES (true), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++------+
+| A |
++------+
+| true |
+| |
++------+
+(2 rows)
+
+!ok
+
+# Test for Date
+SELECT t1.a
+FROM (VALUES (DATE '2025-05-10'), (DATE '2025-05-11'), (null)) AS t1(a)
+JOIN (VALUES (DATE '2025-05-10'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++------------+
+| A |
++------------+
+| 2025-05-10 |
+| |
++------------+
+(2 rows)
+
+!ok
+
+# Test for TimesStamp
+SELECT t1.a
+FROM (VALUES (TIMESTAMP '2025-05-10 10:22:34'), (TIMESTAMP '2025-05-11 10:22:34'), (null)) AS t1(a)
+JOIN (VALUES (TIMESTAMP '2025-05-10 10:22:34'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---------------------+
+| A |
++---------------------+
+| 2025-05-10 10:22:34 |
+| |
++---------------------+
+(2 rows)
+
+!ok
+
+# Test for Decimal
Review Comment:
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu merged PR #4368:
URL: https://github.com/apache/calcite/pull/4368
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2869004041
@mihaibudiu The continuous-integration CI failure seems to have nothing to do with this PR. If necessary, I can trigger CI again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2869176302
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4368) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4368&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4368&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4368&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4368&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4368&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4368)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2868958845
I will merge this once CI passes; it's a serious bug. Surprising it wasn't found earlier.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4368:
URL: https://github.com/apache/calcite/pull/4368#discussion_r2083212651
##########
core/src/test/resources/sql/join.iq:
##########
@@ -854,4 +854,154 @@ EnumerableCalc(expr#0..1=[{inputs}], A=[$t0])
EnumerableValues(tuples=[[{ 1 }, { null }]])
!plan
+# Test for Double
+SELECT t1.a
Review Comment:
the test is good, but add a DOUBLE test too
In general, joining on double is tricky, but for this case it should work fine
##########
core/src/test/resources/sql/join.iq:
##########
@@ -854,4 +854,154 @@ EnumerableCalc(expr#0..1=[{inputs}], A=[$t0])
EnumerableValues(tuples=[[{ 1 }, { null }]])
!plan
+# Test for Double
+SELECT t1.a
+FROM (VALUES (1.0), (2.0), (null)) AS t1(a)
+JOIN (VALUES (1.0), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++-----+
+| A |
++-----+
+| 1.0 |
+| |
++-----+
+(2 rows)
+
+!ok
+
+# Test for Int
+SELECT t1.a
+FROM (VALUES (1), (2), (null)) AS t1(a)
+JOIN (VALUES (1), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---+
+| A |
++---+
+| 1 |
+| |
++---+
+(2 rows)
+
+!ok
+
+# Test for Varchar/Char
+SELECT t1.a
+FROM (VALUES ('x'), ('y'), (null)) AS t1(a)
+JOIN (VALUES ('x'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---+
+| A |
++---+
+| x |
+| |
++---+
+(2 rows)
+
+!ok
+
+# Test for Boolean
+SELECT t1.a
+FROM (VALUES (true), (false), (null)) AS t1(a)
+JOIN (VALUES (true), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++------+
+| A |
++------+
+| true |
+| |
++------+
+(2 rows)
+
+!ok
+
+# Test for Date
+SELECT t1.a
+FROM (VALUES (DATE '2025-05-10'), (DATE '2025-05-11'), (null)) AS t1(a)
+JOIN (VALUES (DATE '2025-05-10'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++------------+
+| A |
++------------+
+| 2025-05-10 |
+| |
++------------+
+(2 rows)
+
+!ok
+
+# Test for TimesStamp
Review Comment:
typo
##########
core/src/test/resources/sql/join.iq:
##########
@@ -854,4 +854,154 @@ EnumerableCalc(expr#0..1=[{inputs}], A=[$t0])
EnumerableValues(tuples=[[{ 1 }, { null }]])
!plan
+# Test for Double
+SELECT t1.a
Review Comment:
I think these are DECIMAL.
For DOUBLE you have to write 1.0e0
##########
core/src/test/resources/sql/join.iq:
##########
@@ -854,4 +854,154 @@ EnumerableCalc(expr#0..1=[{inputs}], A=[$t0])
EnumerableValues(tuples=[[{ 1 }, { null }]])
!plan
+# Test for Double
+SELECT t1.a
+FROM (VALUES (1.0), (2.0), (null)) AS t1(a)
+JOIN (VALUES (1.0), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++-----+
+| A |
++-----+
+| 1.0 |
+| |
++-----+
+(2 rows)
+
+!ok
+
+# Test for Int
+SELECT t1.a
+FROM (VALUES (1), (2), (null)) AS t1(a)
+JOIN (VALUES (1), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---+
+| A |
++---+
+| 1 |
+| |
++---+
+(2 rows)
+
+!ok
+
+# Test for Varchar/Char
+SELECT t1.a
+FROM (VALUES ('x'), ('y'), (null)) AS t1(a)
+JOIN (VALUES ('x'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---+
+| A |
++---+
+| x |
+| |
++---+
+(2 rows)
+
+!ok
+
+# Test for Boolean
+SELECT t1.a
+FROM (VALUES (true), (false), (null)) AS t1(a)
+JOIN (VALUES (true), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++------+
+| A |
++------+
+| true |
+| |
++------+
+(2 rows)
+
+!ok
+
+# Test for Date
+SELECT t1.a
+FROM (VALUES (DATE '2025-05-10'), (DATE '2025-05-11'), (null)) AS t1(a)
+JOIN (VALUES (DATE '2025-05-10'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++------------+
+| A |
++------------+
+| 2025-05-10 |
+| |
++------------+
+(2 rows)
+
+!ok
+
+# Test for TimesStamp
+SELECT t1.a
+FROM (VALUES (TIMESTAMP '2025-05-10 10:22:34'), (TIMESTAMP '2025-05-11 10:22:34'), (null)) AS t1(a)
+JOIN (VALUES (TIMESTAMP '2025-05-10 10:22:34'), (null)) AS t2(a)
+ON t1.a IS NOT DISTINCT FROM t2.a;
++---------------------+
+| A |
++---------------------+
+| 2025-05-10 10:22:34 |
+| |
++---------------------+
+(2 rows)
+
+!ok
+
+# Test for Decimal
Review Comment:
were these tests failing previously?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2868962597
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4368) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4368&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4368&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4368&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4368&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4368&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4368)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-7006] Incorrect left join results with IS NOT DISTINCT FROM under specific plan [calcite]
Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on PR #4368:
URL: https://github.com/apache/calcite/pull/4368#issuecomment-2868958279
@mihaibudiu I have fixed the comment above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org