Skip to content

Commit ab19f98

Browse files
committed
[CALCITE-4278] Add Druid adapter tests in GitHub CI
Skip failing tests in Druid due to CALCITE-4279 Skip part of DruidAdapterIT#testAggSameColumnMultipleTimes due to CALCITE-4204 Close #2169
1 parent 539807b commit ab19f98

4 files changed

Lines changed: 90 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,43 @@ jobs:
129129
with:
130130
job-id: jdk8
131131
arguments: --scan --no-parallel --no-daemon testSlow
132+
linux-druid:
133+
if: github.event.action != 'labeled'
134+
name: 'Linux (JDK 8) Druid Tests'
135+
runs-on: ubuntu-latest
136+
steps:
137+
- name: 'Set up JDK 8'
138+
uses: actions/setup-java@v1
139+
with:
140+
java-version: 8
141+
- name: 'Checkout Druid dataset'
142+
uses: actions/checkout@master
143+
with:
144+
repository: zabetak/calcite-druid-dataset
145+
fetch-depth: 1
146+
path: druid-dataset
147+
- name: 'Start Druid containers'
148+
working-directory: ./druid-dataset
149+
run: |
150+
chmod -R 777 storage
151+
docker-compose up -d
152+
- name: 'Wait Druid nodes to startup'
153+
run: |
154+
until docker logs coordinator | grep "Successfully started lifecycle \[module\]"; do sleep 1s; done
155+
until docker logs router | grep "Successfully started lifecycle \[module\]"; do sleep 1s; done
156+
until docker logs historical | grep "Successfully started lifecycle \[module\]"; do sleep 1s; done
157+
until docker logs middlemanager | grep "Successfully started lifecycle \[module\]"; do sleep 1s; done
158+
until docker logs broker | grep "Successfully started lifecycle \[module\]"; do sleep 1s; done
159+
- name: 'Index Foodmart/Wikipedia datasets'
160+
working-directory: ./druid-dataset
161+
run: ./index.sh 30s
162+
- uses: actions/checkout@v2
163+
with:
164+
fetch-depth: 1
165+
path: calcite
166+
- uses: burrunan/gradle-cache-action@v1
167+
name: 'Run Druid tests'
168+
with:
169+
build-root-directory: ./calcite
170+
job-id: Druid8
171+
arguments: --scan --no-parallel --no-daemon :druid:test -Dcalcite.test.druid=true

