update exceptions;test output

This commit is contained in:
Zoltan Haindrich 2024-05-17 07:12:12 +00:00
parent 652cc20597
commit 453c11f9f5
7 changed files with 22 additions and 13 deletions

View File

@ -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;
@ -431,6 +431,11 @@ public class PlannerConfig
}
}
/**
* 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<>();
@ -450,7 +455,11 @@ public class PlannerConfig
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;
}

View File

@ -389,10 +389,10 @@ public class SqlTestFrameworkConfig
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!");

View File

@ -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
@ -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;

View File

@ -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
@ -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;

View File

@ -30,8 +30,8 @@ SELECT
+-------+----+
| t1 | t2 |
+-------+----+
| dummy | |
| dummy | b |
| dummy | |
+-------+----+
(2 rows)

View File

@ -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
@ -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

View File

@ -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
@ -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