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 resultset validation of Drill tests #15096

Merged
merged 129 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
3df0069
use enum for type + assume to mark disabled
kgyrtkirk Sep 21, 2023
21e6d9e
enable rel logging in debug
kgyrtkirk Sep 21, 2023
6de29b1
some changes
kgyrtkirk Sep 21, 2023
6ce9bbd
use local calcite; enable tests
kgyrtkirk Sep 21, 2023
53ddb34
make some tests pass
kgyrtkirk Sep 22, 2023
431ec6c
possble fix; but different format/etc; need different result cmp
kgyrtkirk Sep 22, 2023
3522ef5
parse results
kgyrtkirk Sep 22, 2023
46bcd62
unsorted
kgyrtkirk Sep 22, 2023
b8c4353
more sophisticated order match
kgyrtkirk Sep 22, 2023
be06612
asd
kgyrtkirk Sep 22, 2023
01ee94c
format
kgyrtkirk Sep 22, 2023
39f713b
crap
kgyrtkirk Sep 22, 2023
41120e2
lead/lag default 1
kgyrtkirk Sep 22, 2023
37ba5e7
add smlTbl
kgyrtkirk Sep 22, 2023
0b7a656
fix a 100 more
kgyrtkirk Sep 22, 2023
e0e1575
remove crappy class
kgyrtkirk Sep 22, 2023
628d4c6
undo comment wrap
kgyrtkirk Sep 22, 2023
baddb89
generate junit4 cases - so they can be ignored
kgyrtkirk Sep 22, 2023
181a067
Revert "generate junit4 cases - so they can be ignored"
kgyrtkirk Sep 22, 2023
af10e12
fix some literal stuff
kgyrtkirk Sep 22, 2023
4e0adb8
fix literal
kgyrtkirk Sep 22, 2023
51fb6a6
cases-crap
kgyrtkirk Sep 25, 2023
52e5f8d
try2
kgyrtkirk Sep 25, 2023
749863d
add indexes/etc
kgyrtkirk Sep 25, 2023
bceebf6
ignore some
kgyrtkirk Sep 25, 2023
3d87a29
updates
kgyrtkirk Sep 22, 2023
66a9050
remove ws; wQT
kgyrtkirk Sep 25, 2023
e92a971
remove unneeded method
kgyrtkirk Sep 25, 2023
2ce1cfb
format things
kgyrtkirk Sep 25, 2023
7af7b9d
cleanup
kgyrtkirk Sep 25, 2023
bfc230d
rename/etc
kgyrtkirk Sep 25, 2023
ac2bf6b
re-add cases
kgyrtkirk Sep 25, 2023
b7e564b
ignore some; change annotation a bit
kgyrtkirk Sep 25, 2023
081a2c6
fix long/date
kgyrtkirk Sep 25, 2023
05ae71f
fixes/ginore
kgyrtkirk Sep 25, 2023
7625b4d
ignoremore
kgyrtkirk Sep 25, 2023
6dd8c0b
a bit beter ts parsing
kgyrtkirk Sep 25, 2023
23dcc3f
fix some more
kgyrtkirk Sep 26, 2023
ce7d1eb
marks
kgyrtkirk Sep 26, 2023
bc492e0
cleanup/remove/etc
kgyrtkirk Sep 26, 2023
73c4f4e
checkstyle
kgyrtkirk Sep 26, 2023
6f82841
checkstyle
kgyrtkirk Sep 26, 2023
741459f
instanceof
kgyrtkirk Sep 26, 2023
5b249fe
fixes/etc
kgyrtkirk Sep 26, 2023
0fe39f8
fix pattern
kgyrtkirk Sep 26, 2023
15e46db
cleanup
kgyrtkirk Sep 26, 2023
7c1e2c7
remove cases.yaml
kgyrtkirk Sep 26, 2023
4f25a0d
fixup literals
kgyrtkirk Sep 26, 2023
fef9a5b
accept better
kgyrtkirk Sep 26, 2023
a0a379a
accept some
kgyrtkirk Sep 26, 2023
2fd3e88
more
kgyrtkirk Sep 26, 2023
623d110
few moerw
kgyrtkirk Sep 26, 2023
f3241c0
ignore some more
kgyrtkirk Sep 26, 2023
100315a
fix/etc few more
kgyrtkirk Sep 26, 2023
972757e
fix/etc few more
kgyrtkirk Sep 26, 2023
59fcc60
all ignored or pass
kgyrtkirk Sep 26, 2023
a502c1d
format; prepare to add DRUID_SUM back
kgyrtkirk Sep 26, 2023
4369275
enable-back/etc
kgyrtkirk Sep 26, 2023
7583003
changemessage
kgyrtkirk Sep 26, 2023
aac17c4
remove some stuff
kgyrtkirk Sep 26, 2023
69dec17
negativeTest
kgyrtkirk Sep 27, 2023
c24d479
negativeTest
kgyrtkirk Sep 27, 2023
1e33c7e
fixup
kgyrtkirk Sep 27, 2023
012bbf7
update apidoc
kgyrtkirk Sep 27, 2023
f1e9b16
Merge remote-tracking branch 'kgyrtkirk/windowing-fixes-negativetest'…
kgyrtkirk Sep 27, 2023
9af0edf
some stuiff
kgyrtkirk Sep 27, 2023
b6ca922
add time parsing; accept tests
kgyrtkirk Sep 28, 2023
ceb7558
remove parseException
kgyrtkirk Sep 28, 2023
c1e96da
sysqtest
kgyrtkirk Oct 2, 2023
9151fc6
retain orig SUM
kgyrtkirk Oct 2, 2023
68959a4
Merge remote-tracking branch 'apache/master' into windowing-fixes
kgyrtkirk Oct 3, 2023
7e2b56f
inputAccessor
kgyrtkirk Oct 3, 2023
8df9ab5
nulls x0
kgyrtkirk Oct 3, 2023
abf5bd6
Revert "nulls x0"
kgyrtkirk Oct 3, 2023
908cc9f
add test
kgyrtkirk Oct 3, 2023
284767a
x
kgyrtkirk Oct 3, 2023
66c287d
removeXYZ
kgyrtkirk Oct 3, 2023
fa85d15
migration pattern
kgyrtkirk Oct 3, 2023
06933a0
step1
kgyrtkirk Oct 3, 2023
b3f1dfa
implement/etc/finish test
kgyrtkirk Oct 3, 2023
f412344
rename test
kgyrtkirk Oct 3, 2023
36667d2
rename
kgyrtkirk Oct 3, 2023
aad8c38
some more stuff
kgyrtkirk Oct 3, 2023
4998e1c
move some stuff outside
kgyrtkirk Oct 3, 2023
4237989
one more
kgyrtkirk Oct 3, 2023
95d1402
more
kgyrtkirk Oct 3, 2023
6e18d01
fix a few more
kgyrtkirk Oct 3, 2023
3360c8c
finish core aggs
kgyrtkirk Oct 3, 2023
ef50c29
Merge remote-tracking branch 'apache/master' into windowing-fixes
kgyrtkirk Oct 4, 2023
cd8fe62
Merge remote-tracking branch 'apache/master' into windowing-fixes
kgyrtkirk Oct 4, 2023
76838d1
w/o typesys modification
kgyrtkirk Oct 5, 2023
362f796
Revert "w/o typesys modification"
kgyrtkirk Oct 5, 2023
fe6c32c
Revert "Revert "w/o typesys modification""
kgyrtkirk Oct 5, 2023
ca8dcdd
undo inputaccessor
kgyrtkirk Oct 5, 2023
c39b628
remove unrelated testcase
kgyrtkirk Oct 5, 2023
52b99e3
cleanup
kgyrtkirk Oct 5, 2023
0bebc12
cleanup
kgyrtkirk Oct 5, 2023
ffec495
cleanup/etc
kgyrtkirk Oct 5, 2023
94cbc6b
remove throws
kgyrtkirk Oct 5, 2023
ee78be5
fix warning
kgyrtkirk Oct 5, 2023
459957e
newline
kgyrtkirk Oct 5, 2023
819705d
dont use org.apache.curator.shaded.com.google.common.primitives.Doubles
kgyrtkirk Oct 5, 2023
0613caf
Merge remote-tracking branch 'apache/master' into windowing-fixes
kgyrtkirk Oct 6, 2023
4ab39b6
fix conflict
kgyrtkirk Oct 6, 2023
6dbffce
messages
kgyrtkirk Oct 6, 2023
ac0b441
address comments; fix huge bug in verify
kgyrtkirk Oct 6, 2023
00479f2
remove approx
kgyrtkirk Oct 6, 2023
c473f01
tries to fix t_alltypes
kgyrtkirk Oct 6, 2023
3804c77
Revert "tries to fix t_alltypes"
kgyrtkirk Oct 6, 2023
454ae36
annotate some more tests
kgyrtkirk Oct 6, 2023
e9aa601
cleanup
kgyrtkirk Oct 6, 2023
2fa47c6
update/ignore all failing
kgyrtkirk Oct 6, 2023
7c23b5e
reorder
kgyrtkirk Oct 6, 2023
7d064b2
rename annotation
kgyrtkirk Oct 6, 2023
3d82b4e
undo annot rename
kgyrtkirk Oct 9, 2023
045f34b
Merge remote-tracking branch 'apache/master' into windowing-fixes
kgyrtkirk Oct 9, 2023
aa8e888
fix after master merge
kgyrtkirk Oct 9, 2023
9f3df59
plus2;minus2;alter1
kgyrtkirk Oct 9, 2023
8f8bed5
move parsing to new method
kgyrtkirk Oct 9, 2023
147811e
first repro of 0 long
kgyrtkirk Oct 9, 2023
b35a9a2
add registry
kgyrtkirk Oct 9, 2023
6438967
all types affected
kgyrtkirk Oct 9, 2023
cdfc3f2
undo windowing changes
kgyrtkirk Oct 9, 2023
73e9c8e
NotYetSupported instead fixme
kgyrtkirk Oct 9, 2023
f0a6a7d
remove logging stuff
kgyrtkirk Oct 9, 2023
80034be
update javadoc
kgyrtkirk Oct 9, 2023
80ee374
Merge remote-tracking branch 'apache/master' into windowing-fixes
kgyrtkirk Oct 9, 2023
8d75371
fixcheckstyle
kgyrtkirk Oct 9, 2023
dcaa67b
undo non-desired test changes
kgyrtkirk Oct 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
Expand Down Expand Up @@ -1056,7 +1057,8 @@ public Map<String, Object> baseQueryContext()