core/src/main/java/org/apache/calcite/util/Bug.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ public abstract class Bug {
201201
* fixed. */
202202
public static final boolean CALCITE_4213_FIXED = false;
203203

204+
/** Whether
205+
* <a href="https://issues.apache.org/jira/browse/CALCITE-4279">[CALCITE-4279]
206+
* SEARCH operator cannot be pushed into Druid</a> is fixed. */
207+
public static final boolean CALCITE_4279_FIXED = false;
208+
204209
/**
205210
* Use this to flag temporary code.
206211
*/

druid/src/test/java/org/apache/calcite/test/DruidAdapter2IT.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
501501
/** Tests a query that contains no GROUP BY and is therefore executed as a
502502
* Druid "select" query. */
503503
@Test void testFilterSortDesc() {
504+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
504505
final String sql = "select \"product_name\" from \"foodmart\"\n"
505506
+ "where \"product_id\" BETWEEN '1500' AND '1502'\n"
506507
+ "order by \"state_province\" desc, \"product_id\"";
@@ -856,6 +857,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
856857
}
857858

858859
@Test void testGroupByMonthGranularityFiltered() {
860+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
859861
final String sql = "select sum(\"unit_sales\") as s,\n"
860862
+ " count(\"store_sqft\") as c\n"
861863
+ "from \"foodmart\"\n"
@@ -906,6 +908,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
906908
}
907909

908910
@Test void testTopNDayGranularityFiltered() {
911+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
909912
final String sql = "select sum(\"unit_sales\") as s,\n"
910913
+ "max(\"unit_sales\") as m,\n"
911914
+ "\"state_province\" as p\n"
@@ -1009,6 +1012,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
10091012
}
10101013

10111014
@Test void testFilterDistinct() {
1015+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
10121016
final String sql = "select distinct \"state_province\", \"city\",\n"
10131017
+ " \"product_name\"\n"
10141018
+ "from \"foodmart\"\n"
@@ -1047,6 +1051,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
10471051
}
10481052

10491053
@Test void testFilter() {
1054+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
10501055
final String sql = "select \"state_province\", \"city\",\n"
10511056
+ " \"product_name\"\n"
10521057
+ "from \"foodmart\"\n"
@@ -1159,6 +1164,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
11591164
}
11601165

11611166
@Test void testPushAggregateOnTimeWithExtractYear() {
1167+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
11621168
String sql = "select EXTRACT( year from \"timestamp\") as \"year\",\"product_id\" from "
11631169
+ "\"foodmart\" where \"product_id\" = 1016 and "
11641170
+ "\"timestamp\" < cast('1999-01-02' as timestamp) and \"timestamp\" > cast"
@@ -1176,6 +1182,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
11761182
}
11771183

11781184
@Test void testPushAggregateOnTimeWithExtractMonth() {
1185+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
11791186
String sql = "select EXTRACT( month from \"timestamp\") as \"month\",\"product_id\" from "
11801187
+ "\"foodmart\" where \"product_id\" = 1016 and "
11811188
+ "\"timestamp\" < cast('1997-06-02' as timestamp) and \"timestamp\" > cast"
@@ -1194,6 +1201,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
11941201
}
11951202

11961203
@Test void testPushAggregateOnTimeWithExtractDay() {
1204+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
11971205
String sql = "select EXTRACT( day from \"timestamp\") as \"day\","
11981206
+ "\"product_id\" from \"foodmart\""
11991207
+ " where \"product_id\" = 1016 and "
@@ -1213,6 +1221,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
12131221
}
12141222

12151223
@Test void testPushAggregateOnTimeWithExtractHourOfDay() {
1224+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
12161225
String sql =
12171226
"select EXTRACT( hour from \"timestamp\") as \"hourOfDay\",\"product_id\" from "
12181227
+ "\"foodmart\" where \"product_id\" = 1016 and "
@@ -1225,6 +1234,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
12251234
}
12261235

12271236
@Test void testPushAggregateOnTimeWithExtractYearMonthDay() {
1237+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
12281238
String sql = "select EXTRACT( day from \"timestamp\") as \"day\", EXTRACT( month from "
12291239
+ "\"timestamp\") as \"month\", EXTRACT( year from \"timestamp\") as \"year\",\""
12301240
+ "product_id\" from \"foodmart\" where \"product_id\" = 1016 and "
@@ -1259,6 +1269,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
12591269
}
12601270

12611271
@Test void testPushAggregateOnTimeWithExtractYearMonthDayWithOutRenaming() {
1272+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
12621273
String sql = "select EXTRACT( day from \"timestamp\"), EXTRACT( month from "
12631274
+ "\"timestamp\"), EXTRACT( year from \"timestamp\"),\""
12641275
+ "product_id\" from \"foodmart\" where \"product_id\" = 1016 and "
@@ -1292,6 +1303,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
12921303
}
12931304

12941305
@Test void testPushAggregateOnTimeWithExtractWithOutRenaming() {
1306+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
12951307
String sql = "select EXTRACT( day from \"timestamp\"), "
12961308
+ "\"product_id\" as \"dayOfMonth\" from \"foodmart\" "
12971309
+ "where \"product_id\" = 1016 and \"timestamp\" < cast('1997-01-20' as timestamp) "
@@ -1316,6 +1328,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
13161328
}
13171329

13181330
@Test void testPushComplexFilter() {
1331+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
13191332
String sql = "select sum(\"store_sales\") from \"foodmart\" "
13201333
+ "where EXTRACT( year from \"timestamp\") = 1997 and "
13211334
+ "\"cases_per_pallet\" >= 8 and \"cases_per_pallet\" <= 10 and "
@@ -2035,6 +2048,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
20352048
}
20362049

20372050
@Test void testOrderByOnMetricsInSelectDruidQuery() {
2051+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
20382052
final String sqlQuery = "select \"store_sales\" as a, \"store_cost\" as b, \"store_sales\" - "
20392053
+ "\"store_cost\" as c from \"foodmart\" where \"timestamp\" "
20402054
+ ">= '1997-01-01 00:00:00' and \"timestamp\" < '1997-09-01 00:00:00' order by c "
@@ -2237,6 +2251,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
22372251
/** Tests that multiple aggregates with filter clauses have their filters
22382252
extracted to the outer filter field for data pruning. */
22392253
@Test void testFilterClausesFactoredForPruning1() {
2254+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
22402255
String sql = "select "
22412256
+ "sum(\"store_sales\") filter (where \"store_state\" = 'CA'), "
22422257
+ "sum(\"store_sales\") filter (where \"store_state\" = 'WA') "
@@ -2261,6 +2276,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
22612276
* extracted to the outer filter field for data pruning in the presence of an
22622277
* outer filter. */
22632278
@Test void testFilterClausesFactoredForPruning2() {
2279+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
22642280
String sql = "select "
22652281
+ "sum(\"store_sales\") filter (where \"store_state\" = 'CA'), "
22662282
+ "sum(\"store_sales\") filter (where \"store_state\" = 'WA') "
@@ -2411,6 +2427,7 @@ private void checkGroupBySingleSortLimit(boolean approx) {
24112427
/** Tests that an aggregate with a nested filter clause has its filter
24122428
* factored out. */
24132429
@Test void testNestedFilterClauseFactored() {
2430+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
24142431
// Logically equivalent to
24152432
// select sum("store_sales") from "foodmart" where "store_state" in ('CA', 'OR')
24162433
String sql =
@@ -2701,6 +2718,7 @@ private void testCountWithApproxDistinct(boolean approx, String sql, String expe
27012718
}
27022719

27032720
@Test void testFilterWithFloorOnTime() {
2721+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
27042722
// Test filter on floor on time column is pushed to druid
27052723
final String sql =
27062724
"Select floor(\"timestamp\" to MONTH) as t from \"foodmart\" where "
@@ -2755,6 +2773,7 @@ private void testCountWithApproxDistinct(boolean approx, String sql, String expe
27552773
}
27562774

27572775
@Test void testFloorToDateRangeWithTimeZone() {
2776+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
27582777
final String sql = "Select floor(\"timestamp\" to MONTH) as t from "
27592778
+ "\"foodmart\" where floor(\"timestamp\" to MONTH) >= '1997-05-01 00:00:00' "
27602779
+ "and floor(\"timestamp\" to MONTH) < '1997-05-02 00:00:00' order by t"
@@ -3173,6 +3192,7 @@ private void testCountWithApproxDistinct(boolean approx, String sql, String expe
31733192

31743193

31753194
@Test void testCeilFilterExpression() {
3195+
Assumptions.assumeTrue(Bug.CALCITE_4279_FIXED, "CALCITE-4279");
31763196
final String sql = "SELECT COUNT(*) FROM " + FOODMART_TABLE + " WHERE ceil(\"store_sales\") > 1"
31773197
+ " AND ceil(\"timestamp\" TO DAY) < CAST('1997-01-05' AS TIMESTAMP)"
31783198
+ " AND ceil(\"timestamp\" TO MONTH) < CAST('1997-03-01' AS TIMESTAMP)"

0 commit comments

Comments
 (0)