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

Use annotation to mark DecoupleIgnore #15005

Merged
merged 20 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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 @@ -284,10 +284,10 @@ public static Map<String, Object> getTimeseriesContextWithFloorTime(
private static SqlTestFramework queryFramework;
final boolean useDefault = NullHandling.replaceWithDefault();

@Rule
@Rule(order = 1)
public ExpectedException expectedException = ExpectedException.none();

@Rule
@Rule(order = 2)
public TemporaryFolder temporaryFolder = new TemporaryFolder();

public boolean cannotVectorize = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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.expression.DruidExpression;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.planner.Calcites;
Expand Down Expand Up @@ -2651,6 +2652,7 @@ public void testGroupByWithSelectProjections()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@Test
public void testGroupByWithSelectAndOrderByProjections()
{
Expand Down Expand Up @@ -2702,6 +2704,7 @@ public void testGroupByWithSelectAndOrderByProjections()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@Test
public void testTopNWithSelectProjections()
{
Expand Down Expand Up @@ -2735,7 +2738,7 @@ public void testTopNWithSelectProjections()
);
}


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

@DecoupledIgnore
@Test
public void testUnionAllQueries()
{
Expand Down Expand Up @@ -2806,6 +2810,7 @@ public void testUnionAllQueries()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@Test
public void testUnionAllQueriesWithLimit()
{
Expand Down Expand Up @@ -2834,6 +2839,7 @@ public void testUnionAllQueriesWithLimit()
);
}

@DecoupledIgnore
@Test
public void testUnionAllDifferentTablesWithMapping()
{
Expand Down Expand Up @@ -2877,6 +2883,7 @@ public void testUnionAllDifferentTablesWithMapping()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@Test
public void testJoinUnionAllDifferentTablesWithMapping()
{
Expand Down Expand Up @@ -2940,6 +2947,7 @@ public void testUnionAllTablesColumnCountMismatch()
}
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@Test
public void testUnionAllTablesColumnTypeMismatchFloatLong()
{
Expand Down Expand Up @@ -2987,6 +2995,7 @@ public void testUnionAllTablesColumnTypeMismatchFloatLong()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@Test
public void testUnionAllTablesColumnTypeMismatchStringLong()
{
Expand All @@ -3004,6 +3013,7 @@ public void testUnionAllTablesColumnTypeMismatchStringLong()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@Test
public void testUnionAllTablesWhenMappingIsRequired()
{
Expand All @@ -3020,6 +3030,7 @@ public void testUnionAllTablesWhenMappingIsRequired()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@Test
public void testUnionIsUnplannable()
{
Expand All @@ -3030,6 +3041,7 @@ public void testUnionIsUnplannable()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@Test
public void testUnionAllTablesWhenCastAndMappingIsRequired()
{
Expand All @@ -3045,6 +3057,7 @@ public void testUnionAllTablesWhenCastAndMappingIsRequired()
);
}

@DecoupledIgnore
@Test
public void testUnionAllSameTableTwice()
{
Expand Down Expand Up @@ -3088,6 +3101,7 @@ public void testUnionAllSameTableTwice()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@Test
public void testUnionAllSameTableTwiceWithSameMapping()
{
Expand Down Expand Up @@ -3131,6 +3145,7 @@ public void testUnionAllSameTableTwiceWithSameMapping()
);
}

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@Test
public void testUnionAllSameTableTwiceWithDifferentMapping()
{
Expand All @@ -3144,7 +3159,7 @@ public void testUnionAllSameTableTwiceWithDifferentMapping()
"SQL requires union between two tables and column names queried for each table are different Left: [dim1, dim2, m1], Right: [dim2, dim1, m1]."
);
}

@DecoupledIgnore
@Test
public void testUnionAllSameTableThreeTimes()
{
Expand Down Expand Up @@ -3249,6 +3264,7 @@ public void testUnionAllThreeTablesColumnCountMismatch3()
}
}

@DecoupledIgnore
@Test
public void testUnionAllSameTableThreeTimesWithSameMapping()
{
Expand Down Expand Up @@ -4971,6 +4987,7 @@ public void testSimpleAggregations()
);
}

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

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

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

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

@DecoupledIgnore(mode = Modes.ERROR_HANDLING)
@Test
public void testUnplannableTwoExactCountDistincts()
{
Expand All @@ -5715,6 +5736,7 @@ public void testUnplannableTwoExactCountDistincts()
);
}

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

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@Test
public void testExactCountDistinctWithGroupingAndOtherAggregators()
{
Expand Down Expand Up @@ -7153,6 +7176,7 @@ public void testExactCountDistinctUsingSubquery()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@Test
public void testExactCountDistinctUsingSubqueryOnUnionAllTables()
{
Expand Down Expand Up @@ -7327,6 +7351,7 @@ public void testQueryWithMoreThanMaxNumericInFilter()
);
}

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

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

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

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@Test
public void testGroupByTimeFloorAndDimOnGroupByTimeFloorAndDim()
{
Expand Down Expand Up @@ -11461,7 +11489,7 @@ public void testSortProjectAfterNestedGroupBy()
);
}


@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@Test
public void testPostAggWithTimeseries()
{
Expand Down Expand Up @@ -11505,6 +11533,7 @@ public void testPostAggWithTimeseries()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@Test
public void testPostAggWithTopN()
{
Expand Down Expand Up @@ -11744,6 +11773,7 @@ public void testTextcat()
);
}

@DecoupledIgnore
@Test
public void testRequireTimeConditionPositive()
{
Expand Down Expand Up @@ -11947,6 +11977,7 @@ public void testRequireTimeConditionSubQueryNegative()
);
}

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

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

@DecoupledIgnore
@Test
public void testOrderByAlongWithInternalScanQuery()
{
Expand Down Expand Up @@ -14252,6 +14284,7 @@ public void testOrderByAlongWithInternalScanQuery()
);
}

@DecoupledIgnore(mode = Modes.NOT_ENOUGH_RULES)
@Test
public void testOrderByAlongWithInternalScanQueryNoDistinct()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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 org.apache.druid.error.DruidException;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.regex.Pattern;

/**
* Can be used to mark tests which are not-yet supported in decoupled mode.
*/
kgyrtkirk marked this conversation as resolved.
Show resolved Hide resolved
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface DecoupledIgnore
{
enum Modes
{
PLAN_MISMATCH(AssertionError.class, "AssertionError: query #"),
NOT_ENOUGH_RULES(DruidException.class, "not enough rules"),
CANNOT_CONVERT(DruidException.class, "Cannot convert query parts"),
ERROR_HANDLING(AssertionError.class, "(is <ADMIN> was <OPERATOR>|is <INVALID_INPUT> was <UNCATEGORIZED>|with message a string containing)");

public Class<? extends Throwable> throwableClass;
public String regex;

Modes(Class<? extends Throwable> cl, String regex)
{
this.throwableClass = cl;
this.regex = regex;
}

Pattern getPattern()
{
return Pattern.compile(regex);
rohangarg marked this conversation as resolved.
Show resolved Hide resolved
}
};

Modes mode() default Modes.NOT_ENOUGH_RULES;

}
Loading