public void assertResultsEquals(String sql, List<Object[]> expectedResults, List<Object[]> results)
{
for (int i = 0; i < results.size(); i++) {
int minSize = Math.min(results.size(), expectedResults.size());
for (int i = 0; i < minSize; i++) {
Assert.assertArrayEquals(
StringUtils.format("result #%d: %s", i + 1, sql),
expectedResults.get(i),
Expand Down Expand Up @@ -1368,7 +1370,7 @@ public void verify(String sql, List<Object[]> results)
assertResultsEquals(sql, expectedResults, results);
}
catch (AssertionError e) {
displayResults(results);
displayResults("Actual", results);
throw e;
}
}
Expand All @@ -1380,10 +1382,10 @@ public void verify(String sql, List<Object[]> results)
* expected results: let the test fail with empty results. The actual results
* are printed to the console. Copy them into the test.
*/
public static void displayResults(List<Object[]> results)
public static void displayResults(String name, List<Object[]> results)
{
PrintStream out = System.out;
out.println("-- Actual results --");
out.printf(Locale.ENGLISH, "-- %s results --", name);
for (int rowIndex = 0; rowIndex < results.size(); rowIndex++) {
printArray(results.get(rowIndex), out);
if (rowIndex < results.size() - 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.segment.join.JoinType;
import org.apache.druid.sql.calcite.DecoupledIgnore.Modes;
import org.apache.druid.sql.calcite.NotYetSupported.Modes;
import org.apache.druid.sql.calcite.expression.DruidExpression;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.planner.Calcites;
Expand Down Expand Up @@ -2688,7 +2688,7 @@ public void testGroupByWithSelectProjections()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@NotYetSupported(Modes.CANNOT_CONVERT)
@Test
public void testGroupByWithSelectAndOrderByProjections()
{
Expand Down Expand Up @@ -2773,7 +2773,7 @@ public void testTopNWithSelectProjections()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@NotYetSupported(Modes.CANNOT_CONVERT)
@Test
public void testTopNWithSelectAndOrderByProjections()
{
Expand Down Expand Up @@ -2811,7 +2811,7 @@ public void testTopNWithSelectAndOrderByProjections()
);
}

@DecoupledIgnore
@NotYetSupported
@Test
public void testUnionAllQueries()
{
Expand Down Expand Up @@ -2845,7 +2845,7 @@ public void testUnionAllQueries()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@NotYetSupported(Modes.NOT_ENOUGH_RULES)
@Test
public void testUnionAllQueriesWithLimit()
{
Expand Down Expand Up @@ -3203,7 +3203,7 @@ public void testNullFloatFilter()
* This test case should be in {@link CalciteUnionQueryTest}. However, there's a bug in the test framework that
* doesn't reset framework once the merge buffers
*/
@DecoupledIgnore
@NotYetSupported
@Test
public void testUnionAllSameTableThreeTimes()
{
Expand Down Expand Up @@ -3247,7 +3247,7 @@ public void testUnionAllSameTableThreeTimes()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@NotYetSupported(Modes.NOT_ENOUGH_RULES)
@Test
public void testExactCountDistinctUsingSubqueryOnUnionAllTables()
{
Expand Down Expand Up @@ -4653,7 +4653,7 @@ public void testSimpleAggregations()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@NotYetSupported(Modes.CANNOT_CONVERT)
@Test
public void testGroupByWithSortOnPostAggregationDefault()
{
Expand Down Expand Up @@ -4685,7 +4685,7 @@ public void testGroupByWithSortOnPostAggregationDefault()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@NotYetSupported(Modes.CANNOT_CONVERT)
@Test
public void testGroupByWithSortOnPostAggregationNoTopNConfig()
{
Expand Down Expand Up @@ -4729,7 +4729,7 @@ public void testGroupByWithSortOnPostAggregationNoTopNConfig()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@NotYetSupported(Modes.CANNOT_CONVERT)
@Test
public void testGroupByWithSortOnPostAggregationNoTopNContext()
{
Expand Down Expand Up @@ -5317,7 +5317,7 @@ public void testCountStarWithNotOfDegenerateFilter()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@NotYetSupported(Modes.ERROR_HANDLING)
@Test
public void testUnplannableQueries()
{
Expand Down Expand Up @@ -5389,7 +5389,7 @@ public void testCountStarWithBoundFilterSimplifyOr()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@NotYetSupported(Modes.ERROR_HANDLING)
@Test
public void testUnplannableExactCountDistinctOnSketch()
{
Expand Down Expand Up @@ -6384,7 +6384,7 @@ public void testApproxCountDistinctBuiltin()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@NotYetSupported(Modes.PLAN_MISMATCH)
@Test
public void testExactCountDistinctWithGroupingAndOtherAggregators()
{
Expand Down Expand Up @@ -6439,7 +6439,7 @@ public void testExactCountDistinctWithGroupingAndOtherAggregators()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@NotYetSupported(Modes.NOT_ENOUGH_RULES)
@Test
public void testMultipleExactCountDistinctWithGroupingAndOtherAggregatorsUsingJoin()
{
Expand Down Expand Up @@ -7082,7 +7082,7 @@ public void testQueryWithMoreThanMaxNumericInFilter()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@NotYetSupported(Modes.PLAN_MISMATCH)
@Test
public void testExactCountDistinctUsingSubqueryWithWherePushDown()
{
Expand Down Expand Up @@ -7813,7 +7813,7 @@ public void testGroupAndFilterOnTimeFloorWithTimeZone()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@NotYetSupported(Modes.PLAN_MISMATCH)
@Test
public void testFilterOnCurrentTimestampWithIntervalArithmetic()
{
Expand Down Expand Up @@ -7861,7 +7861,7 @@ public void testFilterOnCurrentTimestampLosAngeles()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@NotYetSupported(Modes.PLAN_MISMATCH)
@Test
public void testFilterOnCurrentTimestampOnView()
{
Expand Down Expand Up @@ -10112,7 +10112,7 @@ public void testGroupByTimeAndOtherDimension()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@NotYetSupported(Modes.PLAN_MISMATCH)
@Test
public void testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim()
{
Expand Down Expand Up @@ -11561,7 +11561,7 @@ public void testTextcat()
);
}

@DecoupledIgnore
@NotYetSupported
@Test
public void testRequireTimeConditionPositive()
{
Expand Down Expand Up @@ -11765,7 +11765,7 @@ public void testRequireTimeConditionSubQueryNegative()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@NotYetSupported(Modes.ERROR_HANDLING)
@Test
public void testRequireTimeConditionSemiJoinNegative()
{
Expand Down Expand Up @@ -13744,7 +13744,7 @@ public void testReturnEmptyRowWhenGroupByIsConvertedToTimeseriesWithMultipleCons
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@NotYetSupported(Modes.PLAN_MISMATCH)
@Test
public void testPlanWithInFilterLessThanInSubQueryThreshold()
{
Expand Down Expand Up @@ -14069,7 +14069,7 @@ public void testComplexDecodeAgg()
)
);
}
@DecoupledIgnore
@NotYetSupported
@Test
public void testOrderByAlongWithInternalScanQuery()
{
Expand Down Expand Up @@ -14112,7 +14112,7 @@ public void testOrderByAlongWithInternalScanQuery()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@NotYetSupported(Modes.NOT_ENOUGH_RULES)
@Test
public void testOrderByAlongWithInternalScanQueryNoDistinct()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
package org.apache.druid.sql.calcite;

import com.google.common.collect.ImmutableList;
import org.apache.druid.sql.calcite.DecoupledIgnore.DecoupledIgnoreProcessor;
import org.apache.druid.sql.calcite.DecoupledIgnore.Modes;
import org.apache.druid.sql.calcite.NotYetSupported.Modes;
import org.apache.druid.sql.calcite.NotYetSupported.NotYetSupportedProcessor;
import org.junit.Rule;
import org.junit.Test;

public class CalciteSysQueryTest extends BaseCalciteQueryTest
{
@Rule(order = 0)
public DecoupledIgnoreProcessor decoupledIgnoreProcessor = new DecoupledIgnoreProcessor();
public NotYetSupportedProcessor NegativeTestProcessor = new NotYetSupportedProcessor();

@Test
public void testTasksSum()
Expand All @@ -46,7 +46,7 @@ public void testTasksSum()
.run();
}

@DecoupledIgnore(mode = Modes.EXPRESSION_NOT_GROUPED)
@NotYetSupported(Modes.EXPRESSION_NOT_GROUPED)
@Test
public void testTasksSumOver()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.common.collect.ImmutableMap;
import org.apache.druid.query.QueryContexts;
import org.apache.druid.server.security.AuthConfig;
import org.apache.druid.sql.calcite.DecoupledIgnore.DecoupledIgnoreProcessor;
import org.apache.druid.sql.calcite.NotYetSupported.NotYetSupportedProcessor;
import org.apache.druid.sql.calcite.planner.PlannerConfig;
import org.apache.druid.sql.calcite.util.SqlTestFramework;
import org.junit.Rule;
Expand All @@ -31,7 +31,7 @@ public class DecoupledPlanningCalciteQueryTest extends CalciteQueryTest
{

@Rule(order = 0)
public DecoupledIgnoreProcessor decoupledIgnoreProcessor = new DecoupledIgnoreProcessor();
public NotYetSupportedProcessor decoupledIgnoreProcessor = new NotYetSupportedProcessor();

private static final ImmutableMap<String, Object> CONTEXT_OVERRIDES = ImmutableMap.of(
PlannerConfig.CTX_NATIVE_QUERY_SQL_PLANNING_MODE, PlannerConfig.NATIVE_QUERY_SQL_PLANNING_MODE_DECOUPLED,
Expand Down
55 changes: 55 additions & 0 deletions sql/src/test/java/org/apache/druid/sql/calcite/DisableUnless.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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.sql.calcite;

import com.google.common.base.Supplier;
import org.apache.druid.common.config.NullHandling;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

import static org.junit.Assume.assumeTrue;

/**
* Collection of conditional disabler rules.
*/
class DisableUnless
{
public static final TestRule SQL_COMPATIBLE = new DisableUnlessRule("NullHandling::sqlCompatible", NullHandling::sqlCompatible);

public static class DisableUnlessRule implements TestRule
{
private Supplier<Boolean> predicate;
private String message;

public DisableUnlessRule(String message, Supplier<Boolean> predicate)
{
this.message = message;
this.predicate = predicate;
}

@Override
public Statement apply(Statement base, Description description)
{
assumeTrue("Testcase disabled; because condition not met: " + message, predicate.get());
return base;
}
}
}
Loading