forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fbc7a8
commit 3e02028
Showing
9 changed files
with
187 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQQuidemTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.druid.msq.exec; | ||
|
||
import org.apache.druid.common.config.NullHandling; | ||
import org.apache.druid.quidem.DruidQuidemTestBase; | ||
import org.apache.druid.quidem.ProjectPathUtils; | ||
import org.junit.jupiter.api.condition.EnabledIf; | ||
|
||
import java.io.File; | ||
|
||
@EnabledIf(value = "enabled", disabledReason = "These tests are only run in SqlCompatible mode!") | ||
public class MSQQuidemTest extends DruidQuidemTestBase | ||
{ | ||
public static boolean enabled() | ||
{ | ||
NullHandling.initializeForTests(); | ||
return NullHandling.sqlCompatible(); | ||
} | ||
|
||
public MSQQuidemTest() | ||
{ | ||
super(); | ||
} | ||
|
||
@Override | ||
protected File getTestRoot() | ||
{ | ||
return ProjectPathUtils.getPathFromProjectRoot("extensions-core/multi-stage-query/src/test/quidem/" + getClass().getName()); | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
...re/multi-stage-query/src/test/quidem/org.apache.druid.msq.exec.MSQQuidemTest/decoupled.iq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
!set plannerStrategy DECOUPLED | ||
!use druidtest://?componentSupplier=DrillWindowQueryMSQComponentSupplier | ||
!set outputformat mysql | ||
|
||
select cityName, count(case when delta > 0 then channel end) as cnt, count(1) as aall | ||
from wikipedia | ||
where cityName in ('New York', 'Aarhus') | ||
group by 1 | ||
order by 1; | ||
+----------+-----+------+ | ||
| cityName | cnt | aall | | ||
+----------+-----+------+ | ||
| Aarhus | 0 | 1 | | ||
| New York | 7 | 13 | | ||
+----------+-----+------+ | ||
(2 rows) | ||
|
||
!ok | ||
LogicalSort(sort0=[$0], dir0=[ASC]) | ||
LogicalAggregate(group=[{0}], cnt=[COUNT($1)], aall=[COUNT()]) | ||
LogicalProject(cityName=[$2], $f1=[CASE(>($17, 0), $1, null:VARCHAR)]) | ||
LogicalFilter(condition=[OR(=($2, 'New York'), =($2, 'Aarhus'))]) | ||
LogicalTableScan(table=[[druid, wikipedia]]) | ||
|
||
!convertedPlan | ||
LogicalSort(sort0=[$0], dir0=[ASC]) | ||
LogicalAggregate(group=[{0}], cnt=[COUNT($1) FILTER $2], aall=[COUNT()]) | ||
LogicalProject(cityName=[$2], channel=[$1], $f3=[IS TRUE(>($17, 0))]) | ||
LogicalFilter(condition=[SEARCH($2, Sarg['Aarhus':VARCHAR(8), 'New York':VARCHAR(8)]:VARCHAR(8))]) | ||
LogicalTableScan(table=[[druid, wikipedia]]) | ||
|
||
!logicalPlan | ||
DruidAggregate(group=[{0}], cnt=[COUNT($1) FILTER $2], aall=[COUNT()], druid=[logical]) | ||
DruidProject(cityName=[$2], channel=[$1], $f3=[IS TRUE(>($17, 0))], druid=[logical]) | ||
DruidFilter(condition=[SEARCH($2, Sarg['Aarhus':VARCHAR(8), 'New York':VARCHAR(8)]:VARCHAR(8))]) | ||
DruidTableScan(table=[[druid, wikipedia]], druid=[logical]) | ||
|
||
!druidPlan | ||
{ | ||
"queryType" : "groupBy", | ||
"dataSource" : { | ||
"type" : "table", | ||
"name" : "wikipedia" | ||
}, | ||
"intervals" : { | ||
"type" : "intervals", | ||
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] | ||
}, | ||
"filter" : { | ||
"type" : "inType", | ||
"column" : "cityName", | ||
"matchValueType" : "STRING", | ||
"sortedValues" : [ "Aarhus", "New York" ] | ||
}, | ||
"granularity" : { | ||
"type" : "all" | ||
}, | ||
"dimensions" : [ { | ||
"type" : "default", | ||
"dimension" : "cityName", | ||
"outputName" : "d0", | ||
"outputType" : "STRING" | ||
} ], | ||
"aggregations" : [ { | ||
"type" : "filtered", | ||
"aggregator" : { | ||
"type" : "count", | ||
"name" : "a0" | ||
}, | ||
"filter" : { | ||
"type" : "and", | ||
"fields" : [ { | ||
"type" : "not", | ||
"field" : { | ||
"type" : "null", | ||
"column" : "channel" | ||
} | ||
}, { | ||
"type" : "range", | ||
"column" : "delta", | ||
"matchValueType" : "LONG", | ||
"lower" : 0, | ||
"lowerOpen" : true | ||
} ] | ||
}, | ||
"name" : "a0" | ||
}, { | ||
"type" : "count", | ||
"name" : "a1" | ||
} ], | ||
"limitSpec" : { | ||
"type" : "NoopLimitSpec" | ||
} | ||
} | ||
!nativePlan | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters