Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable quidem shadowing for decoupled testcases #16431

Merged
merged 11 commits into from
May 23, 2024
Prev Previous commit
Next Next commit
update exceptions;test output
  • Loading branch information
kgyrtkirk committed May 17, 2024
commit 453c11f9f56d1a6c633cb19a3352f93dc88ac732
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.apache.druid.sql.calcite.planner;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.java.util.common.IAE;
import org.apache.druid.error.DruidException;
import org.apache.druid.java.util.common.UOE;
import org.apache.druid.query.QueryContexts;
import org.joda.time.DateTimeZone;
Expand Down Expand Up @@ -431,6 +431,11 @@ public PlannerConfig build()
}
}

/**
* Translates {@link PlannerConfig} settings into its equivalent QueryContext map.
*
* @throws DruidException if the translation is not possible.
*/
public Map<String, Object> getNonDefaultAsQueryContext()
{
Map<String, Object> overrides = new HashMap<>();
Expand All @@ -450,7 +455,11 @@ public Map<String, Object> getNonDefaultAsQueryContext()

PlannerConfig newConfig = PlannerConfig.builder().withOverrides(overrides).build();
if (!equals(newConfig)) {
throw new IAE("Some configs are not handled in this method or not persistable as QueryContext keys!\nold: %s\nnew: %s", this, newConfig);
throw DruidException.defensive(
"Not all PlannerConfig options are not persistable as QueryContext keys!\nold: %s\nnew: %s",
this,
newConfig
);
}
return overrides;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ private Map<String, String> getNonDefaultMap()
Map<String, String> map = new HashMap<>();
SqlTestFrameworkConfig def = new SqlTestFrameworkConfig(Collections.emptyList());
if (def.numMergeBuffers != numMergeBuffers) {
map.put("NumMergeBuffers", String.valueOf(numMergeBuffers));
map.put("numMergeBuffers", String.valueOf(numMergeBuffers));
}
if (def.minTopNThreshold != minTopNThreshold) {
map.put("MinTopNThreshold", String.valueOf(minTopNThreshold));
map.put("minTopNThreshold", String.valueOf(minTopNThreshold));
}
if (!equals(new SqlTestFrameworkConfig(map))) {
throw new IAE("Can't reproduce config via map!");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# testExactTopNOnInnerJoinWithLimit@NullHandling=default case-crc:d28d4632
# testExactTopNOnInnerJoinWithLimit@NullHandling=default case-crc:1b8b1878
# quidem testcase reason: EQUIV_PLAN
!set debug true
!set defaultTimeout 300000
Expand All @@ -8,7 +8,7 @@
!set sqlQueryId dummy
!set useApproximateTopN false
!set outputformat mysql
!use druidtest:///?MinTopNThreshold=1
!use druidtest:///?minTopNThreshold=1
select f1."dim4", sum("m1") from numfoo f1 inner join (
select "dim4" from numfoo where dim4 <> 'a' group by 1
) f2 on f1."dim4" = f2."dim4" group by 1 limit 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# testExactTopNOnInnerJoinWithLimit@NullHandling=sql case-crc:d28d4632
# testExactTopNOnInnerJoinWithLimit@NullHandling=sql case-crc:1b8b1878
# quidem testcase reason: EQUIV_PLAN
!set debug true
!set defaultTimeout 300000
Expand All @@ -8,7 +8,7 @@
!set sqlQueryId dummy
!set useApproximateTopN false
!set outputformat mysql
!use druidtest:///?MinTopNThreshold=1
!use druidtest:///?minTopNThreshold=1
select f1."dim4", sum("m1") from numfoo f1 inner join (
select "dim4" from numfoo where dim4 <> 'a' group by 1
) f2 on f1."dim4" = f2."dim4" group by 1 limit 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ SELECT
+-------+----+
| t1 | t2 |
+-------+----+
| dummy | |
| dummy | b |
| dummy | |
+-------+----+
(2 rows)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default case-crc:d6c371b5
# testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=default case-crc:5a66a3be
# quidem testcase reason: SLIGHTLY_WORSE_PLAN
!set debug true
!set defaultTimeout 300000
Expand All @@ -9,7 +9,7 @@
!set useApproximateCountDistinct false
!set useGroupingSetForExactDistinct true
!set outputformat mysql
!use druidtest:///?NumMergeBuffers=3
!use druidtest:///?numMergeBuffers=3
SELECT
(SUM(CASE WHEN (TIMESTAMP '2000-01-04 17:00:00'<=__time AND __time<TIMESTAMP '2022-01-05 17:00:00') THEN 1 ELSE 0 END)*1.0/COUNT(DISTINCT CASE WHEN (TIMESTAMP '2000-01-04 17:00:00'<=__time AND __time<TIMESTAMP '2022-01-05 17:00:00') THEN dim1 END))
FROM druid.foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql case-crc:d6c371b5
# testQueryWithSelectProjectAndIdentityProjectDoesNotRename@NullHandling=sql case-crc:5a66a3be
# quidem testcase reason: SLIGHTLY_WORSE_PLAN
!set debug true
!set defaultTimeout 300000
Expand All @@ -9,7 +9,7 @@
!set useApproximateCountDistinct false
!set useGroupingSetForExactDistinct true
!set outputformat mysql
!use druidtest:///?NumMergeBuffers=3
!use druidtest:///?numMergeBuffers=3
SELECT
(SUM(CASE WHEN (TIMESTAMP '2000-01-04 17:00:00'<=__time AND __time<TIMESTAMP '2022-01-05 17:00:00') THEN 1 ELSE 0 END)*1.0/COUNT(DISTINCT CASE WHEN (TIMESTAMP '2000-01-04 17:00:00'<=__time AND __time<TIMESTAMP '2022-01-05 17:00:00') THEN dim1 END))
FROM druid.foo
Expand Down
Loading