iwanttobepowerful commented on code in PR #5385:
URL: https://github.com/apache/calcite/pull/5385#discussion_r4454440716
##########
core/src/test/resources/sql/sub-query.iq:
##########
@@ -11242,3 +11246,78 @@ order by e.ename;
(14 rows)
!ok
+
+!if (use_old_decorr) {
+# Test case for [CALCITE-7914] Rebuilding correlation values must not resample
the outer input.
+select (select count(*) from (values 1) s(x) where t.k < s.x) as p
+from (select deptno as k from dept tablesample bernoulli(50)) t;
+EnumerableCalc(expr#0..1=[{inputs}], expr#2=[IS NULL($t1)], expr#3=[0:BIGINT],
expr#4=[CASE($t2, $t3, $t1)], P=[$t4])
+ EnumerableCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{0}])
+ EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t0):INTEGER NOT NULL],
expr#4=[RAND()], expr#5=[0.5:DECIMAL(2, 1)], expr#6=[<($t4, $t5)],
DEPTNO0=[$t3], $condition=[$t6])
+ EnumerableTableScan(table=[[scott, DEPT]])
+ EnumerableAggregate(group=[{}], EXPR$0=[COUNT()])
+ EnumerableCalc(expr#0=[{inputs}], expr#1=[$cor0], expr#2=[$t1.DEPTNO0],
expr#3=[1], expr#4=[<($t2, $t3)], X=[$t0], $condition=[$t4])
+ EnumerableValues(tuples=[[{ 1 }]])
+!plan
+
+# Test case for [CALCITE-7914] Outer rows with equal bindings must still
sample the inner input separately.
+select (select count(*) from dept tablesample bernoulli(50) where deptno >
t.k) as p
+from (values 1, 1, 2) t(k);
+EnumerableCalc(expr#0..1=[{inputs}], expr#2=[IS NULL($t1)], expr#3=[0:BIGINT],
expr#4=[CASE($t2, $t3, $t1)], P=[$t4])
+ EnumerableCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{0}])
Review Comment:
?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]