diff --git a/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java b/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java index 11f53d84b28e..cbd82776233d 100644 --- a/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java +++ b/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java @@ -37,13 +37,13 @@ /** * Tests the "Babel" SQL parser, that understands all dialects of SQL. */ -public class BabelParserTest extends SqlParserTest { +class BabelParserTest extends SqlParserTest { @Override protected SqlParserImplFactory parserImplFactory() { return SqlBabelParserImpl.FACTORY; } - @Test public void testReservedWords() { + @Test void testReservedWords() { assertThat(isReserved("escape"), is(false)); } @@ -51,7 +51,7 @@ public class BabelParserTest extends SqlParserTest { * *

Copy-pasted from base method, but with some key differences. */ - @Override @Test public void testMetadata() { + @Override @Test protected void testMetadata() { SqlAbstractParserImpl.Metadata metadata = getSqlParser("").getMetadata(); assertThat(metadata.isReservedFunctionName("ABS"), is(true)); assertThat(metadata.isReservedFunctionName("FOO"), is(false)); @@ -88,14 +88,14 @@ public class BabelParserTest extends SqlParserTest { assertThat(!jdbcKeywords.contains(",SELECT,"), is(true)); } - @Test public void testSelect() { + @Test void testSelect() { final String sql = "select 1 from t"; final String expected = "SELECT 1\n" + "FROM `T`"; sql(sql).ok(expected); } - @Test public void testYearIsNotReserved() { + @Test void testYearIsNotReserved() { final String sql = "select 1 as year from t"; final String expected = "SELECT 1 AS `YEAR`\n" + "FROM `T`"; @@ -104,7 +104,7 @@ public class BabelParserTest extends SqlParserTest { /** Tests that there are no reserved keywords. */ @Disabled - @Test public void testKeywords() { + @Test void testKeywords() { final String[] reserved = {"AND", "ANY", "END-EXEC"}; final StringBuilder sql = new StringBuilder("select "); final StringBuilder expected = new StringBuilder("SELECT "); @@ -124,14 +124,14 @@ public class BabelParserTest extends SqlParserTest { } /** In Babel, AS is not reserved. */ - @Test public void testAs() { + @Test void testAs() { final String expected = "SELECT `AS`\n" + "FROM `T`"; sql("select as from t").ok(expected); } /** In Babel, DESC is not reserved. */ - @Test public void testDesc() { + @Test void testDesc() { final String sql = "select desc\n" + "from t\n" + "order by desc asc, desc desc"; @@ -149,7 +149,7 @@ public class BabelParserTest extends SqlParserTest { * @see [CALCITE-2847] * Optimize global LOOKAHEAD for SQL parsers */ - @Test public void testCaseExpressionBabel() { + @Test void testCaseExpressionBabel() { sql("case x when 2, 4 then 3 ^when^ then 5 else 4 end") .fails("(?s)Encountered \"when then\" at .*"); } @@ -157,7 +157,7 @@ public class BabelParserTest extends SqlParserTest { /** In Redshift, DATE is a function. It requires special treatment in the * parser because it is a reserved keyword. * (Curiously, TIMESTAMP and TIME are not functions.) */ - @Test public void testDateFunction() { + @Test void testDateFunction() { final String expected = "SELECT `DATE`(`X`)\n" + "FROM `T`"; sql("select date(x) from t").ok(expected); @@ -166,7 +166,7 @@ public class BabelParserTest extends SqlParserTest { /** In Redshift, PostgreSQL the DATEADD, DATEDIFF and DATE_PART functions have * ordinary function syntax except that its first argument is a time unit * (e.g. DAY). We must not parse that first argument as an identifier. */ - @Test public void testRedshiftFunctionsWithDateParts() { + @Test void testRedshiftFunctionsWithDateParts() { final String sql = "SELECT DATEADD(day, 1, t),\n" + " DATEDIFF(week, 2, t),\n" + " DATE_PART(year, t) FROM mytable"; @@ -179,7 +179,7 @@ public class BabelParserTest extends SqlParserTest { /** PostgreSQL and Redshift allow TIMESTAMP literals that contain only a * date part. */ - @Test public void testShortTimestampLiteral() { + @Test void testShortTimestampLiteral() { sql("select timestamp '1969-07-20'") .ok("SELECT TIMESTAMP '1969-07-20 00:00:00'"); // PostgreSQL allows the following. We should too. @@ -234,7 +234,7 @@ private void checkExNotNull(SqlParserUtil.StringAndPos sap, Throwable thrown) { } /** Tests parsing PostgreSQL-style "::" cast operator. */ - @Test public void testParseInfixCast() { + @Test void testParseInfixCast() { checkParseInfixCast("integer"); checkParseInfixCast("varchar"); checkParseInfixCast("boolean"); diff --git a/babel/src/test/java/org/apache/calcite/test/BabelQuidemTest.java b/babel/src/test/java/org/apache/calcite/test/BabelQuidemTest.java index 51477db58b29..1a8343933409 100644 --- a/babel/src/test/java/org/apache/calcite/test/BabelQuidemTest.java +++ b/babel/src/test/java/org/apache/calcite/test/BabelQuidemTest.java @@ -50,7 +50,7 @@ /** * Unit tests for the Babel SQL parser. */ -public class BabelQuidemTest extends QuidemTest { +class BabelQuidemTest extends QuidemTest { /** Runs a test from the command line. * *

For example: diff --git a/babel/src/test/java/org/apache/calcite/test/BabelTest.java b/babel/src/test/java/org/apache/calcite/test/BabelTest.java index efdfac71133f..b46a164fe621 100644 --- a/babel/src/test/java/org/apache/calcite/test/BabelTest.java +++ b/babel/src/test/java/org/apache/calcite/test/BabelTest.java @@ -37,7 +37,7 @@ /** * Unit tests for Babel framework. */ -public class BabelTest { +class BabelTest { static final String URL = "jdbc:calcite:"; @@ -75,7 +75,7 @@ static Connection connect(UnaryOperator propBuild) return DriverManager.getConnection(URL, info); } - @Test public void testInfixCast() throws SQLException { + @Test void testInfixCast() throws SQLException { try (Connection connection = connect(useLibraryList("standard,postgresql")); Statement statement = connection.createStatement()) { checkInfixCast(statement, "integer", Types.INTEGER); diff --git a/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterDataTypesTest.java b/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterDataTypesTest.java index 308eeb004d17..7541fde61398 100644 --- a/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterDataTypesTest.java +++ b/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterDataTypesTest.java @@ -41,7 +41,7 @@ */ @Execution(ExecutionMode.SAME_THREAD) @ExtendWith(CassandraExtension.class) -public class CassandraAdapterDataTypesTest { +class CassandraAdapterDataTypesTest { /** Connection factory based on the "mongo-zips" model. */ private static final ImmutableMap DTCASSANDRA = @@ -53,7 +53,7 @@ static void load(Session session) { .load(new ClassPathCQLDataSet("datatypes.cql")); } - @Test public void testSimpleTypesRowType() { + @Test void testSimpleTypesRowType() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_simple\"") @@ -79,7 +79,7 @@ static void load(Session session) { + ", f_varint INTEGER]"); } - @Test public void testSimpleTypesValues() { + @Test void testSimpleTypesValues() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_simple\"") @@ -105,21 +105,21 @@ static void load(Session session) { + "; f_varint=10\n"); } - @Test public void testCounterRowType() { + @Test void testCounterRowType() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_counter\"") .typeIs("[f_int INTEGER, f_counter BIGINT]"); } - @Test public void testCounterValues() { + @Test void testCounterValues() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_counter\"") .returns("f_int=1; f_counter=1\n"); } - @Test public void testCollectionsRowType() { + @Test void testCollectionsRowType() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_collections\"") @@ -130,7 +130,7 @@ static void load(Session session) { + ", f_tuple STRUCT]"); } - @Test public void testCollectionsValues() { + @Test void testCollectionsValues() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_collections\"") @@ -142,7 +142,7 @@ static void load(Session session) { + "\n"); } - @Test public void testCollectionsInnerRowType() { + @Test void testCollectionsInnerRowType() { CalciteAssert.that() .with(DTCASSANDRA) .query("select \"f_list\"[1], " @@ -160,7 +160,7 @@ static void load(Session session) { // ignored as tuple elements returns 'null' when accessed in the select statement @Disabled - @Test public void testCollectionsInnerValues() { + @Test void testCollectionsInnerValues() { CalciteAssert.that() .with(DTCASSANDRA) .query("select \"f_list\"[1], " @@ -177,7 +177,7 @@ static void load(Session session) { } // frozen collections should not affect the row type - @Test public void testFrozenCollectionsRowType() { + @Test void testFrozenCollectionsRowType() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_frozen_collections\"") @@ -190,7 +190,7 @@ static void load(Session session) { } // frozen collections should not affect the result set - @Test public void testFrozenCollectionsValues() { + @Test void testFrozenCollectionsValues() { CalciteAssert.that() .with(DTCASSANDRA) .query("select * from \"test_frozen_collections\"") diff --git a/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterTest.java b/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterTest.java index a9b7b36a8e50..871b25d00250 100644 --- a/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterTest.java +++ b/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterTest.java @@ -40,7 +40,7 @@ */ @Execution(ExecutionMode.SAME_THREAD) @ExtendWith(CassandraExtension.class) -public class CassandraAdapterTest { +class CassandraAdapterTest { /** Connection factory based on the "mongo-zips" model. */ private static final ImmutableMap TWISSANDRA = @@ -52,14 +52,14 @@ static void load(Session session) { .load(new ClassPathCQLDataSet("twissandra.cql")); } - @Test public void testSelect() { + @Test void testSelect() { CalciteAssert.that() .with(TWISSANDRA) .query("select * from \"users\"") .returnsCount(10); } - @Test public void testFilter() { + @Test void testFilter() { CalciteAssert.that() .with(TWISSANDRA) .query("select * from \"userline\" where \"username\"='!PUBLIC!'") @@ -71,7 +71,7 @@ static void load(Session session) { + " CassandraTableScan(table=[[twissandra, userline]]"); } - @Test public void testFilterUUID() { + @Test void testFilterUUID() { CalciteAssert.that() .with(TWISSANDRA) .query("select * from \"tweets\" where \"tweet_id\"='f3cd759c-d05b-11e5-b58b-90e2ba530b12'") @@ -83,7 +83,7 @@ static void load(Session session) { + " CassandraTableScan(table=[[twissandra, tweets]]"); } - @Test public void testSort() { + @Test void testSort() { CalciteAssert.that() .with(TWISSANDRA) .query("select * from \"userline\" where \"username\" = '!PUBLIC!' order by \"time\" desc") @@ -93,7 +93,7 @@ static void load(Session session) { + " CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"); } - @Test public void testProject() { + @Test void testProject() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" from \"userline\" where \"username\" = '!PUBLIC!' limit 2") @@ -105,7 +105,7 @@ static void load(Session session) { + " CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"); } - @Test public void testProjectAlias() { + @Test void testProjectAlias() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" as \"foo\" from \"userline\" " @@ -113,21 +113,21 @@ static void load(Session session) { .returns("foo=f3c329de-d05b-11e5-b58b-90e2ba530b12\n"); } - @Test public void testProjectConstant() { + @Test void testProjectConstant() { CalciteAssert.that() .with(TWISSANDRA) .query("select 'foo' as \"bar\" from \"userline\" limit 1") .returns("bar=foo\n"); } - @Test public void testLimit() { + @Test void testLimit() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" from \"userline\" where \"username\" = '!PUBLIC!' limit 8") .explainContains("CassandraLimit(fetch=[8])\n"); } - @Test public void testSortLimit() { + @Test void testSortLimit() { CalciteAssert.that() .with(TWISSANDRA) .query("select * from \"userline\" where \"username\"='!PUBLIC!' " @@ -136,7 +136,7 @@ static void load(Session session) { + " CassandraSort(sort0=[$1], dir0=[DESC])"); } - @Test public void testSortOffset() { + @Test void testSortOffset() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" from \"userline\" where " @@ -146,7 +146,7 @@ static void load(Session session) { + "tweet_id=f3e4182e-d05b-11e5-b58b-90e2ba530b12\n"); } - @Test public void testMaterializedView() { + @Test void testMaterializedView() { CalciteAssert.that() .with(TWISSANDRA) .query("select \"tweet_id\" from \"tweets\" where \"username\"='JmuhsAaMdw'") diff --git a/core/src/test/java/org/apache/calcite/adapter/clone/ArrayTableTest.java b/core/src/test/java/org/apache/calcite/adapter/clone/ArrayTableTest.java index 58cdbf40f3fd..5560ebbfb8d7 100644 --- a/core/src/test/java/org/apache/calcite/adapter/clone/ArrayTableTest.java +++ b/core/src/test/java/org/apache/calcite/adapter/clone/ArrayTableTest.java @@ -35,8 +35,8 @@ /** * Unit test for {@link ArrayTable} and {@link ColumnLoader}. */ -public class ArrayTableTest { - @Test public void testPrimitiveArray() { +class ArrayTableTest { + @Test void testPrimitiveArray() { long[] values = {0, 0}; ArrayTable.BitSlicedPrimitiveArray.orLong(4, values, 0, 0x0F); assertEquals(0x0F, values[0]); @@ -61,7 +61,7 @@ public class ArrayTableTest { } } - @Test public void testNextPowerOf2() { + @Test void testNextPowerOf2() { assertEquals(1, ColumnLoader.nextPowerOf2(1)); assertEquals(2, ColumnLoader.nextPowerOf2(2)); assertEquals(4, ColumnLoader.nextPowerOf2(3)); @@ -73,7 +73,7 @@ public class ArrayTableTest { assertEquals(0x80000000, ColumnLoader.nextPowerOf2(0x7ffffffe)); } - @Test public void testLog2() { + @Test void testLog2() { assertEquals(0, ColumnLoader.log2(0)); assertEquals(0, ColumnLoader.log2(1)); assertEquals(1, ColumnLoader.log2(2)); @@ -87,7 +87,7 @@ public class ArrayTableTest { assertEquals(30, ColumnLoader.log2(0x40000000)); } - @Test public void testValueSetInt() { + @Test void testValueSetInt() { ArrayTable.BitSlicedPrimitiveArray representation; ArrayTable.Column pair; @@ -147,7 +147,7 @@ public class ArrayTableTest { assertEquals(64, representation2.getObject(pair.dataSet, 5)); } - @Test public void testValueSetBoolean() { + @Test void testValueSetBoolean() { final ColumnLoader.ValueSet valueSet = new ColumnLoader.ValueSet(boolean.class); valueSet.add(0); @@ -167,7 +167,7 @@ public class ArrayTableTest { assertEquals(0, representation.getInt(pair.dataSet, 3)); } - @Test public void testValueSetZero() { + @Test void testValueSetZero() { final ColumnLoader.ValueSet valueSet = new ColumnLoader.ValueSet(boolean.class); valueSet.add(0); @@ -180,7 +180,7 @@ public class ArrayTableTest { assertEquals(1, pair.cardinality); } - @Test public void testStrings() { + @Test void testStrings() { ArrayTable.Column pair; final ColumnLoader.ValueSet valueSet = @@ -227,7 +227,7 @@ public class ArrayTableTest { assertEquals(2, pair.cardinality); } - @Test public void testAllNull() { + @Test void testAllNull() { ArrayTable.Column pair; final ColumnLoader.ValueSet valueSet = @@ -252,7 +252,7 @@ public class ArrayTableTest { assertEquals(1, pair.cardinality); } - @Test public void testOneValueOneNull() { + @Test void testOneValueOneNull() { ArrayTable.Column pair; final ColumnLoader.ValueSet valueSet = @@ -282,7 +282,7 @@ public class ArrayTableTest { assertEquals(2, pair.cardinality); } - @Test public void testLoadSorted() { + @Test void testLoadSorted() { final JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType rowType = @@ -318,7 +318,7 @@ public class ArrayTableTest { /** As {@link #testLoadSorted()} but column #1 is the unique column, not * column #0. The algorithm needs to go back and permute the values of * column #0 after it discovers that column #1 is unique and sorts by it. */ - @Test public void testLoadSorted2() { + @Test void testLoadSorted2() { final JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType rowType = diff --git a/core/src/test/java/org/apache/calcite/adapter/enumerable/EnumUtilsTest.java b/core/src/test/java/org/apache/calcite/adapter/enumerable/EnumUtilsTest.java index 87c2fb3ce3b6..10d167d1d094 100644 --- a/core/src/test/java/org/apache/calcite/adapter/enumerable/EnumUtilsTest.java +++ b/core/src/test/java/org/apache/calcite/adapter/enumerable/EnumUtilsTest.java @@ -39,7 +39,7 @@ */ public final class EnumUtilsTest { - @Test public void testDateTypeToInnerTypeConvert() { + @Test void testDateTypeToInnerTypeConvert() { // java.sql.Date x; final ParameterExpression date = Expressions.parameter(0, java.sql.Date.class, "x"); @@ -77,7 +77,7 @@ public final class EnumUtilsTest { is("org.apache.calcite.runtime.SqlFunctions.toLongOptional(x)")); } - @Test public void testTypeConvertFromPrimitiveToBox() { + @Test void testTypeConvertFromPrimitiveToBox() { final Expression intVariable = Expressions.parameter(0, int.class, "intV"); @@ -160,7 +160,7 @@ public final class EnumUtilsTest { is("Double.valueOf((double) intV)")); } - @Test public void testTypeConvertToString() { + @Test void testTypeConvertToString() { // Constant Expression: "null" final ConstantExpression nullLiteral1 = Expressions.constant(null); // Constant Expression: "(Object) null" @@ -171,7 +171,7 @@ public final class EnumUtilsTest { assertThat(Expressions.toString(e2), is("(String) (Object) null")); } - @Test public void testMethodCallExpression() { + @Test void testMethodCallExpression() { // test for Object.class method parameter type final ConstantExpression arg0 = Expressions.constant(1, int.class); final ConstantExpression arg1 = Expressions.constant("x", String.class); diff --git a/core/src/test/java/org/apache/calcite/adapter/enumerable/PhysTypeTest.java b/core/src/test/java/org/apache/calcite/adapter/enumerable/PhysTypeTest.java index c567e28a3931..0e23926c7cef 100644 --- a/core/src/test/java/org/apache/calcite/adapter/enumerable/PhysTypeTest.java +++ b/core/src/test/java/org/apache/calcite/adapter/enumerable/PhysTypeTest.java @@ -39,7 +39,7 @@ public final class PhysTypeTest { /** Test case for * [CALCITE-2677] * Struct types with one field are not mapped correctly to Java Classes. */ - @Test public void testFieldClassOnColumnOfOneFieldStructType() { + @Test void testFieldClassOnColumnOfOneFieldStructType() { RelDataType columnType = TYPE_FACTORY.createStructType( ImmutableList.of(TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER)), ImmutableList.of("intField")); @@ -54,7 +54,7 @@ public final class PhysTypeTest { /** Test case for * [CALCITE-2677] * Struct types with one field are not mapped correctly to Java Classes. */ - @Test public void testFieldClassOnColumnOfTwoFieldStructType() { + @Test void testFieldClassOnColumnOfTwoFieldStructType() { RelDataType columnType = TYPE_FACTORY.createStructType( ImmutableList.of( TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER), @@ -74,7 +74,7 @@ public final class PhysTypeTest { * [CALCITE-3364] * Can't group table function result due to a type cast error if table function * returns a row with a single value. */ - @Test public void testOneColumnJavaRowFormatConversion() { + @Test void testOneColumnJavaRowFormatConversion() { RelDataType rowType = TYPE_FACTORY.createStructType( ImmutableList.of(TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER)), ImmutableList.of("intField")); diff --git a/core/src/test/java/org/apache/calcite/adapter/enumerable/TypeFinderTest.java b/core/src/test/java/org/apache/calcite/adapter/enumerable/TypeFinderTest.java index dac0e935818d..179982ab2404 100644 --- a/core/src/test/java/org/apache/calcite/adapter/enumerable/TypeFinderTest.java +++ b/core/src/test/java/org/apache/calcite/adapter/enumerable/TypeFinderTest.java @@ -42,21 +42,21 @@ /** * Test for {@link org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.TypeFinder} */ -public class TypeFinderTest { +class TypeFinderTest { - @Test public void testConstantExpression() { + @Test void testConstantExpression() { ConstantExpression expr = Expressions.constant(null, Integer.class); assertJavaCodeContains("(Integer) null\n", expr); assertTypeContains(Integer.class, expr); } - @Test public void testConvertExpression() { + @Test void testConvertExpression() { UnaryExpression expr = Expressions.convert_(Expressions.new_(String.class), Object.class); assertJavaCodeContains("(Object) new String()\n", expr); assertTypeContains(Arrays.asList(String.class, Object.class), expr); } - @Test public void testFunctionExpression1() { + @Test void testFunctionExpression1() { ParameterExpression param = Expressions.parameter(String.class, "input"); FunctionExpression expr = Expressions.lambda(Function1.class, Expressions.block( @@ -74,7 +74,7 @@ public class TypeFinderTest { assertTypeContains(String.class, expr); } - @Test public void testFunctionExpression2() { + @Test void testFunctionExpression2() { FunctionExpression expr = Expressions.lambda(Function1.class, Expressions.block( Expressions.return_(null, Expressions.constant(1L, Long.class))), diff --git a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java index 1385a22e51c4..469f7b82fa16 100644 --- a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java +++ b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java @@ -89,7 +89,7 @@ * see https://issues.apache.org/jira/browse/CALCITE-2853. */ @Execution(ExecutionMode.SAME_THREAD) -public class CalciteRemoteDriverTest { +class CalciteRemoteDriverTest { public static final String LJS = Factory2.class.getName(); private final PrintWriter out = @@ -176,7 +176,7 @@ protected static Connection getRemoteConnection() throws SQLException { } } - @Test public void testCatalogsLocal() throws Exception { + @Test void testCatalogsLocal() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LJS); assertThat(connection.isClosed(), is(false)); @@ -191,7 +191,7 @@ protected static Connection getRemoteConnection() throws SQLException { assertThat(connection.isClosed(), is(true)); } - @Test public void testSchemasLocal() throws Exception { + @Test void testSchemasLocal() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LJS); assertThat(connection.isClosed(), is(false)); @@ -214,7 +214,7 @@ protected static Connection getRemoteConnection() throws SQLException { assertThat(connection.isClosed(), is(true)); } - @Test public void testMetaFunctionsLocal() throws Exception { + @Test void testMetaFunctionsLocal() throws Exception { final Connection connection = CalciteAssert.hr().connect(); assertThat(connection.isClosed(), is(false)); @@ -247,13 +247,13 @@ protected static Connection getRemoteConnection() throws SQLException { assertThat(connection.isClosed(), is(true)); } - @Test public void testRemoteCatalogs() throws Exception { + @Test void testRemoteCatalogs() throws Exception { CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY) .metaData(GET_CATALOGS) .returns("TABLE_CAT=null\n"); } - @Test public void testRemoteSchemas() throws Exception { + @Test void testRemoteSchemas() throws Exception { CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY) .metaData(GET_SCHEMAS) .returns("TABLE_SCHEM=POST; TABLE_CATALOG=null\n" @@ -262,26 +262,26 @@ protected static Connection getRemoteConnection() throws SQLException { + "TABLE_SCHEM=metadata; TABLE_CATALOG=null\n"); } - @Test public void testRemoteColumns() throws Exception { + @Test void testRemoteColumns() throws Exception { CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY) .metaData(GET_COLUMNS) .returns(CalciteAssert.checkResultContains("COLUMN_NAME=EMPNO")); } - @Test public void testRemoteTypeInfo() throws Exception { + @Test void testRemoteTypeInfo() throws Exception { CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY) .metaData(GET_TYPEINFO) .returns(CalciteAssert.checkResultCount(is(45))); } - @Test public void testRemoteTableTypes() throws Exception { + @Test void testRemoteTableTypes() throws Exception { CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY) .metaData(GET_TABLE_TYPES) .returns("TABLE_TYPE=TABLE\n" + "TABLE_TYPE=VIEW\n"); } - @Test public void testRemoteExecuteQuery() throws Exception { + @Test void testRemoteExecuteQuery() throws Exception { CalciteAssert.hr().with(REMOTE_CONNECTION_FACTORY) .query("values (1, 'a'), (cast(null as integer), 'b')") .returnsUnordered("EXPR$0=1; EXPR$1=a", "EXPR$0=null; EXPR$1=b"); @@ -289,7 +289,7 @@ protected static Connection getRemoteConnection() throws SQLException { /** Same query as {@link #testRemoteExecuteQuery()}, run without the test * infrastructure. */ - @Test public void testRemoteExecuteQuery2() throws Exception { + @Test void testRemoteExecuteQuery2() throws Exception { try (Connection remoteConnection = getRemoteConnection()) { final Statement statement = remoteConnection.createStatement(); final String sql = "values (1, 'a'), (cast(null as integer), 'b')"; @@ -304,7 +304,7 @@ protected static Connection getRemoteConnection() throws SQLException { /** For each (source, destination) type, make sure that we can convert bind * variables. */ - @Test public void testParameterConvert() throws Exception { + @Test void testParameterConvert() throws Exception { final StringBuilder sql = new StringBuilder("select 1"); final Map map = new HashMap<>(); for (Map.Entry entry : SqlType.getSetConversions()) { @@ -380,7 +380,7 @@ protected static Connection getRemoteConnection() throws SQLException { /** Check that the "set" conversion table looks like Table B-5 in JDBC 4.1 * specification */ - @Test public void testTableB5() { + @Test void testTableB5() { SqlType[] columns = { SqlType.TINYINT, SqlType.SMALLINT, SqlType.INTEGER, SqlType.BIGINT, SqlType.REAL, SqlType.FLOAT, SqlType.DOUBLE, SqlType.DECIMAL, @@ -418,7 +418,7 @@ private String pad(String x) { /** Check that the "get" conversion table looks like Table B-5 in JDBC 4.1 * specification */ - @Test public void testTableB6() { + @Test void testTableB6() { SqlType[] columns = { SqlType.TINYINT, SqlType.SMALLINT, SqlType.INTEGER, SqlType.BIGINT, SqlType.REAL, SqlType.FLOAT, SqlType.DOUBLE, SqlType.DECIMAL, @@ -448,7 +448,7 @@ private String pad(String x) { *

Test case for * [CALCITE-646] * AvaticaStatement execute method broken over remote JDBC. */ - @Test public void testRemoteStatementExecute() throws Exception { + @Test void testRemoteStatementExecute() throws Exception { try (Connection remoteConnection = getRemoteConnection()) { final Statement statement = remoteConnection.createStatement(); final boolean status = statement.execute("values (1, 2), (3, 4), (5, 6)"); @@ -462,7 +462,7 @@ private String pad(String x) { } } - @Test public void testAvaticaConnectionException() { + @Test void testAvaticaConnectionException() { assertThrows(SQLException.class, () -> { try (Connection remoteConnection = getRemoteConnection()) { remoteConnection.isValid(-1); @@ -470,7 +470,7 @@ private String pad(String x) { }); } - @Test public void testAvaticaStatementException() { + @Test void testAvaticaStatementException() { assertThrows(SQLException.class, () -> { try (Connection remoteConnection = getRemoteConnection()) { try (Statement statement = remoteConnection.createStatement()) { @@ -480,7 +480,7 @@ private String pad(String x) { }); } - @Test public void testAvaticaStatementGetMoreResults() throws Exception { + @Test void testAvaticaStatementGetMoreResults() throws Exception { try (Connection remoteConnection = getRemoteConnection()) { try (Statement statement = remoteConnection.createStatement()) { assertThat(statement.getMoreResults(), is(false)); @@ -488,7 +488,7 @@ private String pad(String x) { } } - @Test public void testRemoteExecute() throws Exception { + @Test void testRemoteExecute() throws Exception { try (Connection remoteConnection = getRemoteConnection()) { ResultSet resultSet = remoteConnection.createStatement().executeQuery( @@ -501,7 +501,7 @@ private String pad(String x) { } } - @Test public void testRemoteExecuteMaxRow() throws Exception { + @Test void testRemoteExecuteMaxRow() throws Exception { try (Connection remoteConnection = getRemoteConnection()) { Statement statement = remoteConnection.createStatement(); statement.setMaxRows(2); @@ -518,7 +518,7 @@ private String pad(String x) { /** Test case for * [CALCITE-661] * Remote fetch in Calcite JDBC driver. */ - @Test public void testRemotePrepareExecute() throws Exception { + @Test void testRemotePrepareExecute() throws Exception { try (Connection remoteConnection = getRemoteConnection()) { final PreparedStatement preparedStatement = remoteConnection.prepareStatement("select * from \"hr\".\"emps\""); @@ -540,7 +540,7 @@ public static Connection makeConnection() throws Exception { return conn; } - @Test public void testLocalStatementFetch() throws Exception { + @Test void testLocalStatementFetch() throws Exception { Connection conn = makeConnection(); String sql = "select * from \"foo\".\"bar\""; Statement statement = conn.createStatement(); @@ -555,7 +555,7 @@ public static Connection makeConnection() throws Exception { } /** Test that returns all result sets in one go. */ - @Test public void testLocalPreparedStatementFetch() throws Exception { + @Test void testLocalPreparedStatementFetch() throws Exception { Connection conn = makeConnection(); assertThat(conn.isClosed(), is(false)); String sql = "select * from \"foo\".\"bar\""; @@ -573,7 +573,7 @@ public static Connection makeConnection() throws Exception { assertThat(count, is(101)); } - @Test public void testRemoteStatementFetch() throws Exception { + @Test void testRemoteStatementFetch() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LocalServiceMoreFactory.class.getName()); String sql = "select * from \"foo\".\"bar\""; @@ -588,7 +588,7 @@ public static Connection makeConnection() throws Exception { assertThat(count, is(101)); } - @Test public void testRemotePreparedStatementFetch() throws Exception { + @Test void testRemotePreparedStatementFetch() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LocalServiceMoreFactory.class.getName()); assertThat(connection.isClosed(), is(false)); @@ -810,7 +810,7 @@ public static class LocalServiceModifiableFactory implements Service.Factory { } /** Test remote Statement insert. */ - @Test public void testInsert() throws Exception { + @Test void testInsert() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LocalServiceModifiableFactory.class.getName()); @@ -829,7 +829,7 @@ public static class LocalServiceModifiableFactory implements Service.Factory { } /** Test remote Statement batched insert. */ - @Test public void testInsertBatch() throws Exception { + @Test void testInsertBatch() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LocalServiceModifiableFactory.class.getName()); @@ -861,7 +861,7 @@ public static class LocalServiceModifiableFactory implements Service.Factory { /** * Remote PreparedStatement insert WITHOUT bind variables */ - @Test public void testRemotePreparedStatementInsert() throws Exception { + @Test void testRemotePreparedStatementInsert() throws Exception { final Connection connection = DriverManager.getConnection( "jdbc:avatica:remote:factory=" + LocalServiceModifiableFactory.class.getName()); @@ -882,6 +882,6 @@ public static class LocalServiceModifiableFactory implements Service.Factory { /** * Remote PreparedStatement insert WITH bind variables */ - @Test public void testRemotePreparedStatementInsert2() throws Exception { + @Test void testRemotePreparedStatementInsert2() throws Exception { } } diff --git a/core/src/test/java/org/apache/calcite/jdbc/JavaTypeFactoryTest.java b/core/src/test/java/org/apache/calcite/jdbc/JavaTypeFactoryTest.java index e5c66a0ba54f..cbb8631ce95d 100644 --- a/core/src/test/java/org/apache/calcite/jdbc/JavaTypeFactoryTest.java +++ b/core/src/test/java/org/apache/calcite/jdbc/JavaTypeFactoryTest.java @@ -40,7 +40,7 @@ public final class JavaTypeFactoryTest { /** Test case for * [CALCITE-2677] * Struct types with one field are not mapped correctly to Java Classes. */ - @Test public void testGetJavaClassWithOneFieldStructDataTypeV1() { + @Test void testGetJavaClassWithOneFieldStructDataTypeV1() { RelDataType structWithOneField = TYPE_FACTORY.createStructType(OneFieldStruct.class); assertEquals(OneFieldStruct.class, TYPE_FACTORY.getJavaClass(structWithOneField)); } @@ -48,7 +48,7 @@ public final class JavaTypeFactoryTest { /** Test case for * [CALCITE-2677] * Struct types with one field are not mapped correctly to Java Classes. */ - @Test public void testGetJavaClassWithOneFieldStructDataTypeV2() { + @Test void testGetJavaClassWithOneFieldStructDataTypeV2() { RelDataType structWithOneField = TYPE_FACTORY.createStructType( ImmutableList.of(TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER)), ImmutableList.of("intField")); @@ -58,7 +58,7 @@ public final class JavaTypeFactoryTest { /** Test case for * [CALCITE-2677] * Struct types with one field are not mapped correctly to Java Classes. */ - @Test public void testGetJavaClassWithTwoFieldsStructDataType() { + @Test void testGetJavaClassWithTwoFieldsStructDataType() { RelDataType structWithTwoFields = TYPE_FACTORY.createStructType(TwoFieldStruct.class); assertEquals(TwoFieldStruct.class, TYPE_FACTORY.getJavaClass(structWithTwoFields)); } @@ -66,7 +66,7 @@ public final class JavaTypeFactoryTest { /** Test case for * [CALCITE-2677] * Struct types with one field are not mapped correctly to Java Classes. */ - @Test public void testGetJavaClassWithTwoFieldsStructDataTypeV2() { + @Test void testGetJavaClassWithTwoFieldsStructDataTypeV2() { RelDataType structWithTwoFields = TYPE_FACTORY.createStructType( ImmutableList.of( TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER), @@ -79,7 +79,7 @@ public final class JavaTypeFactoryTest { * [CALCITE-3029] * Java-oriented field type is wrongly forced to be NOT NULL after being converted to * SQL-oriented. */ - @Test public void testFieldNullabilityAfterConvertingToSqlStructType() { + @Test void testFieldNullabilityAfterConvertingToSqlStructType() { RelDataType javaStructType = TYPE_FACTORY.createStructType( ImmutableList.of( TYPE_FACTORY.createJavaType(Integer.class), diff --git a/core/src/test/java/org/apache/calcite/materialize/LatticeSuggesterTest.java b/core/src/test/java/org/apache/calcite/materialize/LatticeSuggesterTest.java index b683a3f978aa..bc3cc8e5ae75 100644 --- a/core/src/test/java/org/apache/calcite/materialize/LatticeSuggesterTest.java +++ b/core/src/test/java/org/apache/calcite/materialize/LatticeSuggesterTest.java @@ -62,11 +62,11 @@ /** * Unit tests for {@link LatticeSuggester}. */ -public class LatticeSuggesterTest { +class LatticeSuggesterTest { /** Some basic query patterns on the Scott schema with "EMP" and "DEPT" * tables. */ - @Test public void testEmpDept() throws Exception { + @Test void testEmpDept() throws Exception { final Tester t = new Tester(); final String q0 = "select dept.dname, count(*), sum(sal)\n" + "from emp\n" @@ -137,7 +137,7 @@ public class LatticeSuggesterTest { assertThat(t.s.space.g.toString(), is(expected)); } - @Test public void testFoodmart() throws Exception { + @Test void testFoodmart() throws Exception { final Tester t = new Tester().foodmart(); final String q = "select \"t\".\"the_year\" as \"c0\",\n" + " \"t\".\"quarter\" as \"c1\",\n" @@ -177,7 +177,7 @@ public class LatticeSuggesterTest { assertThat(t.s.space.g.toString(), is(expected)); } - @Test public void testAggregateExpression() throws Exception { + @Test void testAggregateExpression() throws Exception { final Tester t = new Tester().foodmart(); final String q = "select \"t\".\"the_year\" as \"c0\",\n" + " \"pc\".\"product_family\" as \"c1\",\n" @@ -242,7 +242,7 @@ protected boolean matchesSafely(List lattices) { } @Tag("slow") - @Test public void testSharedSnowflake() throws Exception { + @Test void testSharedSnowflake() throws Exception { final Tester t = new Tester().foodmart(); // foodmart query 5827 (also 5828, 5830, 5832) uses the "region" table // twice: once via "store" and once via "customer"; @@ -273,7 +273,7 @@ protected boolean matchesSafely(List lattices) { isGraphs(g, "[SUM(sales_fact_1997.unit_sales)]")); } - @Test public void testExpressionInAggregate() throws Exception { + @Test void testExpressionInAggregate() throws Exception { final Tester t = new Tester().withEvolve(true).foodmart(); final FoodMartQuerySet set = FoodMartQuerySet.instance(); for (int id : new int[]{392, 393}) { @@ -394,16 +394,16 @@ private void checkFoodMartAll(boolean evolve) throws Exception { } @Tag("slow") - @Test public void testFoodMartAll() throws Exception { + @Test void testFoodMartAll() throws Exception { checkFoodMartAll(false); } @Tag("slow") - @Test public void testFoodMartAllEvolve() throws Exception { + @Test void testFoodMartAllEvolve() throws Exception { checkFoodMartAll(true); } - @Test public void testContains() throws Exception { + @Test void testContains() throws Exception { final Tester t = new Tester().foodmart(); final LatticeRootNode fNode = t.node("select *\n" + "from \"sales_fact_1997\""); @@ -425,7 +425,7 @@ private void checkFoodMartAll(boolean evolve) throws Exception { assertThat(fcpNode.contains(fcpNode), is(true)); } - @Test public void testEvolve() throws Exception { + @Test void testEvolve() throws Exception { final Tester t = new Tester().foodmart().withEvolve(true); final String q0 = "select count(*)\n" @@ -488,7 +488,7 @@ private void checkFoodMartAll(boolean evolve) throws Exception { is(l3)); } - @Test public void testExpression() throws Exception { + @Test void testExpression() throws Exception { final Tester t = new Tester().foodmart().withEvolve(true); final String q0 = "select\n" @@ -515,7 +515,7 @@ private void checkFoodMartAll(boolean evolve) throws Exception { /** As {@link #testExpression()} but with multiple queries. * Some expressions are measures in one query and dimensions in another. */ - @Test public void testExpressionEvolution() throws Exception { + @Test void testExpressionEvolution() throws Exception { final Tester t = new Tester().foodmart().withEvolve(true); // q0 uses n10 as a measure, n11 as a measure, n12 as a dimension @@ -571,7 +571,7 @@ private void checkDerivedColumn(Lattice lattice, List tables, assertThat(lattice.isAlwaysMeasure(dc0), is(alwaysMeasure)); } - @Test public void testExpressionInJoin() throws Exception { + @Test void testExpressionInJoin() throws Exception { final Tester t = new Tester().foodmart().withEvolve(true); final String q0 = "select\n" @@ -597,7 +597,7 @@ private void checkDerivedColumn(Lattice lattice, List tables, assertThat(derivedColumns.get(1).tables, is(tables)); } - @Test public void testRedshiftDialect() throws Exception { + @Test void testRedshiftDialect() throws Exception { final Tester t = new Tester().foodmart().withEvolve(true) .withDialect(SqlDialect.DatabaseProduct.REDSHIFT.getDialect()) .withLibrary(SqlLibrary.POSTGRESQL); @@ -619,7 +619,7 @@ private void checkDerivedColumn(Lattice lattice, List tables, /** A tricky case involving a CTE (WITH), a join condition that references an * expression, a complex WHERE clause, and some other queries. */ - @Test public void testJoinUsingExpression() throws Exception { + @Test void testJoinUsingExpression() throws Exception { final Tester t = new Tester().foodmart().withEvolve(true); final String q0 = "with c as (select\n" @@ -655,7 +655,7 @@ private void checkDerivedColumn(Lattice lattice, List tables, assertThat(t.s.latticeMap.size(), is(3)); } - @Test public void testDerivedColRef() throws Exception { + @Test void testDerivedColRef() throws Exception { final FrameworkConfig config = Frameworks.newConfigBuilder() .defaultSchema(Tester.schemaFrom(CalciteAssert.SchemaSpec.SCOTT)) .statisticProvider(QuerySqlStatisticProvider.SILENT_CACHING_INSTANCE) @@ -689,7 +689,7 @@ private void checkDerivedColumn(Lattice lattice, List tables, *

The query has a join, and so we have to execute statistics queries * to deduce the direction of the foreign key. */ - @Test public void testFoodmartSimpleJoin() throws Exception { + @Test void testFoodmartSimpleJoin() throws Exception { checkFoodmartSimpleJoin(CalciteAssert.SchemaSpec.JDBC_FOODMART); checkFoodmartSimpleJoin(CalciteAssert.SchemaSpec.FAKE_FOODMART); } @@ -709,7 +709,7 @@ private void checkFoodmartSimpleJoin(CalciteAssert.SchemaSpec schemaSpec) assertThat(t.addQuery(q), isGraphs(g, "[]")); } - @Test public void testUnion() throws Exception { + @Test void testUnion() throws Exception { checkUnion("union"); checkUnion("union all"); checkUnion("intersect"); diff --git a/core/src/test/java/org/apache/calcite/plan/RelOptPlanReaderTest.java b/core/src/test/java/org/apache/calcite/plan/RelOptPlanReaderTest.java index 59327ab17b14..b1ff290ad3a6 100644 --- a/core/src/test/java/org/apache/calcite/plan/RelOptPlanReaderTest.java +++ b/core/src/test/java/org/apache/calcite/plan/RelOptPlanReaderTest.java @@ -32,8 +32,8 @@ /** * Unit test for {@link org.apache.calcite.rel.externalize.RelJson}. */ -public class RelOptPlanReaderTest { - @Test public void testTypeToClass() { +class RelOptPlanReaderTest { + @Test void testTypeToClass() { RelJson relJson = new RelJson(null); // in org.apache.calcite.rel package @@ -82,8 +82,8 @@ public class RelOptPlanReaderTest { } /** Dummy relational expression. */ - public static class MyRel extends AbstractRelNode { - public MyRel(RelOptCluster cluster, RelTraitSet traitSet) { + static class MyRel extends AbstractRelNode { + MyRel(RelOptCluster cluster, RelTraitSet traitSet) { super(cluster, traitSet); } } diff --git a/core/src/test/java/org/apache/calcite/plan/RelOptUtilTest.java b/core/src/test/java/org/apache/calcite/plan/RelOptUtilTest.java index e4dd6d02a093..d567ce1b0e03 100644 --- a/core/src/test/java/org/apache/calcite/plan/RelOptUtilTest.java +++ b/core/src/test/java/org/apache/calcite/plan/RelOptUtilTest.java @@ -68,7 +68,7 @@ /** * Unit test for {@link RelOptUtil} and other classes in this package. */ -public class RelOptUtilTest { +class RelOptUtilTest { /** Creates a config based on the "scott" schema. */ private static Frameworks.ConfigBuilder config() { final SchemaPlus rootSchema = Frameworks.createRootSchema(true); @@ -100,7 +100,7 @@ private static Frameworks.ConfigBuilder config() { Lists.newArrayList(Iterables.concat(empRow.getFieldList(), deptRow.getFieldList())); } - @Test public void testTypeDump() { + @Test void testTypeDump() { RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType t1 = @@ -133,7 +133,7 @@ private static Frameworks.ConfigBuilder config() { /** * Tests the rules for how we name rules. */ - @Test public void testRuleGuessDescription() { + @Test void testRuleGuessDescription() { assertEquals("Bar", RelOptRule.guessDescription("com.foo.Bar")); assertEquals("Baz", RelOptRule.guessDescription("com.flatten.Bar$Baz")); @@ -151,7 +151,7 @@ private static Frameworks.ConfigBuilder config() { /** Test case for * [CALCITE-3136] * Fix the default rule description of ConverterRule. */ - @Test public void testConvertRuleDefaultRuleDescription() { + @Test void testConvertRuleDefaultRuleDescription() { RelCollation collation1 = RelCollations.of(new RelFieldCollation(4, RelFieldCollation.Direction.DESCENDING)); RelCollation collation2 = @@ -221,7 +221,7 @@ private static Frameworks.ConfigBuilder config() { * Test {@link RelOptUtil#splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)} * where the join condition contains just one which is a EQUAL operator. */ - @Test public void testSplitJoinConditionEquals() { + @Test void testSplitJoinConditionEquals() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -241,7 +241,7 @@ private static Frameworks.ConfigBuilder config() { * Test {@link RelOptUtil#splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)} * where the join condition contains just one which is a IS NOT DISTINCT operator. */ - @Test public void testSplitJoinConditionIsNotDistinctFrom() { + @Test void testSplitJoinConditionIsNotDistinctFrom() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -261,7 +261,7 @@ private static Frameworks.ConfigBuilder config() { * Test {@link RelOptUtil#splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)} * where the join condition contains an expanded version of IS NOT DISTINCT */ - @Test public void testSplitJoinConditionExpandedIsNotDistinctFrom() { + @Test void testSplitJoinConditionExpandedIsNotDistinctFrom() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -286,7 +286,7 @@ private static Frameworks.ConfigBuilder config() { * Test {@link RelOptUtil#splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)} * where the join condition contains an expanded version of IS NOT DISTINCT using CASE */ - @Test public void testSplitJoinConditionExpandedIsNotDistinctFromUsingCase() { + @Test void testSplitJoinConditionExpandedIsNotDistinctFromUsingCase() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -312,7 +312,7 @@ private static Frameworks.ConfigBuilder config() { * Test {@link RelOptUtil#splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)} * where the join condition contains an expanded version of IS NOT DISTINCT using CASE */ - @Test public void testSplitJoinConditionExpandedIsNotDistinctFromUsingCase2() { + @Test void testSplitJoinConditionExpandedIsNotDistinctFromUsingCase2() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -353,7 +353,7 @@ private void splitJoinConditionHelper(RexNode joinCond, List expLeftKey * Test {@link RelOptUtil#pushDownJoinConditions(org.apache.calcite.rel.core.Join, RelBuilder)} * where the join condition contains a complex expression */ - @Test public void testPushDownJoinConditions() { + @Test void testPushDownJoinConditions() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -398,7 +398,7 @@ private void splitJoinConditionHelper(RexNode joinCond, List expLeftKey * Test {@link RelOptUtil#pushDownJoinConditions(org.apache.calcite.rel.core.Join, RelBuilder)} * where the join condition contains a complex expression */ - @Test public void testPushDownJoinConditionsWithIsNotDistinct() { + @Test void testPushDownJoinConditionsWithIsNotDistinct() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -444,7 +444,7 @@ private void splitJoinConditionHelper(RexNode joinCond, List expLeftKey * Test {@link RelOptUtil#pushDownJoinConditions(org.apache.calcite.rel.core.Join, RelBuilder)} * where the join condition contains a complex expression */ - @Test public void testPushDownJoinConditionsWithExpandedIsNotDistinct() { + @Test void testPushDownJoinConditionsWithExpandedIsNotDistinct() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -495,7 +495,7 @@ private void splitJoinConditionHelper(RexNode joinCond, List expLeftKey * Test {@link RelOptUtil#pushDownJoinConditions(org.apache.calcite.rel.core.Join, RelBuilder)} * where the join condition contains a complex expression */ - @Test public void testPushDownJoinConditionsWithExpandedIsNotDistinctUsingCase() { + @Test void testPushDownJoinConditionsWithExpandedIsNotDistinctUsingCase() { int leftJoinIndex = empScan.getRowType().getFieldNames().indexOf("DEPTNO"); int rightJoinIndex = deptRow.getFieldNames().indexOf("DEPTNO"); @@ -547,7 +547,7 @@ private void splitJoinConditionHelper(RexNode joinCond, List expLeftKey * Test {@link RelOptUtil#createCastRel(RelNode, RelDataType, boolean)} * with changed field nullability or field name. */ - @Test public void testCreateCastRel() { + @Test void testCreateCastRel() { // Equivalent SQL: // select empno, ename, count(job) // from emp diff --git a/core/src/test/java/org/apache/calcite/plan/RelTraitTest.java b/core/src/test/java/org/apache/calcite/plan/RelTraitTest.java index 4ad2c4283d3b..de3870436e08 100644 --- a/core/src/test/java/org/apache/calcite/plan/RelTraitTest.java +++ b/core/src/test/java/org/apache/calcite/plan/RelTraitTest.java @@ -35,7 +35,7 @@ /** * Test to verify {@link RelCompositeTrait}. */ -public class RelTraitTest { +class RelTraitTest { private static final RelCollationTraitDef COLLATION = RelCollationTraitDef.INSTANCE; private void assertCanonical(String message, Supplier> collation) { @@ -48,16 +48,16 @@ private void assertCanonical(String message, Supplier> collat () -> "RelCompositeTrait.of should return the same instance for " + message); } - @Test public void compositeEmpty() { + @Test void compositeEmpty() { assertCanonical("empty composite", ImmutableList::of); } - @Test public void compositeOne() { + @Test void compositeOne() { assertCanonical("composite with one element", () -> ImmutableList.of(RelCollations.of(ImmutableList.of()))); } - @Test public void compositeTwo() { + @Test void compositeTwo() { assertCanonical("composite with two elements", () -> ImmutableList.of(RelCollations.of(0), RelCollations.of(1))); } diff --git a/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java b/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java index 372832fabe41..f99753fd8857 100644 --- a/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java +++ b/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java @@ -81,7 +81,7 @@ /** * Unit test for {@link org.apache.calcite.rel.externalize.RelJson}. */ -public class RelWriterTest { +class RelWriterTest { public static final String XX = "{\n" + " \"rels\": [\n" + " {\n" @@ -387,7 +387,7 @@ public class RelWriterTest { * a simple tree of relational expressions, consisting of a table and a * project including window expressions. */ - @Test public void testWriter() { + @Test void testWriter() { String s = Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> { rootSchema.add("hr", @@ -432,7 +432,7 @@ public class RelWriterTest { * a simple tree of relational expressions, consisting of a table, a filter * and an aggregate node. */ - @Test public void testWriter2() { + @Test void testWriter2() { String s = Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> { rootSchema.add("hr", @@ -482,7 +482,7 @@ public class RelWriterTest { /** * Unit test for {@link org.apache.calcite.rel.externalize.RelJsonReader}. */ - @Test public void testReader() { + @Test void testReader() { String s = Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> { SchemaPlus schema = @@ -509,7 +509,7 @@ public class RelWriterTest { /** * Unit test for {@link org.apache.calcite.rel.externalize.RelJsonReader}. */ - @Test public void testReader2() { + @Test void testReader2() { String s = Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> { SchemaPlus schema = @@ -539,7 +539,7 @@ public class RelWriterTest { /** * Unit test for {@link org.apache.calcite.rel.externalize.RelJsonReader}. */ - @Test public void testReaderNull() { + @Test void testReaderNull() { String s = Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> { SchemaPlus schema = @@ -563,7 +563,7 @@ public class RelWriterTest { + " LogicalTableScan(table=[[hr, emps]])\n")); } - @Test public void testTrim() { + @Test void testTrim() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder b = RelBuilder.create(config); final RelNode rel = @@ -588,7 +588,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testPlusOperator() { + @Test void testPlusOperator() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); final RelNode rel = builder @@ -608,7 +608,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testAggregateWithAlias() { + @Test void testAggregateWithAlias() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); // The rel node stands for sql: SELECT max(SAL) as max_sal from EMP group by JOB; @@ -636,7 +636,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testAggregateWithoutAlias() { + @Test void testAggregateWithoutAlias() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); // The rel node stands for sql: SELECT max(SAL) from EMP group by JOB; @@ -664,7 +664,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testCalc() { + @Test void testCalc() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); final RexBuilder rexBuilder = builder.getRexBuilder(); @@ -700,7 +700,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testCorrelateQuery() { + @Test void testCorrelateQuery() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); final Holder v = Holder.of(null); @@ -725,7 +725,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testOverWithoutPartition() { + @Test void testOverWithoutPartition() { // The rel stands for the sql of "select count(*) over (order by deptno) from EMP" final RelNode rel = mockCountOver("EMP", ImmutableList.of(), ImmutableList.of("DEPTNO")); String relJson = RelOptUtil.dumpPlan("", rel, SqlExplainFormat.JSON, @@ -738,7 +738,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testOverWithoutOrderKey() { + @Test void testOverWithoutOrderKey() { // The rel stands for the sql of "select count(*) over (partition by DEPTNO) from EMP" final RelNode rel = mockCountOver("EMP", ImmutableList.of("DEPTNO"), ImmutableList.of()); String relJson = RelOptUtil.dumpPlan("", rel, SqlExplainFormat.JSON, @@ -750,7 +750,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testInterval() { + @Test void testInterval() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); SqlIntervalQualifier sqlIntervalQualifier = @@ -776,7 +776,7 @@ public class RelWriterTest { assertThat(s, isLinux(expected)); } - @Test public void testUdf() { + @Test void testUdf() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); final RelNode rel = builder @@ -869,7 +869,7 @@ private RelNode mockCountOver(String table, return rel; } - @Test public void testWriteSortExchangeWithHashDistribution() { + @Test void testWriteSortExchangeWithHashDistribution() { final RelNode root = createSortPlan(RelDistributions.hash(Lists.newArrayList(0))); final RelJsonWriter writer = new RelJsonWriter(); root.explain(writer); @@ -883,7 +883,7 @@ private RelNode mockCountOver(String table, assertThat(s, isLinux(expected)); } - @Test public void testWriteSortExchangeWithRandomDistribution() { + @Test void testWriteSortExchangeWithRandomDistribution() { final RelNode root = createSortPlan(RelDistributions.RANDOM_DISTRIBUTED); final RelJsonWriter writer = new RelJsonWriter(); root.explain(writer); diff --git a/core/src/test/java/org/apache/calcite/plan/volcano/CollationConversionTest.java b/core/src/test/java/org/apache/calcite/plan/volcano/CollationConversionTest.java index a6bba559a3b6..932d59b94f8c 100644 --- a/core/src/test/java/org/apache/calcite/plan/volcano/CollationConversionTest.java +++ b/core/src/test/java/org/apache/calcite/plan/volcano/CollationConversionTest.java @@ -51,7 +51,7 @@ /** * Unit test for {@link org.apache.calcite.rel.RelCollationTraitDef}. */ -public class CollationConversionTest { +class CollationConversionTest { private static final TestRelCollationImpl LEAF_COLLATION = new TestRelCollationImpl( ImmutableList.of(new RelFieldCollation(0, Direction.CLUSTERED))); @@ -62,7 +62,7 @@ public class CollationConversionTest { private static final TestRelCollationTraitDef COLLATION_TRAIT_DEF = new TestRelCollationTraitDef(); - @Test public void testCollationConversion() { + @Test void testCollationConversion() { final VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRelTraitDef(COLLATION_TRAIT_DEF); diff --git a/core/src/test/java/org/apache/calcite/plan/volcano/ComboRuleTest.java b/core/src/test/java/org/apache/calcite/plan/volcano/ComboRuleTest.java index 2f6ae6946549..174f1c6bb092 100644 --- a/core/src/test/java/org/apache/calcite/plan/volcano/ComboRuleTest.java +++ b/core/src/test/java/org/apache/calcite/plan/volcano/ComboRuleTest.java @@ -48,9 +48,9 @@ /** * Unit test for {@link VolcanoPlanner} */ -public class ComboRuleTest { +class ComboRuleTest { - @Test public void testCombo() { + @Test void testCombo() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); diff --git a/core/src/test/java/org/apache/calcite/plan/volcano/TraitConversionTest.java b/core/src/test/java/org/apache/calcite/plan/volcano/TraitConversionTest.java index bca4594585d1..e0d65c817024 100644 --- a/core/src/test/java/org/apache/calcite/plan/volcano/TraitConversionTest.java +++ b/core/src/test/java/org/apache/calcite/plan/volcano/TraitConversionTest.java @@ -44,7 +44,7 @@ /** * Unit test for {@link org.apache.calcite.rel.RelDistributionTraitDef}. */ -public class TraitConversionTest { +class TraitConversionTest { private static final ConvertRelDistributionTraitDef NEW_TRAIT_DEF_INSTANCE = new ConvertRelDistributionTraitDef(); @@ -55,7 +55,7 @@ public class TraitConversionTest { private static final SimpleDistribution SIMPLE_DISTRIBUTION_SINGLETON = new SimpleDistribution("SINGLETON"); - @Test public void testTraitConversion() { + @Test void testTraitConversion() { final VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRelTraitDef(NEW_TRAIT_DEF_INSTANCE); diff --git a/core/src/test/java/org/apache/calcite/plan/volcano/TraitPropagationTest.java b/core/src/test/java/org/apache/calcite/plan/volcano/TraitPropagationTest.java index bb3918cf32b1..b671282fd516 100644 --- a/core/src/test/java/org/apache/calcite/plan/volcano/TraitPropagationTest.java +++ b/core/src/test/java/org/apache/calcite/plan/volcano/TraitPropagationTest.java @@ -86,7 +86,7 @@ /** * Tests that determine whether trait propagation work in Volcano Planner. */ -public class TraitPropagationTest { +class TraitPropagationTest { static final Convention PHYSICAL = new Convention.Impl("PHYSICAL", Phys.class); static final RelCollation COLLATION = @@ -103,7 +103,7 @@ public class TraitPropagationTest { SortRemoveRule.INSTANCE, ExpandConversionRule.INSTANCE); - @Test public void testOne() throws Exception { + @Test void testOne() throws Exception { RelNode planned = run(new PropAction(), RULES); if (CalciteSystemProperty.DEBUG.value()) { System.out.println( diff --git a/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTest.java b/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTest.java index df5762311687..5fae0cd2afad 100644 --- a/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTest.java +++ b/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTest.java @@ -69,16 +69,13 @@ /** * Unit test for {@link VolcanoPlanner the optimizer}. */ -public class VolcanoPlannerTest { - - public VolcanoPlannerTest() { - } +class VolcanoPlannerTest { //~ Methods ---------------------------------------------------------------- /** * Tests transformation of a leaf from NONE to PHYS. */ - @Test public void testTransformLeaf() { + @Test void testTransformLeaf() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -102,7 +99,7 @@ public VolcanoPlannerTest() { /** * Tests transformation of a single+leaf from NONE to PHYS. */ - @Test public void testTransformSingleGood() { + @Test void testTransformSingleGood() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -131,7 +128,7 @@ public VolcanoPlannerTest() { * [CALCITE-3118] * VolcanoRuleCall should look at RelSubset rather than RelSet * when checking child ordinal of a parent operand. */ - @Test public void testMatchedOperandsDifferent() { + @Test void testMatchedOperandsDifferent() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); RelOptCluster cluster = newCluster(planner); @@ -178,7 +175,7 @@ public void onMatch(RelOptRuleCall call) { } } - @Test public void testMultiInputsParentOpMatching() { + @Test void testMultiInputsParentOpMatching() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); RelOptCluster cluster = newCluster(planner); @@ -209,7 +206,7 @@ public void onMatch(RelOptRuleCall call) { * Tests a rule that is fired once per subset (whereas most rules are fired * once per rel in a set or rel in a subset) */ - @Test public void testSubsetRule() { + @Test void testSubsetRule() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRelTraitDef(RelCollationTraitDef.INSTANCE); @@ -261,7 +258,7 @@ private static List sort(E... es) { * this one didn't work due to the definition of ReformedSingleRule. */ @Disabled // broken, because ReformedSingleRule matches child traits strictly - @Test public void testTransformSingleReformed() { + @Test void testTransformSingleReformed() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -337,13 +334,13 @@ public RelNode convert(RelNode rel) { } // NOTE: this used to fail but now works - @Test public void testWithRemoveTrivialProject() { + @Test void testWithRemoveTrivialProject() { removeTrivialProject(true); } // NOTE: this always worked; it's here as contrast to // testWithRemoveTrivialProject() - @Test public void testWithoutRemoveTrivialProject() { + @Test void testWithoutRemoveTrivialProject() { removeTrivialProject(false); } @@ -352,7 +349,7 @@ public RelNode convert(RelNode rel) { * pattern which spans calling conventions. */ @Disabled // broken, because ReformedSingleRule matches child traits strictly - @Test public void testRemoveSingleReformed() { + @Test void testRemoveSingleReformed() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -386,7 +383,7 @@ public RelNode convert(RelNode rel) { * uses a completely-physical pattern (requiring GoodSingleRule to fire * first). */ - @Test public void testRemoveSingleGood() { + @Test void testRemoveSingleGood() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -417,7 +414,7 @@ public RelNode convert(RelNode rel) { } @Disabled("CALCITE-2592 EnumerableMergeJoin is never taken") - @Test public void testMergeJoin() { + @Test void testMergeJoin() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -458,7 +455,7 @@ public RelNode convert(RelNode rel) { * Tests whether planner correctly notifies listeners of events. */ @Disabled - @Test public void testListener() { + @Test void testListener() { TestListener listener = new TestListener(); VolcanoPlanner planner = new VolcanoPlanner(); diff --git a/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTraitTest.java b/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTraitTest.java index 9d07c05823e5..8438ce4cdce7 100644 --- a/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTraitTest.java +++ b/core/src/test/java/org/apache/calcite/plan/volcano/VolcanoPlannerTraitTest.java @@ -57,7 +57,7 @@ /** * Unit test for handling of traits by {@link VolcanoPlanner}. */ -public class VolcanoPlannerTraitTest { +class VolcanoPlannerTraitTest { /** * Private calling convention representing a generic "physical" calling * convention. @@ -97,7 +97,7 @@ public class VolcanoPlannerTraitTest { private static int altTraitOrdinal = 0; @Disabled - @Test public void testDoubleConversion() { + @Test void testDoubleConversion() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -152,7 +152,7 @@ public class VolcanoPlannerTraitTest { assertTrue(child instanceof PhysLeafRel); } - @Test public void testRuleMatchAfterConversion() { + @Test void testRuleMatchAfterConversion() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -185,7 +185,7 @@ public class VolcanoPlannerTraitTest { } @Disabled - @Test public void testTraitPropagation() { + @Test void testTraitPropagation() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -249,7 +249,7 @@ public class VolcanoPlannerTraitTest { assertTrue(child instanceof PhysLeafRel); } - @Test public void testPlanWithNoneConvention() { + @Test void testPlanWithNoneConvention() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); RelOptCluster cluster = newCluster(planner); diff --git a/core/src/test/java/org/apache/calcite/prepare/LookupOperatorOverloadsTest.java b/core/src/test/java/org/apache/calcite/prepare/LookupOperatorOverloadsTest.java index 322c9462f0dd..a8ebf31fcb8d 100644 --- a/core/src/test/java/org/apache/calcite/prepare/LookupOperatorOverloadsTest.java +++ b/core/src/test/java/org/apache/calcite/prepare/LookupOperatorOverloadsTest.java @@ -61,7 +61,7 @@ /** * Test for lookupOperatorOverloads() in {@link CalciteCatalogReader}. */ -public class LookupOperatorOverloadsTest { +class LookupOperatorOverloadsTest { private void checkFunctionType(int size, String name, List operatorList) { @@ -78,7 +78,7 @@ private static void check(List actuals, assertThat(actuals, is(Arrays.asList(expecteds))); } - @Test public void testIsUserDefined() throws SQLException { + @Test void testIsUserDefined() throws SQLException { List cats = new ArrayList<>(); for (SqlFunctionCategory c : SqlFunctionCategory.values()) { if (c.isUserDefined()) { @@ -90,7 +90,7 @@ private static void check(List actuals, USER_DEFINED_TABLE_FUNCTION, USER_DEFINED_TABLE_SPECIFIC_FUNCTION); } - @Test public void testIsTableFunction() throws SQLException { + @Test void testIsTableFunction() throws SQLException { List cats = new ArrayList<>(); for (SqlFunctionCategory c : SqlFunctionCategory.values()) { if (c.isTableFunction()) { @@ -101,7 +101,7 @@ private static void check(List actuals, USER_DEFINED_TABLE_SPECIFIC_FUNCTION, MATCH_RECOGNIZE); } - @Test public void testIsSpecific() throws SQLException { + @Test void testIsSpecific() throws SQLException { List cats = new ArrayList<>(); for (SqlFunctionCategory c : SqlFunctionCategory.values()) { if (c.isSpecific()) { @@ -112,7 +112,7 @@ private static void check(List actuals, USER_DEFINED_TABLE_SPECIFIC_FUNCTION); } - @Test public void testIsUserDefinedNotSpecificFunction() throws SQLException { + @Test void testIsUserDefinedNotSpecificFunction() throws SQLException { List cats = new ArrayList<>(); for (SqlFunctionCategory sqlFunctionCategory : SqlFunctionCategory.values()) { if (sqlFunctionCategory.isUserDefinedNotSpecificFunction()) { @@ -122,11 +122,11 @@ private static void check(List actuals, check(cats, USER_DEFINED_FUNCTION, USER_DEFINED_TABLE_FUNCTION); } - @Test public void testLookupCaseSensitively() throws SQLException { + @Test void testLookupCaseSensitively() throws SQLException { checkInternal(true); } - @Test public void testLookupCaseInSensitively() throws SQLException { + @Test void testLookupCaseInSensitively() throws SQLException { checkInternal(false); } diff --git a/core/src/test/java/org/apache/calcite/profile/ProfilerTest.java b/core/src/test/java/org/apache/calcite/profile/ProfilerTest.java index 37faa5774f77..99085894ad18 100644 --- a/core/src/test/java/org/apache/calcite/profile/ProfilerTest.java +++ b/core/src/test/java/org/apache/calcite/profile/ProfilerTest.java @@ -60,8 +60,8 @@ * Unit tests for {@link Profiler}. */ @Tag("slow") -public class ProfilerTest { - @Test public void testProfileZeroRows() throws Exception { +class ProfilerTest { + @Test void testProfileZeroRows() throws Exception { final String sql = "select * from \"scott\".dept where false"; sql(sql).unordered( "{type:distribution,columns:[DEPTNO,DNAME,LOC],cardinality:0}", @@ -76,7 +76,7 @@ public class ProfilerTest { "{type:unique,columns:[]}"); } - @Test public void testProfileOneRow() throws Exception { + @Test void testProfileOneRow() throws Exception { final String sql = "select * from \"scott\".dept where deptno = 10"; sql(sql).unordered( "{type:distribution,columns:[DEPTNO,DNAME,LOC],cardinality:1}", @@ -91,7 +91,7 @@ public class ProfilerTest { "{type:unique,columns:[]}"); } - @Test public void testProfileTwoRows() throws Exception { + @Test void testProfileTwoRows() throws Exception { final String sql = "select * from \"scott\".dept where deptno in (10, 20)"; sql(sql).unordered( "{type:distribution,columns:[DEPTNO,DNAME,LOC],cardinality:2}", @@ -108,7 +108,7 @@ public class ProfilerTest { "{type:unique,columns:[LOC]}"); } - @Test public void testProfileScott() throws Exception { + @Test void testProfileScott() throws Exception { final String sql = "select * from \"scott\".emp\n" + "join \"scott\".dept on emp.deptno = dept.deptno"; sql(sql) @@ -192,7 +192,7 @@ public class ProfilerTest { /** As {@link #testProfileScott()}, but prints only the most surprising * distributions. */ - @Test public void testProfileScott2() throws Exception { + @Test void testProfileScott2() throws Exception { scott().factory(Fluid.SIMPLE_FACTORY).unordered( "{type:distribution,columns:[COMM],values:[0.00,300.00,500.00,1400.00],cardinality:5,nullCount:10,expectedCardinality:14,surprise:0.474}", "{type:distribution,columns:[DEPTNO,DEPTNO0],cardinality:3,expectedCardinality:7.2698,surprise:0.416}", @@ -218,7 +218,7 @@ public class ProfilerTest { /** As {@link #testProfileScott2()}, but uses the breadth-first profiler. * Results should be the same, but are slightly different (extra EMPNO * and ENAME distributions). */ - @Test public void testProfileScott3() throws Exception { + @Test void testProfileScott3() throws Exception { scott().factory(Fluid.BETTER_FACTORY).unordered( "{type:distribution,columns:[COMM],values:[0.00,300.00,500.00,1400.00],cardinality:5,nullCount:10,expectedCardinality:14,surprise:0.474}", "{type:distribution,columns:[DEPTNO,DEPTNO0,DNAME,LOC],cardinality:3,expectedCardinality:7.2698,surprise:0.416}", @@ -242,7 +242,7 @@ public class ProfilerTest { /** As {@link #testProfileScott3()}, but uses the breadth-first profiler * and deems everything uninteresting. Only first-level combinations (those * consisting of a single column) are computed. */ - @Test public void testProfileScott4() throws Exception { + @Test void testProfileScott4() throws Exception { scott().factory(Fluid.INCURIOUS_PROFILER_FACTORY).unordered( "{type:distribution,columns:[COMM],values:[0.00,300.00,500.00,1400.00],cardinality:5,nullCount:10,expectedCardinality:14,surprise:0.474}", "{type:distribution,columns:[DEPTNO0,DNAME,LOC],cardinality:3,expectedCardinality:14,surprise:0.647}", @@ -261,7 +261,7 @@ public class ProfilerTest { /** As {@link #testProfileScott3()}, but uses the breadth-first profiler. */ @Disabled - @Test public void testProfileScott5() throws Exception { + @Test void testProfileScott5() throws Exception { scott().factory(Fluid.PROFILER_FACTORY).unordered( "{type:distribution,columns:[COMM],values:[0.00,300.00,500.00,1400.00],cardinality:5,nullCount:10,expectedCardinality:14.0,surprise:0.473}", "{type:distribution,columns:[DEPTNO,DEPTNO0,DNAME,LOC],cardinality:3,expectedCardinality:7.269,surprise:0.415}", @@ -285,7 +285,7 @@ public class ProfilerTest { /** Profiles a star-join query on the Foodmart schema using the breadth-first * profiler. */ @Disabled - @Test public void testProfileFoodmart() throws Exception { + @Test void testProfileFoodmart() throws Exception { foodmart().factory(Fluid.PROFILER_FACTORY).unordered( "{type:distribution,columns:[brand_name],cardinality:111,expectedCardinality:86837.0,surprise:0.997}", "{type:distribution,columns:[cases_per_pallet],values:[5,6,7,8,9,10,11,12,13,14],cardinality:10,expectedCardinality:86837.0,surprise:0.999}", @@ -322,7 +322,7 @@ public class ProfilerTest { /** Tests * {@link org.apache.calcite.profile.ProfilerImpl.SurpriseQueue}. */ - @Test public void testSurpriseQueue() { + @Test void testSurpriseQueue() { ProfilerImpl.SurpriseQueue q = new ProfilerImpl.SurpriseQueue(4, 3); assertThat(q.offer(2), is(true)); assertThat(q.toString(), is("min: 2.0, contents: [2.0]")); diff --git a/core/src/test/java/org/apache/calcite/rel/RelCollationTest.java b/core/src/test/java/org/apache/calcite/rel/RelCollationTest.java index 7314c816d006..539890995623 100644 --- a/core/src/test/java/org/apache/calcite/rel/RelCollationTest.java +++ b/core/src/test/java/org/apache/calcite/rel/RelCollationTest.java @@ -29,10 +29,10 @@ /** * Tests for {@link RelCollation} and {@link RelFieldCollation}. */ -public class RelCollationTest { +class RelCollationTest { /** Unit test for {@link RelCollations#contains}. */ @SuppressWarnings("ArraysAsListWithZeroOrOneArgument") - @Test public void testCollationContains() { + @Test void testCollationContains() { final RelCollation collation21 = RelCollations.of( new RelFieldCollation(2, RelFieldCollation.Direction.ASCENDING), @@ -78,7 +78,7 @@ public class RelCollationTest { /** Unit test for * {@link org.apache.calcite.rel.RelCollationImpl#compareTo}. */ - @Test public void testCollationCompare() { + @Test void testCollationCompare() { assertThat(collation(1, 2).compareTo(collation(1, 2)), equalTo(0)); assertThat(collation(1, 2).compareTo(collation(1)), equalTo(1)); assertThat(collation(1).compareTo(collation(1, 2)), equalTo(-1)); diff --git a/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java b/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java index b13c738250b8..911e2d2ae354 100644 --- a/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java +++ b/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java @@ -28,8 +28,8 @@ /** * Tests for {@link RelDistribution}. */ -public class RelDistributionTest { - @Test public void testRelDistributionSatisfy() { +class RelDistributionTest { + @Test void testRelDistributionSatisfy() { RelDistribution distribution1 = RelDistributions.hash(ImmutableList.of(0)); RelDistribution distribution2 = RelDistributions.hash(ImmutableList.of(1)); diff --git a/core/src/test/java/org/apache/calcite/rel/logical/ToLogicalConverterTest.java b/core/src/test/java/org/apache/calcite/rel/logical/ToLogicalConverterTest.java index 720a24453e9c..f4afd7374de8 100644 --- a/core/src/test/java/org/apache/calcite/rel/logical/ToLogicalConverterTest.java +++ b/core/src/test/java/org/apache/calcite/rel/logical/ToLogicalConverterTest.java @@ -54,7 +54,7 @@ /** * Tests for {@link ToLogicalConverter}. */ -public class ToLogicalConverterTest { +class ToLogicalConverterTest { private static final ImmutableSet RULE_SET = ImmutableSet.of( ProjectToWindowRule.PROJECT, @@ -129,7 +129,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical assertThat(logical, hasTree(expectedLogical)); } - @Test public void testValues() { + @Test void testValues() { // Equivalent SQL: // VALUES (true, 1), (false, -50) AS t(a, b) final RelBuilder builder = builder(); @@ -142,7 +142,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical "LogicalValues(tuples=[[{ true, 1 }, { false, -50 }]])\n"); } - @Test public void testScan() { + @Test void testScan() { // Equivalent SQL: // SELECT * // FROM emp @@ -155,7 +155,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical "LogicalTableScan(table=[[scott, EMP]])\n"); } - @Test public void testProject() { + @Test void testProject() { // Equivalent SQL: // SELECT deptno // FROM emp @@ -173,7 +173,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testFilter() { + @Test void testFilter() { // Equivalent SQL: // SELECT * // FROM emp @@ -195,7 +195,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testSort() { + @Test void testSort() { // Equivalent SQL: // SELECT * // FROM emp @@ -214,7 +214,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testLimit() { + @Test void testLimit() { // Equivalent SQL: // SELECT * // FROM emp @@ -233,7 +233,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testSortLimit() { + @Test void testSortLimit() { // Equivalent SQL: // SELECT * // FROM emp @@ -253,7 +253,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testAggregate() { + @Test void testAggregate() { // Equivalent SQL: // SELECT COUNT(empno) AS c // FROM emp @@ -273,7 +273,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testJoin() { + @Test void testJoin() { // Equivalent SQL: // SELECT * // FROM emp @@ -298,7 +298,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testCorrelation() { + @Test void testCorrelation() { final RelBuilder builder = builder(); final Holder v = Holder.of(null); final RelNode rel = builder.scan("EMP") @@ -322,7 +322,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testUnion() { + @Test void testUnion() { // Equivalent SQL: // SELECT deptno FROM emp // UNION ALL @@ -350,7 +350,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testIntersect() { + @Test void testIntersect() { // Equivalent SQL: // SELECT deptno FROM emp // INTERSECT ALL @@ -378,7 +378,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testMinus() { + @Test void testMinus() { // Equivalent SQL: // SELECT deptno FROM emp // EXCEPT ALL @@ -406,7 +406,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel, expectedPhysical, expectedLogical); } - @Test public void testUncollect() { + @Test void testUncollect() { final String sql = "" + "select did\n" + "from unnest(select collect(\"department_id\") as deptid" @@ -425,7 +425,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel(sql), expectedPhysical, expectedLogical); } - @Test public void testWindow() { + @Test void testWindow() { String sql = "SELECT rank() over (order by \"hire_date\") FROM \"employee\""; String expectedPhysical = "" + "EnumerableProject($0=[$17])\n" @@ -439,7 +439,7 @@ private void verify(RelNode rel, String expectedPhysical, String expectedLogical verify(rel(sql), expectedPhysical, expectedLogical); } - @Test public void testTableModify() { + @Test void testTableModify() { final String sql = "insert into \"employee\" select * from \"employee\""; final String expectedPhysial = "" + "JdbcToEnumerableConverter\n" diff --git a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterStructsTest.java b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterStructsTest.java index 9ddfe8b8f12d..8fed7c6d0b92 100644 --- a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterStructsTest.java +++ b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterStructsTest.java @@ -51,7 +51,7 @@ * Tests for {@link RelToSqlConverter} on a schema that has nested structures of multiple * levels. */ -public class RelToSqlConverterStructsTest { +class RelToSqlConverterStructsTest { private static final Schema SCHEMA = new Schema() { @Override public Table getTable(String name) { @@ -185,7 +185,7 @@ private RelToSqlConverterTest.Sql sql(String sql) { RelToSqlConverterTest.DEFAULT_REL_CONFIG, null, ImmutableList.of()); } - @Test public void testNestedSchemaSelectStar() { + @Test void testNestedSchemaSelectStar() { String query = "SELECT * FROM \"myTable\""; String expected = "SELECT \"a\", " + "ROW(ROW(\"n1\".\"n11\".\"b\"), ROW(\"n1\".\"n12\".\"c\")) AS \"n1\", " @@ -195,7 +195,7 @@ private RelToSqlConverterTest.Sql sql(String sql) { sql(query).ok(expected); } - @Test public void testNestedSchemaRootColumns() { + @Test void testNestedSchemaRootColumns() { String query = "SELECT \"a\", \"e\" FROM \"myTable\""; String expected = "SELECT \"a\", " + "\"e\"\n" @@ -203,7 +203,7 @@ private RelToSqlConverterTest.Sql sql(String sql) { sql(query).ok(expected); } - @Test public void testNestedSchemaNestedColumns() { + @Test void testNestedSchemaNestedColumns() { String query = "SELECT \"a\", \"e\", " + "\"myTable\".\"n1\".\"n11\".\"b\", " + "\"myTable\".\"n2\".\"d\" " diff --git a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java index 19d21f528a1c..a7568223fb7d 100644 --- a/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java +++ b/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java @@ -91,7 +91,7 @@ /** * Tests for {@link RelToSqlConverter}. */ -public class RelToSqlConverterTest { +class RelToSqlConverterTest { static final SqlToRelConverter.Config DEFAULT_REL_CONFIG = SqlToRelConverter.configBuilder() .withTrimUnusedFields(false) @@ -193,19 +193,19 @@ private static String toSql(RelNode root, SqlDialect dialect) { return sqlNode.toSqlString(dialect).getSql(); } - @Test public void testSimpleSelectStarFromProductTable() { + @Test void testSimpleSelectStarFromProductTable() { String query = "select * from \"product\""; sql(query).ok("SELECT *\nFROM \"foodmart\".\"product\""); } - @Test public void testSimpleSelectQueryFromProductTable() { + @Test void testSimpleSelectQueryFromProductTable() { String query = "select \"product_id\", \"product_class_id\" from \"product\""; final String expected = "SELECT \"product_id\", \"product_class_id\"\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testSelectQueryWithWhereClauseOfLessThan() { + @Test void testSelectQueryWithWhereClauseOfLessThan() { String query = "select \"product_id\", \"shelf_width\"\n" + "from \"product\" where \"product_id\" < 10"; final String expected = "SELECT \"product_id\", \"shelf_width\"\n" @@ -214,7 +214,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithWhereClauseOfBasicOperators() { + @Test void testSelectQueryWithWhereClauseOfBasicOperators() { String query = "select * from \"product\" " + "where (\"product_id\" = 10 OR \"product_id\" <= 5) " + "AND (80 >= \"shelf_width\" OR \"shelf_width\" > 30)"; @@ -226,7 +226,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { } - @Test public void testSelectQueryWithGroupBy() { + @Test void testSelectQueryWithGroupBy() { String query = "select count(*) from \"product\" group by \"product_class_id\", \"product_id\""; final String expected = "SELECT COUNT(*)\n" + "FROM \"foodmart\".\"product\"\n" @@ -234,7 +234,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithHiveCube() { + @Test void testSelectQueryWithHiveCube() { String query = "select \"product_class_id\", \"product_id\", count(*) " + "from \"product\" group by cube(\"product_class_id\", \"product_id\")"; String expected = "SELECT product_class_id, product_id, COUNT(*)\n" @@ -245,7 +245,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertTrue(sqlDialect.supportsGroupByWithCube()); } - @Test public void testSelectQueryWithHiveRollup() { + @Test void testSelectQueryWithHiveRollup() { String query = "select \"product_class_id\", \"product_id\", count(*) " + "from \"product\" group by rollup(\"product_class_id\", \"product_id\")"; String expected = "SELECT product_class_id, product_id, COUNT(*)\n" @@ -256,7 +256,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertTrue(sqlDialect.supportsGroupByWithRollup()); } - @Test public void testSelectQueryWithGroupByEmpty() { + @Test void testSelectQueryWithGroupByEmpty() { final String sql0 = "select count(*) from \"product\" group by ()"; final String sql1 = "select count(*) from \"product\""; final String expected = "SELECT COUNT(*)\n" @@ -273,7 +273,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expectedMySql); } - @Test public void testSelectQueryWithGroupByEmpty2() { + @Test void testSelectQueryWithGroupByEmpty2() { final String query = "select 42 as c from \"product\" group by ()"; final String expected = "SELECT 42 AS \"C\"\n" + "FROM \"foodmart\".\"product\"\n" @@ -291,7 +291,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3097] * GROUPING SETS breaks on sets of size > 1 due to precedence issues, * in particular, that we maintain proper precedence around nested lists. */ - @Test public void testGroupByGroupingSets() { + @Test void testGroupByGroupingSets() { final String query = "select \"product_class_id\", \"brand_name\"\n" + "from \"product\"\n" + "group by GROUPING SETS ((\"product_class_id\", \"brand_name\")," @@ -309,7 +309,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Tests GROUP BY ROLLUP of two columns. The SQL for MySQL has * "GROUP BY ... ROLLUP" but no "ORDER BY". */ - @Test public void testSelectQueryWithGroupByRollup() { + @Test void testSelectQueryWithGroupByRollup() { final String query = "select \"product_class_id\", \"brand_name\"\n" + "from \"product\"\n" + "group by rollup(\"product_class_id\", \"brand_name\")\n" @@ -335,7 +335,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** As {@link #testSelectQueryWithGroupByRollup()}, * but ORDER BY columns reversed. */ - @Test public void testSelectQueryWithGroupByRollup2() { + @Test void testSelectQueryWithGroupByRollup2() { final String query = "select \"product_class_id\", \"brand_name\"\n" + "from \"product\"\n" + "group by rollup(\"product_class_id\", \"brand_name\")\n" @@ -356,7 +356,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Tests a query with GROUP BY and a sub-query which is also with GROUP BY. * If we flatten sub-queries, the number of rows going into AVG becomes * incorrect. */ - @Test public void testSelectQueryWithGroupBySubQuery1() { + @Test void testSelectQueryWithGroupBySubQuery1() { final String query = "select \"product_class_id\", avg(\"product_id\")\n" + "from (select \"product_class_id\", \"product_id\", avg(\"product_class_id\")\n" + "from \"product\"\n" @@ -372,7 +372,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Tests query without GROUP BY but an aggregate function * and a sub-query which is with GROUP BY. */ - @Test public void testSelectQueryWithGroupBySubQuery2() { + @Test void testSelectQueryWithGroupBySubQuery2() { final String query = "select sum(\"product_id\")\n" + "from (select \"product_class_id\", \"product_id\"\n" + "from \"product\"\n" @@ -402,7 +402,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** CUBE of one column is equivalent to ROLLUP, and Calcite recognizes * this. */ - @Test public void testSelectQueryWithSingletonCube() { + @Test void testSelectQueryWithSingletonCube() { final String query = "select \"product_class_id\", count(*) as c\n" + "from \"product\"\n" + "group by cube(\"product_class_id\")\n" @@ -424,7 +424,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** As {@link #testSelectQueryWithSingletonCube()}, but no ORDER BY * clause. */ - @Test public void testSelectQueryWithSingletonCubeNoOrderBy() { + @Test void testSelectQueryWithSingletonCubeNoOrderBy() { final String query = "select \"product_class_id\", count(*) as c\n" + "from \"product\"\n" + "group by cube(\"product_class_id\")"; @@ -442,7 +442,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Cannot rewrite if ORDER BY contains a column not in GROUP BY (in this * case COUNT(*)). */ - @Test public void testSelectQueryWithRollupOrderByCount() { + @Test void testSelectQueryWithRollupOrderByCount() { final String query = "select \"product_class_id\", \"brand_name\",\n" + " count(*) as c\n" + "from \"product\"\n" @@ -467,7 +467,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { } /** As {@link #testSelectQueryWithSingletonCube()}, but with LIMIT. */ - @Test public void testSelectQueryWithCubeLimit() { + @Test void testSelectQueryWithCubeLimit() { final String query = "select \"product_class_id\", count(*) as c\n" + "from \"product\"\n" + "group by cube(\"product_class_id\")\n" @@ -488,7 +488,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expectedMySql); } - @Test public void testSelectQueryWithMinAggregateFunction() { + @Test void testSelectQueryWithMinAggregateFunction() { String query = "select min(\"net_weight\") from \"product\" group by \"product_class_id\" "; final String expected = "SELECT MIN(\"net_weight\")\n" + "FROM \"foodmart\".\"product\"\n" @@ -496,7 +496,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithMinAggregateFunction1() { + @Test void testSelectQueryWithMinAggregateFunction1() { String query = "select \"product_class_id\", min(\"net_weight\") from" + " \"product\" group by \"product_class_id\""; final String expected = "SELECT \"product_class_id\", MIN(\"net_weight\")\n" @@ -505,7 +505,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithSumAggregateFunction() { + @Test void testSelectQueryWithSumAggregateFunction() { String query = "select sum(\"net_weight\") from \"product\" group by \"product_class_id\" "; final String expected = "SELECT SUM(\"net_weight\")\n" @@ -514,7 +514,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithMultipleAggregateFunction() { + @Test void testSelectQueryWithMultipleAggregateFunction() { String query = "select sum(\"net_weight\"), min(\"low_fat\"), count(*)" + " from \"product\" group by \"product_class_id\" "; final String expected = "SELECT SUM(\"net_weight\"), MIN(\"low_fat\")," @@ -524,7 +524,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithMultipleAggregateFunction1() { + @Test void testSelectQueryWithMultipleAggregateFunction1() { String query = "select \"product_class_id\"," + " sum(\"net_weight\"), min(\"low_fat\"), count(*)" + " from \"product\" group by \"product_class_id\" "; @@ -535,7 +535,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithGroupByAndProjectList() { + @Test void testSelectQueryWithGroupByAndProjectList() { String query = "select \"product_class_id\", \"product_id\", count(*) " + "from \"product\" group by \"product_class_id\", \"product_id\" "; final String expected = "SELECT \"product_class_id\", \"product_id\"," @@ -545,7 +545,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testCastDecimal1() { + @Test void testCastDecimal1() { final String query = "select -0.0000000123\n" + " from \"expense_fact\""; final String expected = "SELECT -1.23E-8\n" @@ -557,7 +557,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-2713] * JDBC adapter may generate casts on PostgreSQL for VARCHAR type exceeding * max length. */ - @Test public void testCastLongVarchar1() { + @Test void testCastLongVarchar1() { final String query = "select cast(\"store_id\" as VARCHAR(10485761))\n" + " from \"expense_fact\""; final String expectedPostgreSQL = "SELECT CAST(\"store_id\" AS VARCHAR(256))\n" @@ -577,7 +577,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-2713] * JDBC adapter may generate casts on PostgreSQL for VARCHAR type exceeding * max length. */ - @Test public void testCastLongVarchar2() { + @Test void testCastLongVarchar2() { final String query = "select cast(\"store_id\" as VARCHAR(175))\n" + " from \"expense_fact\""; final String expectedPostgreSQL = "SELECT CAST(\"store_id\" AS VARCHAR(175))\n" @@ -596,7 +596,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1174] * When generating SQL, translate SUM0(x) to COALESCE(SUM(x), 0). */ - @Test public void testSum0BecomesCoalesce() { + @Test void testSum0BecomesCoalesce() { final Function fn = b -> b.scan("EMP") .aggregate(b.groupKey(), b.aggregateCall(SqlStdOperatorTable.SUM0, b.field(3)) @@ -614,7 +614,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { } /** As {@link #testSum0BecomesCoalesce()} but for windowed aggregates. */ - @Test public void testWindowedSum0BecomesCoalesce() { + @Test void testWindowedSum0BecomesCoalesce() { final String query = "select\n" + " AVG(\"net_weight\") OVER (order by \"product_id\" rows 3 preceding)\n" + "from \"foodmart\".\"product\""; @@ -633,7 +633,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-2722] * SqlImplementor createLeftCall method throws StackOverflowError. */ - @Test public void testStack() { + @Test void testStack() { final Function relFn = b -> b .scan("EMP") .filter( @@ -651,7 +651,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(sqlString, notNullValue()); } - @Test public void testAntiJoin() { + @Test void testAntiJoin() { final RelBuilder builder = relBuilder(); final RelNode root = builder .scan("DEPT") @@ -670,7 +670,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(toSql(root), isLinux(expectedSql)); } - @Test public void testSemiJoin() { + @Test void testSemiJoin() { final RelBuilder builder = relBuilder(); final RelNode root = builder .scan("DEPT") @@ -689,7 +689,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(toSql(root), isLinux(expectedSql)); } - @Test public void testSemiJoinFilter() { + @Test void testSemiJoinFilter() { final RelBuilder builder = relBuilder(); final RelNode root = builder .scan("DEPT") @@ -714,7 +714,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(toSql(root), isLinux(expectedSql)); } - @Test public void testSemiJoinProject() { + @Test void testSemiJoinProject() { final RelBuilder builder = relBuilder(); final RelNode root = builder .scan("DEPT") @@ -737,7 +737,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(toSql(root), isLinux(expectedSql)); } - @Test public void testSemiNestedJoin() { + @Test void testSemiNestedJoin() { final RelBuilder builder = relBuilder(); final RelNode base = builder .scan("EMP") @@ -768,7 +768,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-2792] * Stackoverflow while evaluating filter with large number of OR conditions. */ - @Test public void testBalancedBinaryCall() { + @Test void testBalancedBinaryCall() { final Function relFn = b -> b .scan("EMP") .filter( @@ -791,7 +791,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-1946] * JDBC adapter should generate sub-SELECT if dialect does not support nested * aggregate functions. */ - @Test public void testNestedAggregates() { + @Test void testNestedAggregates() { // PostgreSQL, MySQL, Vertica do not support nested aggregate functions, so // for these, the JDBC adapter generates a SELECT in the FROM clause. // Oracle can do it in a single SELECT. @@ -849,7 +849,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * performs some extra checks, looking for aggregates in the input * sub-query, and these would fail with {@code NullPointerException} * and {@code ClassCastException} in some cases. */ - @Test public void testNestedAggregatesMySqlTable() { + @Test void testNestedAggregatesMySqlTable() { final Function relFn = b -> b .scan("EMP") .aggregate(b.groupKey(), @@ -862,7 +862,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** As {@link #testNestedAggregatesMySqlTable()}, but input is a sub-query, * not a table. */ - @Test public void testNestedAggregatesMySqlStar() { + @Test void testNestedAggregatesMySqlStar() { final Function relFn = b -> b .scan("EMP") .filter(b.equals(b.field("DEPTNO"), b.literal(10))) @@ -879,7 +879,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3207] * Fail to convert Join RelNode with like condition to sql statement . */ - @Test public void testJoinWithLikeConditionRel2Sql() { + @Test void testJoinWithLikeConditionRel2Sql() { final Function relFn = b -> b .scan("EMP") .scan("DEPT") @@ -900,7 +900,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { relFn(relFn).ok(expectedSql); } - @Test public void testSelectQueryWithGroupByAndProjectList1() { + @Test void testSelectQueryWithGroupByAndProjectList1() { String query = "select count(*) from \"product\"\n" + "group by \"product_class_id\", \"product_id\""; @@ -910,7 +910,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithGroupByHaving() { + @Test void testSelectQueryWithGroupByHaving() { String query = "select count(*) from \"product\" group by \"product_class_id\"," + " \"product_id\" having \"product_id\" > 10"; final String expected = "SELECT COUNT(*)\n" @@ -923,7 +923,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1665] * Aggregates and having cannot be combined. */ - @Test public void testSelectQueryWithGroupByHaving2() { + @Test void testSelectQueryWithGroupByHaving2() { String query = " select \"product\".\"product_id\",\n" + " min(\"sales_fact_1997\".\"store_id\")\n" + " from \"product\"\n" @@ -945,7 +945,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1665] * Aggregates and having cannot be combined. */ - @Test public void testSelectQueryWithGroupByHaving3() { + @Test void testSelectQueryWithGroupByHaving3() { String query = " select * from (select \"product\".\"product_id\",\n" + " min(\"sales_fact_1997\".\"store_id\")\n" + " from \"product\"\n" @@ -969,7 +969,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3811] * JDBC adapter generates SQL with invalid field names if Filter's row type * is different from its input. */ - @Test public void testHavingAlias() { + @Test void testHavingAlias() { final RelBuilder builder = relBuilder(); builder.scan("EMP") .project(builder.alias(builder.field("DEPTNO"), "D")) @@ -1012,7 +1012,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(sql, isLinux(expectedSql)); } - @Test public void testHaving4() { + @Test void testHaving4() { final String query = "select \"product_id\"\n" + "from (\n" + " select \"product_id\", avg(\"gross_weight\") as agw\n" @@ -1033,7 +1033,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithOrderByClause() { + @Test void testSelectQueryWithOrderByClause() { String query = "select \"product_id\" from \"product\"\n" + "order by \"net_weight\""; final String expected = "SELECT \"product_id\", \"net_weight\"\n" @@ -1042,7 +1042,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithOrderByClause1() { + @Test void testSelectQueryWithOrderByClause1() { String query = "select \"product_id\", \"net_weight\" from \"product\" order by \"net_weight\""; final String expected = "SELECT \"product_id\", \"net_weight\"\n" @@ -1051,7 +1051,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithTwoOrderByClause() { + @Test void testSelectQueryWithTwoOrderByClause() { String query = "select \"product_id\" from \"product\"\n" + "order by \"net_weight\", \"gross_weight\""; final String expected = "SELECT \"product_id\", \"net_weight\"," @@ -1061,7 +1061,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithAscDescOrderByClause() { + @Test void testSelectQueryWithAscDescOrderByClause() { String query = "select \"product_id\" from \"product\" " + "order by \"net_weight\" asc, \"gross_weight\" desc, \"low_fat\""; final String expected = "SELECT" @@ -1074,7 +1074,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-3440] * RelToSqlConverter does not properly alias ambiguous ORDER BY. */ - @Test public void testOrderByColumnWithSameNameAsAlias() { + @Test void testOrderByColumnWithSameNameAsAlias() { String query = "select \"product_id\" as \"p\",\n" + " \"net_weight\" as \"product_id\"\n" + "from \"product\"\n" @@ -1086,7 +1086,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testOrderByColumnWithSameNameAsAlias2() { + @Test void testOrderByColumnWithSameNameAsAlias2() { // We use ordinal "2" because the column name "product_id" is obscured // by alias "product_id". String query = "select \"net_weight\" as \"product_id\",\n" @@ -1105,7 +1105,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .withMysql().ok(expectedMysql); } - @Test public void testHiveSelectCharset() { + @Test void testHiveSelectCharset() { String query = "select \"hire_date\", cast(\"hire_date\" as varchar(10)) " + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT hire_date, CAST(hire_date AS VARCHAR(10))\n" @@ -1117,7 +1117,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3282] * HiveSqlDialect unparse Interger type as Int in order * to be compatible with Hive1.x. */ - @Test public void testHiveCastAsInt() { + @Test void testHiveCastAsInt() { String query = "select cast( cast(\"employee_id\" as varchar) as int) " + "from \"foodmart\".\"reserve_employee\" "; final String expected = "SELECT CAST(CAST(employee_id AS VARCHAR) AS INT)\n" @@ -1125,7 +1125,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withHive().ok(expected); } - @Test public void testBigQueryCast() { + @Test void testBigQueryCast() { String query = "select cast(cast(\"employee_id\" as varchar) as bigint), " + "cast(cast(\"employee_id\" as varchar) as smallint), " + "cast(cast(\"employee_id\" as varchar) as tinyint), " @@ -1168,7 +1168,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3771] * Support of TRIM function for SPARK dialect and improvement in HIVE * Dialect. */ - @Test public void testHiveSparkAndBqTrim() { + @Test void testHiveSparkAndBqTrim() { final String query = "SELECT TRIM(' str ')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT TRIM(' str ')\n" @@ -1182,7 +1182,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testHiveSparkAndBqTrimWithBoth() { + @Test void testHiveSparkAndBqTrimWithBoth() { final String query = "SELECT TRIM(both ' ' from ' str ')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT TRIM(' str ')\n" @@ -1196,7 +1196,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testHiveSparkAndBqTrimWithLeading() { + @Test void testHiveSparkAndBqTrimWithLeading() { final String query = "SELECT TRIM(LEADING ' ' from ' str ')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT LTRIM(' str ')\n" @@ -1211,7 +1211,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { } - @Test public void testHiveSparkAndBqTrimWithTailing() { + @Test void testHiveSparkAndBqTrimWithTailing() { final String query = "SELECT TRIM(TRAILING ' ' from ' str ')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT RTRIM(' str ')\n" @@ -1229,7 +1229,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3663] * Support for TRIM function in Bigquery dialect. */ - @Test public void testBqTrimWithLeadingChar() { + @Test void testBqTrimWithLeadingChar() { final String query = "SELECT TRIM(LEADING 'a' from 'abcd')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT LTRIM('abcd', 'a')\n" @@ -1245,7 +1245,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-3771] * Support of TRIM function for SPARK dialect and improvement in HIVE Dialect. */ - @Test public void testHiveAndSparkTrimWithLeadingChar() { + @Test void testHiveAndSparkTrimWithLeadingChar() { final String query = "SELECT TRIM(LEADING 'a' from 'abcd')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT REGEXP_REPLACE('abcd', '^(a)*', '')\n" @@ -1257,7 +1257,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testBqTrimWithBothChar() { + @Test void testBqTrimWithBothChar() { final String query = "SELECT TRIM(both 'a' from 'abcda')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT TRIM('abcda', 'a')\n" @@ -1267,7 +1267,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testHiveAndSparkTrimWithBothChar() { + @Test void testHiveAndSparkTrimWithBothChar() { final String query = "SELECT TRIM(both 'a' from 'abcda')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT REGEXP_REPLACE('abcda', '^(a)*|(a)*$', '')\n" @@ -1279,7 +1279,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testHiveBqTrimWithTailingChar() { + @Test void testHiveBqTrimWithTailingChar() { final String query = "SELECT TRIM(TRAILING 'a' from 'abcd')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT RTRIM('abcd', 'a')\n" @@ -1289,7 +1289,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testHiveAndSparkTrimWithTailingChar() { + @Test void testHiveAndSparkTrimWithTailingChar() { final String query = "SELECT TRIM(TRAILING 'a' from 'abcd')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT REGEXP_REPLACE('abcd', '(a)*$', '')\n" @@ -1301,7 +1301,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testBqTrimWithBothSpecialCharacter() { + @Test void testBqTrimWithBothSpecialCharacter() { final String query = "SELECT TRIM(BOTH '$@*A' from '$@*AABC$@*AADCAA$@*A')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT TRIM('$@*AABC$@*AADCAA$@*A', '$@*A')\n" @@ -1311,7 +1311,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .ok(expected); } - @Test public void testHiveAndSparkTrimWithBothSpecialCharacter() { + @Test void testHiveAndSparkTrimWithBothSpecialCharacter() { final String query = "SELECT TRIM(BOTH '$@*A' from '$@*AABC$@*AADCAA$@*A')\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT REGEXP_REPLACE('$@*AABC$@*AADCAA$@*A'," @@ -1327,7 +1327,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-2715] * MS SQL Server does not support character set as part of data type. */ - @Test public void testMssqlCharacterSet() { + @Test void testMssqlCharacterSet() { String query = "select \"hire_date\", cast(\"hire_date\" as varchar(10))\n" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT [hire_date], CAST([hire_date] AS VARCHAR(10))\n" @@ -1341,7 +1341,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { *

This cannot be tested using "sql", because because Calcite's SQL parser * replaces INs with ORs or sub-queries. */ - @Test public void testUnparseIn1() { + @Test void testUnparseIn1() { final Function relFn = b -> b.scan("EMP") .filter( @@ -1354,7 +1354,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { relFn(relFn).ok(expectedSql); } - @Test public void testUnparseIn2() { + @Test void testUnparseIn2() { final Function relFn = b -> b .scan("EMP") .filter( @@ -1367,7 +1367,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { relFn(relFn).ok(expectedSql); } - @Test public void testUnparseInStruct1() { + @Test void testUnparseInStruct1() { final Function relFn = b -> b.scan("EMP") .filter( @@ -1383,7 +1383,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { relFn(relFn).ok(expectedSql); } - @Test public void testUnparseInStruct2() { + @Test void testUnparseInStruct2() { final Function relFn = b -> b.scan("EMP") .filter( @@ -1401,7 +1401,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { relFn(relFn).ok(expectedSql); } - @Test public void testSelectQueryWithLimitClause() { + @Test void testSelectQueryWithLimitClause() { String query = "select \"product_id\" from \"product\" limit 100 offset 10"; final String expected = "SELECT product_id\n" + "FROM foodmart.product\n" @@ -1409,14 +1409,14 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withHive().ok(expected); } - @Test public void testPositionFunctionForHive() { + @Test void testPositionFunctionForHive() { final String query = "select position('A' IN 'ABC') from \"product\""; final String expected = "SELECT INSTR('ABC', 'A')\n" + "FROM foodmart.product"; sql(query).withHive().ok(expected); } - @Test public void testPositionFunctionForBigQuery() { + @Test void testPositionFunctionForBigQuery() { final String query = "select position('A' IN 'ABC') from \"product\""; final String expected = "SELECT STRPOS('ABC', 'A')\n" + "FROM foodmart.product"; @@ -1425,7 +1425,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Tests that we escape single-quotes in character literals using back-slash * in BigQuery. The norm is to escape single-quotes with single-quotes. */ - @Test public void testCharLiteralForBigQuery() { + @Test void testCharLiteralForBigQuery() { final String query = "select 'that''s all folks!' from \"product\""; final String expectedPostgresql = "SELECT 'that''s all folks!'\n" + "FROM \"foodmart\".\"product\""; @@ -1436,7 +1436,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .withBigQuery().ok(expectedBigQuery); } - @Test public void testIdentifier() { + @Test void testIdentifier() { // Note that IGNORE is reserved in BigQuery but not in standard SQL final String query = "select *\n" + "from (\n" @@ -1467,14 +1467,14 @@ private static String toSql(RelNode root, SqlDialect dialect) { .withPostgresql().ok(expectedPostgresql); } - @Test public void testModFunctionForHive() { + @Test void testModFunctionForHive() { final String query = "select mod(11,3) from \"product\""; final String expected = "SELECT 11 % 3\n" + "FROM foodmart.product"; sql(query).withHive().ok(expected); } - @Test public void testUnionOperatorForBigQuery() { + @Test void testUnionOperatorForBigQuery() { final String query = "select mod(11,3) from \"product\"\n" + "UNION select 1 from \"product\""; final String expected = "SELECT MOD(11, 3)\n" @@ -1485,7 +1485,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withBigQuery().ok(expected); } - @Test public void testUnionAllOperatorForBigQuery() { + @Test void testUnionAllOperatorForBigQuery() { final String query = "select mod(11,3) from \"product\"\n" + "UNION ALL select 1 from \"product\""; final String expected = "SELECT MOD(11, 3)\n" @@ -1496,7 +1496,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withBigQuery().ok(expected); } - @Test public void testIntersectOperatorForBigQuery() { + @Test void testIntersectOperatorForBigQuery() { final String query = "select mod(11,3) from \"product\"\n" + "INTERSECT select 1 from \"product\""; final String expected = "SELECT MOD(11, 3)\n" @@ -1507,7 +1507,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withBigQuery().ok(expected); } - @Test public void testExceptOperatorForBigQuery() { + @Test void testExceptOperatorForBigQuery() { final String query = "select mod(11,3) from \"product\"\n" + "EXCEPT select 1 from \"product\""; final String expected = "SELECT MOD(11, 3)\n" @@ -1518,7 +1518,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withBigQuery().ok(expected); } - @Test public void testSelectOrderByDescNullsFirst() { + @Test void testSelectOrderByDescNullsFirst() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; // Hive and MSSQL do not support NULLS FIRST, so need to emulate @@ -1533,7 +1533,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected); } - @Test public void testSelectOrderByAscNullsLast() { + @Test void testSelectOrderByAscNullsLast() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; // Hive and MSSQL do not support NULLS LAST, so need to emulate @@ -1548,7 +1548,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected); } - @Test public void testSelectOrderByAscNullsFirst() { + @Test void testSelectOrderByAscNullsFirst() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; // Hive and MSSQL do not support NULLS FIRST, but nulls sort low, so no @@ -1564,7 +1564,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected); } - @Test public void testSelectOrderByDescNullsLast() { + @Test void testSelectOrderByDescNullsLast() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; // Hive and MSSQL do not support NULLS LAST, but nulls sort low, so no @@ -1580,7 +1580,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .dialect(MssqlSqlDialect.DEFAULT).ok(mssqlExpected); } - @Test public void testHiveSelectQueryWithOverDescAndNullsFirstShouldBeEmulated() { + @Test void testHiveSelectQueryWithOverDescAndNullsFirstShouldBeEmulated() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" desc nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -1589,7 +1589,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(HiveSqlDialect.DEFAULT).ok(expected); } - @Test public void testHiveSelectQueryWithOverAscAndNullsLastShouldBeEmulated() { + @Test void testHiveSelectQueryWithOverAscAndNullsLastShouldBeEmulated() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY hire_date IS NULL, hire_date)\n" @@ -1597,7 +1597,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(HiveSqlDialect.DEFAULT).ok(expected); } - @Test public void testHiveSelectQueryWithOverAscNullsFirstShouldNotAddNullEmulation() { + @Test void testHiveSelectQueryWithOverAscNullsFirstShouldNotAddNullEmulation() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY hire_date)\n" @@ -1605,7 +1605,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(HiveSqlDialect.DEFAULT).ok(expected); } - @Test public void testHiveSubstring() { + @Test void testHiveSubstring() { String query = "SELECT SUBSTRING('ABC', 2)" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT SUBSTRING('ABC', 2)\n" @@ -1613,7 +1613,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withHive().ok(expected); } - @Test public void testHiveSubstringWithLength() { + @Test void testHiveSubstringWithLength() { String query = "SELECT SUBSTRING('ABC', 2, 3)" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT SUBSTRING('ABC', 2, 3)\n" @@ -1621,7 +1621,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withHive().ok(expected); } - @Test public void testHiveSubstringWithANSI() { + @Test void testHiveSubstringWithANSI() { String query = "SELECT SUBSTRING('ABC' FROM 2)" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT SUBSTRING('ABC', 2)\n" @@ -1629,7 +1629,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withHive().ok(expected); } - @Test public void testHiveSubstringWithANSIAndLength() { + @Test void testHiveSubstringWithANSIAndLength() { String query = "SELECT SUBSTRING('ABC' FROM 2 FOR 3)" + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT SUBSTRING('ABC', 2, 3)\n" @@ -1637,7 +1637,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withHive().ok(expected); } - @Test public void testHiveSelectQueryWithOverDescNullsLastShouldNotAddNullEmulation() { + @Test void testHiveSelectQueryWithOverDescNullsLastShouldNotAddNullEmulation() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" desc nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY hire_date DESC)\n" @@ -1645,7 +1645,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(HiveSqlDialect.DEFAULT).ok(expected); } - @Test public void testMysqlCastToBigint() { + @Test void testMysqlCastToBigint() { // MySQL does not allow cast to BIGINT; instead cast to SIGNED. final String query = "select cast(\"product_id\" as bigint) from \"product\""; final String expected = "SELECT CAST(`product_id` AS SIGNED)\n" @@ -1654,7 +1654,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { } - @Test public void testMysqlCastToInteger() { + @Test void testMysqlCastToInteger() { // MySQL does not allow cast to INTEGER; instead cast to SIGNED. final String query = "select \"employee_id\",\n" + " cast(\"salary_paid\" * 10000 as integer)\n" @@ -1665,7 +1665,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withMysql().ok(expected); } - @Test public void testHiveSelectQueryWithOrderByDescAndHighNullsWithVersionGreaterThanOrEq21() { + @Test void testHiveSelectQueryWithOrderByDescAndHighNullsWithVersionGreaterThanOrEq21() { final HiveSqlDialect hive2_1Dialect = new HiveSqlDialect(HiveSqlDialect.DEFAULT_CONTEXT .withDatabaseMajorVersion(2) @@ -1687,7 +1687,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(hive2_2_Dialect).ok(expected); } - @Test public void testHiveSelectQueryWithOverDescAndHighNullsWithVersionGreaterThanOrEq21() { + @Test void testHiveSelectQueryWithOverDescAndHighNullsWithVersionGreaterThanOrEq21() { final HiveSqlDialect hive2_1Dialect = new HiveSqlDialect(SqlDialect.EMPTY_CONTEXT .withDatabaseMajorVersion(2) @@ -1708,7 +1708,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(hive2_2_Dialect).ok(expected); } - @Test public void testHiveSelectQueryWithOrderByDescAndHighNullsWithVersion20() { + @Test void testHiveSelectQueryWithOrderByDescAndHighNullsWithVersion20() { final HiveSqlDialect hive2_1_0_Dialect = new HiveSqlDialect(HiveSqlDialect.DEFAULT_CONTEXT .withDatabaseMajorVersion(2) @@ -1722,7 +1722,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(hive2_1_0_Dialect).ok(expected); } - @Test public void testHiveSelectQueryWithOverDescAndHighNullsWithVersion20() { + @Test void testHiveSelectQueryWithOverDescAndHighNullsWithVersion20() { final HiveSqlDialect hive2_1_0_Dialect = new HiveSqlDialect(SqlDialect.EMPTY_CONTEXT .withDatabaseMajorVersion(2) @@ -1736,7 +1736,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(hive2_1_0_Dialect).ok(expected); } - @Test public void testJethroDataSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated() { + @Test void testJethroDataSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; @@ -1746,7 +1746,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(jethroDataSqlDialect()).ok(expected); } - @Test public void testJethroDataSelectQueryWithOverDescAndNullsFirstShouldBeEmulated() { + @Test void testJethroDataSelectQueryWithOverDescAndNullsFirstShouldBeEmulated() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" desc nulls first) FROM \"employee\""; @@ -1756,7 +1756,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(jethroDataSqlDialect()).ok(expected); } - @Test public void testMySqlSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated() { + @Test void testMySqlSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" @@ -1765,7 +1765,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOverDescAndNullsFirstShouldBeEmulated() { + @Test void testMySqlSelectQueryWithOverDescAndNullsFirstShouldBeEmulated() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" desc nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER " @@ -1774,7 +1774,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOrderByAscAndNullsLastShouldBeEmulated() { + @Test void testMySqlSelectQueryWithOrderByAscAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" @@ -1783,7 +1783,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOverAscAndNullsLastShouldBeEmulated() { + @Test void testMySqlSelectQueryWithOverAscAndNullsLastShouldBeEmulated() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER " @@ -1792,7 +1792,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOrderByAscNullsFirstShouldNotAddNullEmulation() { + @Test void testMySqlSelectQueryWithOrderByAscNullsFirstShouldNotAddNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" @@ -1801,7 +1801,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOverAscNullsFirstShouldNotAddNullEmulation() { + @Test void testMySqlSelectQueryWithOverAscNullsFirstShouldNotAddNullEmulation() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date`)\n" @@ -1809,7 +1809,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOrderByDescNullsLastShouldNotAddNullEmulation() { + @Test void testMySqlSelectQueryWithOrderByDescNullsLastShouldNotAddNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" @@ -1818,7 +1818,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlSelectQueryWithOverDescNullsLastShouldNotAddNullEmulation() { + @Test void testMySqlSelectQueryWithOverDescNullsLastShouldNotAddNullEmulation() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date` DESC)\n" @@ -1826,7 +1826,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected); } - @Test public void testMySqlCastToVarcharWithLessThanMaxPrecision() { + @Test void testMySqlCastToVarcharWithLessThanMaxPrecision() { final String query = "select cast(\"product_id\" as varchar(50)), \"product_id\" " + "from \"product\" "; final String expected = "SELECT CAST(`product_id` AS CHAR(50)), `product_id`\n" @@ -1834,7 +1834,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withMysql().ok(expected); } - @Test public void testMySqlCastToVarcharWithGreaterThanMaxPrecision() { + @Test void testMySqlCastToVarcharWithGreaterThanMaxPrecision() { final String query = "select cast(\"product_id\" as varchar(500)), \"product_id\" " + "from \"product\" "; final String expected = "SELECT CAST(`product_id` AS CHAR(255)), `product_id`\n" @@ -1842,7 +1842,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withMysql().ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOrderByAscNullsLastAndNoEmulation() { + @Test void testMySqlWithHighNullsSelectWithOrderByAscNullsLastAndNoEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" @@ -1851,7 +1851,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOverAscNullsLastAndNoEmulation() { + @Test void testMySqlWithHighNullsSelectWithOverAscNullsLastAndNoEmulation() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date`)\n" @@ -1859,7 +1859,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOrderByAscNullsFirstAndNullEmulation() { + @Test void testMySqlWithHighNullsSelectWithOrderByAscNullsFirstAndNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" @@ -1868,7 +1868,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOverAscNullsFirstAndNullEmulation() { + @Test void testMySqlWithHighNullsSelectWithOverAscNullsFirstAndNullEmulation() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -1877,7 +1877,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOrderByDescNullsFirstAndNoEmulation() { + @Test void testMySqlWithHighNullsSelectWithOrderByDescNullsFirstAndNoEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" @@ -1886,7 +1886,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOverDescNullsFirstAndNoEmulation() { + @Test void testMySqlWithHighNullsSelectWithOverDescNullsFirstAndNoEmulation() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date` DESC)\n" @@ -1894,7 +1894,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOrderByDescNullsLastAndNullEmulation() { + @Test void testMySqlWithHighNullsSelectWithOrderByDescNullsLastAndNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" @@ -1903,7 +1903,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithHighNullsSelectWithOverDescNullsLastAndNullEmulation() { + @Test void testMySqlWithHighNullsSelectWithOverDescNullsLastAndNullEmulation() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -1912,7 +1912,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsFirstShouldNotBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsFirstShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" @@ -1921,7 +1921,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOverDescAndNullsFirstShouldNotBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOverDescAndNullsFirstShouldNotBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date` DESC)\n" @@ -1929,7 +1929,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsFirstShouldNotBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsFirstShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" @@ -1938,7 +1938,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOverAscAndNullsFirstShouldNotBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOverAscAndNullsFirstShouldNotBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date`)\n" @@ -1946,7 +1946,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsLastShouldBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" @@ -1955,7 +1955,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOverDescAndNullsLastShouldBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOverDescAndNullsLastShouldBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -1964,7 +1964,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsLastShouldBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" @@ -1973,7 +1973,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithFirstNullsSelectWithOverAscAndNullsLastShouldBeEmulated() { + @Test void testMySqlWithFirstNullsSelectWithOverAscAndNullsLastShouldBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -1982,7 +1982,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsFirstShouldBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOrderByDescAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" @@ -1991,7 +1991,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOverDescAndNullsFirstShouldBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOverDescAndNullsFirstShouldBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -2000,7 +2000,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsFirstShouldBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOrderByAscAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" @@ -2009,7 +2009,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOverAscAndNullsFirstShouldBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOverAscAndNullsFirstShouldBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" nulls first) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() " @@ -2018,7 +2018,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsLastShouldNotBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOrderByDescAndNullsLastShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" @@ -2027,7 +2027,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOverDescAndNullsLastShouldNotBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOverDescAndNullsLastShouldNotBeEmulated() { final String query = "SELECT row_number() " + "over (order by \"hire_date\" desc nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date` DESC)\n" @@ -2035,7 +2035,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsLastShouldNotBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOrderByAscAndNullsLastShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" @@ -2044,7 +2044,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testMySqlWithLastNullsSelectWithOverAscAndNullsLastShouldNotBeEmulated() { + @Test void testMySqlWithLastNullsSelectWithOverAscAndNullsLastShouldNotBeEmulated() { final String query = "SELECT row_number() over " + "(order by \"hire_date\" nulls last) FROM \"employee\""; final String expected = "SELECT ROW_NUMBER() OVER (ORDER BY `hire_date`)\n" @@ -2052,7 +2052,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); } - @Test public void testSelectQueryWithLimitClauseWithoutOrder() { + @Test void testSelectQueryWithLimitClauseWithoutOrder() { String query = "select \"product_id\" from \"product\" limit 100 offset 10"; final String expected = "SELECT \"product_id\"\n" + "FROM \"foodmart\".\"product\"\n" @@ -2061,7 +2061,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithLimitOffsetClause() { + @Test void testSelectQueryWithLimitOffsetClause() { String query = "select \"product_id\" from \"product\"\n" + "order by \"net_weight\" asc limit 100 offset 10"; final String expected = "SELECT \"product_id\", \"net_weight\"\n" @@ -2079,7 +2079,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .withBigQuery().ok(expectedBigQuery); } - @Test public void testSelectQueryWithParameters() { + @Test void testSelectQueryWithParameters() { String query = "select * from \"product\" " + "where \"product_id\" = ? " + "AND ? >= \"shelf_width\""; @@ -2090,7 +2090,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithFetchOffsetClause() { + @Test void testSelectQueryWithFetchOffsetClause() { String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" offset 10 rows fetch next 100 rows only"; final String expected = "SELECT \"product_id\"\n" @@ -2101,7 +2101,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithFetchClause() { + @Test void testSelectQueryWithFetchClause() { String query = "select \"product_id\"\n" + "from \"product\"\n" + "order by \"product_id\" fetch next 100 rows only"; @@ -2126,7 +2126,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { .withSybase().ok(expectedSybase); } - @Test public void testSelectQueryComplex() { + @Test void testSelectQueryComplex() { String query = "select count(*), \"units_per_case\" from \"product\" where \"cases_per_pallet\" > 100 " + "group by \"product_id\", \"units_per_case\" order by \"units_per_case\" desc"; @@ -2138,7 +2138,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSelectQueryWithGroup() { + @Test void testSelectQueryWithGroup() { String query = "select" + " count(*), sum(\"employee_id\") from \"reserve_employee\" " + "where \"hire_date\" > '2015-01-01' " @@ -2152,7 +2152,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSimpleJoin() { + @Test void testSimpleJoin() { String query = "select *\n" + "from \"sales_fact_1997\" as s\n" + "join \"customer\" as c on s.\"customer_id\" = c.\"customer_id\"\n" @@ -2176,7 +2176,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSimpleJoinUsing() { + @Test void testSimpleJoinUsing() { String query = "select *\n" + "from \"sales_fact_1997\" as s\n" + " join \"customer\" as c using (\"customer_id\")\n" @@ -2256,7 +2256,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1636] * JDBC adapter generates wrong SQL for self join with sub-query. */ - @Test public void testSubQueryAlias() { + @Test void testSubQueryAlias() { String query = "select t1.\"customer_id\", t2.\"customer_id\"\n" + "from (select \"customer_id\" from \"sales_fact_1997\") as t1\n" + "inner join (select \"customer_id\" from \"sales_fact_1997\") t2\n" @@ -2270,7 +2270,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testCartesianProductWithCommaSyntax() { + @Test void testCartesianProductWithCommaSyntax() { String query = "select * from \"department\" , \"employee\""; String expected = "SELECT *\n" + "FROM \"foodmart\".\"department\",\n" @@ -2282,7 +2282,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-2652] * SqlNode to SQL conversion fails if the join condition references a BOOLEAN * column. */ - @Test public void testJoinOnBoolean() { + @Test void testJoinOnBoolean() { final String sql = "SELECT 1\n" + "from emps\n" + "join emp on (emp.deptno = emps.empno and manager)"; @@ -2290,7 +2290,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { assertThat(s, notNullValue()); // sufficient that conversion did not throw } - @Test public void testCartesianProductWithInnerJoinSyntax() { + @Test void testCartesianProductWithInnerJoinSyntax() { String query = "select * from \"department\"\n" + "INNER JOIN \"employee\" ON TRUE"; String expected = "SELECT *\n" @@ -2299,7 +2299,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testFullJoinOnTrueCondition() { + @Test void testFullJoinOnTrueCondition() { String query = "select * from \"department\"\n" + "FULL JOIN \"employee\" ON TRUE"; String expected = "SELECT *\n" @@ -2308,7 +2308,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testSimpleIn() { + @Test void testSimpleIn() { String query = "select * from \"department\" where \"department_id\" in (\n" + " select \"department_id\" from \"employee\"\n" + " where \"store_id\" < 150)"; @@ -2325,7 +2325,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1332] * DB2 should always use aliases for tables: x.y.z AS z. */ - @Test public void testDb2DialectJoinStar() { + @Test void testDb2DialectJoinStar() { String query = "select * " + "from \"foodmart\".\"employee\" A " + "join \"foodmart\".\"department\" B\n" @@ -2337,7 +2337,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectSelfJoinStar() { + @Test void testDb2DialectSelfJoinStar() { String query = "select * " + "from \"foodmart\".\"employee\" A join \"foodmart\".\"employee\" B\n" + "on A.\"department_id\" = B.\"department_id\""; @@ -2348,7 +2348,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectJoin() { + @Test void testDb2DialectJoin() { String query = "select A.\"employee_id\", B.\"department_id\" " + "from \"foodmart\".\"employee\" A join \"foodmart\".\"department\" B\n" + "on A.\"department_id\" = B.\"department_id\""; @@ -2360,7 +2360,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectSelfJoin() { + @Test void testDb2DialectSelfJoin() { String query = "select A.\"employee_id\", B.\"employee_id\" from " + "\"foodmart\".\"employee\" A join \"foodmart\".\"employee\" B\n" + "on A.\"department_id\" = B.\"department_id\""; @@ -2372,7 +2372,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectWhere() { + @Test void testDb2DialectWhere() { String query = "select A.\"employee_id\" from " + "\"foodmart\".\"employee\" A where A.\"department_id\" < 1000"; final String expected = "SELECT employee.employee_id\n" @@ -2381,7 +2381,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectJoinWhere() { + @Test void testDb2DialectJoinWhere() { String query = "select A.\"employee_id\", B.\"department_id\" " + "from \"foodmart\".\"employee\" A join \"foodmart\".\"department\" B\n" + "on A.\"department_id\" = B.\"department_id\" " @@ -2395,7 +2395,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectSelfJoinWhere() { + @Test void testDb2DialectSelfJoinWhere() { String query = "select A.\"employee_id\", B.\"employee_id\" from " + "\"foodmart\".\"employee\" A join \"foodmart\".\"employee\" B\n" + "on A.\"department_id\" = B.\"department_id\" " @@ -2409,7 +2409,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectCast() { + @Test void testDb2DialectCast() { String query = "select \"hire_date\", cast(\"hire_date\" as varchar(10)) " + "from \"foodmart\".\"reserve_employee\""; final String expected = "SELECT reserve_employee.hire_date, " @@ -2418,7 +2418,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectSelectQueryWithGroupByHaving() { + @Test void testDb2DialectSelectQueryWithGroupByHaving() { String query = "select count(*) from \"product\" " + "group by \"product_class_id\", \"product_id\" " + "having \"product_id\" > 10"; @@ -2430,7 +2430,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { } - @Test public void testDb2DialectSelectQueryComplex() { + @Test void testDb2DialectSelectQueryComplex() { String query = "select count(*), \"units_per_case\" " + "from \"product\" where \"cases_per_pallet\" > 100 " + "group by \"product_id\", \"units_per_case\" " @@ -2443,7 +2443,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).withDb2().ok(expected); } - @Test public void testDb2DialectSelectQueryWithGroup() { + @Test void testDb2DialectSelectQueryWithGroup() { String query = "select count(*), sum(\"employee_id\") " + "from \"reserve_employee\" " + "where \"hire_date\" > '2015-01-01' " @@ -2462,7 +2462,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1372] * JDBC adapter generates SQL with wrong field names. */ - @Test public void testJoinPlan2() { + @Test void testJoinPlan2() { final String sql = "SELECT v1.deptno, v2.deptno\n" + "FROM dept v1 LEFT JOIN emp v2 ON v1.deptno = v2.deptno\n" + "WHERE v2.job LIKE 'PRESIDENT'"; @@ -2489,7 +2489,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { * [CALCITE-1422] * In JDBC adapter, allow IS NULL and IS NOT NULL operators in generated SQL * join condition. */ - @Test public void testSimpleJoinConditionWithIsNullOperators() { + @Test void testSimpleJoinConditionWithIsNullOperators() { String query = "select *\n" + "from \"foodmart\".\"sales_fact_1997\" as \"t1\"\n" + "inner join \"foodmart\".\"customer\" as \"t2\"\n" @@ -2519,7 +2519,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1586] * JDBC adapter generates wrong SQL if UNION has more than two inputs. */ - @Test public void testThreeQueryUnion() { + @Test void testThreeQueryUnion() { String query = "SELECT \"product_id\" FROM \"product\" " + " UNION ALL " + "SELECT \"product_id\" FROM \"sales_fact_1997\" " @@ -2543,7 +2543,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { /** Test case for * [CALCITE-1800] * JDBC adapter fails to SELECT FROM a UNION query. */ - @Test public void testUnionWrappedInASelect() { + @Test void testUnionWrappedInASelect() { final String query = "select sum(\n" + " case when \"product_id\"=0 then \"net_weight\" else 0 end)" + " as net_weight\n" @@ -2563,7 +2563,7 @@ private static String toSql(RelNode root, SqlDialect dialect) { sql(query).ok(expected); } - @Test public void testLiteral() { + @Test void testLiteral() { checkLiteral("DATE '1978-05-02'"); checkLiteral2("DATE '1978-5-2'", "DATE '1978-05-02'"); checkLiteral("TIME '12:34:56'"); @@ -2632,7 +2632,7 @@ private void checkLiteral2(String expression, String expected) { * [CALCITE-2625] * Removing Window Boundaries from SqlWindow of Aggregate Function which do not allow Framing * */ - @Test public void testRowNumberFunctionForPrintingOfFrameBoundary() { + @Test void testRowNumberFunctionForPrintingOfFrameBoundary() { String query = "SELECT row_number() over (order by \"hire_date\") FROM \"employee\""; String expected = "SELECT ROW_NUMBER() OVER (ORDER BY \"hire_date\")\n" + "FROM \"foodmart\".\"employee\""; @@ -2642,7 +2642,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case for * [CALCITE-3112] * Support Window in RelToSqlConverter. */ - @Test public void testConvertWindowToSql() { + @Test void testConvertWindowToSql() { String query0 = "SELECT row_number() over (order by \"hire_date\") FROM \"employee\""; String expected0 = "SELECT ROW_NUMBER() OVER (ORDER BY \"hire_date\") AS \"$0\"\n" + "FROM \"foodmart\".\"employee\""; @@ -2724,14 +2724,14 @@ private void checkLiteral2(String expression, String expected) { sql(query6).optimize(rules, hepPlanner).ok(expected6); } - @Test public void testRankFunctionForPrintingOfFrameBoundary() { + @Test void testRankFunctionForPrintingOfFrameBoundary() { String query = "SELECT rank() over (order by \"hire_date\") FROM \"employee\""; String expected = "SELECT RANK() OVER (ORDER BY \"hire_date\")\n" + "FROM \"foodmart\".\"employee\""; sql(query).ok(expected); } - @Test public void testLeadFunctionForPrintingOfFrameBoundary() { + @Test void testLeadFunctionForPrintingOfFrameBoundary() { String query = "SELECT lead(\"employee_id\",1,'NA') over " + "(partition by \"hire_date\" order by \"employee_id\") FROM \"employee\""; String expected = "SELECT LEAD(\"employee_id\", 1, 'NA') OVER " @@ -2740,7 +2740,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testLagFunctionForPrintingOfFrameBoundary() { + @Test void testLagFunctionForPrintingOfFrameBoundary() { String query = "SELECT lag(\"employee_id\",1,'NA') over " + "(partition by \"hire_date\" order by \"employee_id\") FROM \"employee\""; String expected = "SELECT LAG(\"employee_id\", 1, 'NA') OVER " @@ -2753,7 +2753,7 @@ private void checkLiteral2(String expression, String expected) { * [CALCITE-3876] * RelToSqlConverter should not combine Projects when top Project contains * window function referencing window function from bottom Project. */ - @Test public void testWindowOnWindowDoesNotCombineProjects() { + @Test void testWindowOnWindowDoesNotCombineProjects() { final String query = "SELECT ROW_NUMBER() OVER (ORDER BY rn)\n" + "FROM (SELECT *,\n" + " ROW_NUMBER() OVER (ORDER BY \"product_id\") as rn\n" @@ -2774,7 +2774,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case for * [CALCITE-1798] * Generate dialect-specific SQL for FLOOR operator. */ - @Test public void testFloor() { + @Test void testFloor() { String query = "SELECT floor(\"hire_date\" TO MINUTE) FROM \"employee\""; String expected = "SELECT TRUNC(hire_date, 'MI')\nFROM foodmart.employee"; sql(query) @@ -2782,7 +2782,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorPostgres() { + @Test void testFloorPostgres() { String query = "SELECT floor(\"hire_date\" TO MINUTE) FROM \"employee\""; String expected = "SELECT DATE_TRUNC('MINUTE', \"hire_date\")\nFROM \"foodmart\".\"employee\""; sql(query) @@ -2790,7 +2790,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorOracle() { + @Test void testFloorOracle() { String query = "SELECT floor(\"hire_date\" TO MINUTE) FROM \"employee\""; String expected = "SELECT TRUNC(\"hire_date\", 'MINUTE')\nFROM \"foodmart\".\"employee\""; sql(query) @@ -2798,7 +2798,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorMssqlWeek() { + @Test void testFloorMssqlWeek() { String query = "SELECT floor(\"hire_date\" TO WEEK) FROM \"employee\""; String expected = "SELECT CONVERT(DATETIME, CONVERT(VARCHAR(10), " + "DATEADD(day, - (6 + DATEPART(weekday, [hire_date] )) % 7, [hire_date] ), 126))\n" @@ -2808,7 +2808,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorMssqlMonth() { + @Test void testFloorMssqlMonth() { String query = "SELECT floor(\"hire_date\" TO MONTH) FROM \"employee\""; String expected = "SELECT CONVERT(DATETIME, CONVERT(VARCHAR(7), [hire_date] , 126)+'-01')\n" + "FROM [foodmart].[employee]"; @@ -2817,7 +2817,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorMysqlMonth() { + @Test void testFloorMysqlMonth() { String query = "SELECT floor(\"hire_date\" TO MONTH) FROM \"employee\""; String expected = "SELECT DATE_FORMAT(`hire_date`, '%Y-%m-01')\n" + "FROM `foodmart`.`employee`"; @@ -2826,7 +2826,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testUnparseSqlIntervalQualifierDb2() { + @Test void testUnparseSqlIntervalQualifierDb2() { String queryDatePlus = "select * from \"employee\" where \"hire_date\" + " + "INTERVAL '19800' SECOND(5) > TIMESTAMP '2005-10-17 00:00:00' "; String expectedDatePlus = "SELECT *\n" @@ -2850,7 +2850,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedDateMinus); } - @Test public void testUnparseSqlIntervalQualifierMySql() { + @Test void testUnparseSqlIntervalQualifierMySql() { final String sql0 = "select * from \"employee\" where \"hire_date\" - " + "INTERVAL '19800' SECOND(5) > TIMESTAMP '2005-10-17 00:00:00' "; final String expect0 = "SELECT *\n" @@ -2885,7 +2885,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql3).withMysql().ok(expect3); } - @Test public void testUnparseSqlIntervalQualifierMsSql() { + @Test void testUnparseSqlIntervalQualifierMsSql() { String queryDatePlus = "select * from \"employee\" where \"hire_date\" +" + "INTERVAL '19800' SECOND(5) > TIMESTAMP '2005-10-17 00:00:00' "; String expectedDatePlus = "SELECT *\n" @@ -2918,7 +2918,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedDateMinusNegate); } - @Test public void testUnparseSqlIntervalQualifierBigQuery() { + @Test void testUnparseSqlIntervalQualifierBigQuery() { final String sql0 = "select * from \"employee\" where \"hire_date\" - " + "INTERVAL '19800' SECOND(5) > TIMESTAMP '2005-10-17 00:00:00' "; final String expect0 = "SELECT *\n" @@ -2940,7 +2940,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql2).withBigQuery().throws_("Only INT64 is supported as the interval value for BigQuery."); } - @Test public void testFloorMysqlWeek() { + @Test void testFloorMysqlWeek() { String query = "SELECT floor(\"hire_date\" TO WEEK) FROM \"employee\""; String expected = "SELECT STR_TO_DATE(DATE_FORMAT(`hire_date` , '%x%v-1'), '%x%v-%w')\n" + "FROM `foodmart`.`employee`"; @@ -2949,7 +2949,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorMysqlHour() { + @Test void testFloorMysqlHour() { String query = "SELECT floor(\"hire_date\" TO HOUR) FROM \"employee\""; String expected = "SELECT DATE_FORMAT(`hire_date`, '%Y-%m-%d %H:00:00')\n" + "FROM `foodmart`.`employee`"; @@ -2958,7 +2958,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorMysqlMinute() { + @Test void testFloorMysqlMinute() { String query = "SELECT floor(\"hire_date\" TO MINUTE) FROM \"employee\""; String expected = "SELECT DATE_FORMAT(`hire_date`, '%Y-%m-%d %H:%i:00')\n" + "FROM `foodmart`.`employee`"; @@ -2967,7 +2967,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testFloorMysqlSecond() { + @Test void testFloorMysqlSecond() { String query = "SELECT floor(\"hire_date\" TO SECOND) FROM \"employee\""; String expected = "SELECT DATE_FORMAT(`hire_date`, '%Y-%m-%d %H:%i:%s')\n" + "FROM `foodmart`.`employee`"; @@ -2979,7 +2979,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case for * [CALCITE-1826] * JDBC dialect-specific FLOOR fails when in GROUP BY. */ - @Test public void testFloorWithGroupBy() { + @Test void testFloorWithGroupBy() { final String query = "SELECT floor(\"hire_date\" TO MINUTE)\n" + "FROM \"employee\"\n" + "GROUP BY floor(\"hire_date\" TO MINUTE)"; @@ -3007,7 +3007,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedMysql); } - @Test public void testSubstring() { + @Test void testSubstring() { final String query = "select substring(\"brand_name\" from 2) " + "from \"product\"\n"; final String expectedOracle = "SELECT SUBSTR(\"brand_name\", 2)\n" @@ -3034,7 +3034,7 @@ private void checkLiteral2(String expression, String expected) { .throws_("MSSQL SUBSTRING requires FROM and FOR arguments"); } - @Test public void testSubstringWithFor() { + @Test void testSubstringWithFor() { final String query = "select substring(\"brand_name\" from 2 for 3) " + "from \"product\"\n"; final String expectedOracle = "SELECT SUBSTR(\"brand_name\", 2, 3)\n" @@ -3065,7 +3065,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case for * [CALCITE-1849] * Support sub-queries (RexSubQuery) in RelToSqlConverter. */ - @Test public void testExistsWithExpand() { + @Test void testExistsWithExpand() { String query = "select \"product_name\" from \"product\" a " + "where exists (select count(*) " + "from \"sales_fact_1997\"b " @@ -3078,7 +3078,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).config(NO_EXPAND_CONFIG).ok(expected); } - @Test public void testNotExistsWithExpand() { + @Test void testNotExistsWithExpand() { String query = "select \"product_name\" from \"product\" a " + "where not exists (select count(*) " + "from \"sales_fact_1997\"b " @@ -3091,7 +3091,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).config(NO_EXPAND_CONFIG).ok(expected); } - @Test public void testSubQueryInWithExpand() { + @Test void testSubQueryInWithExpand() { String query = "select \"product_name\" from \"product\" a " + "where \"product_id\" in (select \"product_id\" " + "from \"sales_fact_1997\"b " @@ -3104,7 +3104,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).config(NO_EXPAND_CONFIG).ok(expected); } - @Test public void testSubQueryInWithExpand2() { + @Test void testSubQueryInWithExpand2() { String query = "select \"product_name\" from \"product\" a " + "where \"product_id\" in (1, 2)"; String expected = "SELECT \"product_name\"\n" @@ -3113,7 +3113,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).config(NO_EXPAND_CONFIG).ok(expected); } - @Test public void testSubQueryNotInWithExpand() { + @Test void testSubQueryNotInWithExpand() { String query = "select \"product_name\" from \"product\" a " + "where \"product_id\" not in (select \"product_id\" " + "from \"sales_fact_1997\"b " @@ -3126,7 +3126,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).config(NO_EXPAND_CONFIG).ok(expected); } - @Test public void testLike() { + @Test void testLike() { String query = "select \"product_name\" from \"product\" a " + "where \"product_name\" like 'abc'"; String expected = "SELECT \"product_name\"\n" @@ -3135,7 +3135,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testNotLike() { + @Test void testNotLike() { String query = "select \"product_name\" from \"product\" a " + "where \"product_name\" not like 'abc'"; String expected = "SELECT \"product_name\"\n" @@ -3144,7 +3144,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testMatchRecognizePatternExpression() { + @Test void testMatchRecognizePatternExpression() { String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3171,7 +3171,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression2() { + @Test void testMatchRecognizePatternExpression2() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3194,7 +3194,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression3() { + @Test void testMatchRecognizePatternExpression3() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3217,7 +3217,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression4() { + @Test void testMatchRecognizePatternExpression4() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3240,7 +3240,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression5() { + @Test void testMatchRecognizePatternExpression5() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3263,7 +3263,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression6() { + @Test void testMatchRecognizePatternExpression6() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3286,7 +3286,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression7() { + @Test void testMatchRecognizePatternExpression7() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3309,7 +3309,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression8() { + @Test void testMatchRecognizePatternExpression8() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3332,7 +3332,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression9() { + @Test void testMatchRecognizePatternExpression9() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3355,7 +3355,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression10() { + @Test void testMatchRecognizePatternExpression10() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3380,7 +3380,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression11() { + @Test void testMatchRecognizePatternExpression11() { final String sql = "select *\n" + " from (select * from \"product\") match_recognize\n" + " (\n" @@ -3403,7 +3403,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression12() { + @Test void testMatchRecognizePatternExpression12() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3427,7 +3427,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternExpression13() { + @Test void testMatchRecognizePatternExpression13() { final String sql = "select *\n" + " from (\n" + "select *\n" @@ -3471,7 +3471,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause() { + @Test void testMatchRecognizeDefineClause() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3494,7 +3494,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause2() { + @Test void testMatchRecognizeDefineClause2() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3517,7 +3517,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause3() { + @Test void testMatchRecognizeDefineClause3() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3540,7 +3540,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause4() { + @Test void testMatchRecognizeDefineClause4() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3565,7 +3565,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures1() { + @Test void testMatchRecognizeMeasures1() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3601,7 +3601,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures2() { + @Test void testMatchRecognizeMeasures2() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3633,7 +3633,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures3() { + @Test void testMatchRecognizeMeasures3() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3665,7 +3665,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures4() { + @Test void testMatchRecognizeMeasures4() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3698,7 +3698,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures5() { + @Test void testMatchRecognizeMeasures5() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3732,7 +3732,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures6() { + @Test void testMatchRecognizeMeasures6() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3765,7 +3765,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures7() { + @Test void testMatchRecognizeMeasures7() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3799,7 +3799,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip1() { + @Test void testMatchRecognizePatternSkip1() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3823,7 +3823,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip2() { + @Test void testMatchRecognizePatternSkip2() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3847,7 +3847,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip3() { + @Test void testMatchRecognizePatternSkip3() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3870,7 +3870,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip4() { + @Test void testMatchRecognizePatternSkip4() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3894,7 +3894,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip5() { + @Test void testMatchRecognizePatternSkip5() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3918,7 +3918,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset1() { + @Test void testMatchRecognizeSubset1() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3944,7 +3944,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset2() { + @Test void testMatchRecognizeSubset2() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -3979,7 +3979,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset3() { + @Test void testMatchRecognizeSubset3() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -4013,7 +4013,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset4() { + @Test void testMatchRecognizeSubset4() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -4047,7 +4047,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeRowsPerMatch1() { + @Test void testMatchRecognizeRowsPerMatch1() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -4082,7 +4082,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeRowsPerMatch2() { + @Test void testMatchRecognizeRowsPerMatch2() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -4117,7 +4117,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeWithin() { + @Test void testMatchRecognizeWithin() { final String sql = "select *\n" + " from \"employee\" match_recognize\n" + " (\n" @@ -4145,7 +4145,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testMatchRecognizeIn() { + @Test void testMatchRecognizeIn() { final String sql = "select *\n" + " from \"product\" match_recognize\n" + " (\n" @@ -4173,7 +4173,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testValues() { + @Test void testValues() { final String sql = "select \"a\"\n" + "from (values (1, 'x'), (2, 'yy')) as t(\"a\", \"b\")"; final String expectedHsqldb = "SELECT a\n" @@ -4209,7 +4209,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedRedshift); } - @Test public void testValuesEmpty() { + @Test void testValuesEmpty() { final String sql = "select *\n" + "from (values (1, 'a'), (2, 'bb')) as t(x, y)\n" + "limit 0"; @@ -4237,7 +4237,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case fo * [CALCITE-3840] * Re-aliasing of VALUES that has column aliases produces wrong SQL in the JDBC adapter*/ - @Test public void testValuesReAlias() { + @Test void testValuesReAlias() { final RelBuilder builder = relBuilder(); final RelNode root = builder .values(new String[]{ "a", "b" }, 1, "x ", 2, "yy") @@ -4256,7 +4256,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case for * [CALCITE-2118] * RelToSqlConverter should only generate "*" if field names match. */ - @Test public void testPreserveAlias() { + @Test void testPreserveAlias() { final String sql = "select \"warehouse_class_id\" as \"id\",\n" + " \"description\"\n" + "from \"warehouse_class\""; @@ -4272,7 +4272,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql2).ok(expected2); } - @Test public void testPreservePermutation() { + @Test void testPreservePermutation() { final String sql = "select \"description\", \"warehouse_class_id\"\n" + "from \"warehouse_class\""; final String expected = "SELECT \"description\", \"warehouse_class_id\"\n" @@ -4280,7 +4280,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testFieldNamesWithAggregateSubQuery() { + @Test void testFieldNamesWithAggregateSubQuery() { final String query = "select mytable.\"city\",\n" + " sum(mytable.\"store_sales\") as \"my-alias\"\n" + "from (select c.\"city\", s.\"store_sales\"\n" @@ -4303,7 +4303,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testUnparseSelectMustUseDialect() { + @Test void testUnparseSelectMustUseDialect() { final String query = "select * from \"product\""; final String expected = "SELECT *\n" + "FROM foodmart.product"; @@ -4324,7 +4324,7 @@ private void checkLiteral2(String expression, String expected) { callsUnparseCallOnSqlSelect[0], is(true)); } - @Test public void testCorrelate() { + @Test void testCorrelate() { final String sql = "select d.\"department_id\", d_plusOne " + "from \"department\" as d, " + " lateral (select d.\"department_id\" + 1 as d_plusOne" @@ -4340,7 +4340,7 @@ private void checkLiteral2(String expression, String expected) { /** Test case for * [CALCITE-3651] * NullPointerException when convert relational algebra that correlates TableFunctionScan. */ - @Test public void testLateralCorrelate() { + @Test void testLateralCorrelate() { final String query = "select * from \"product\",\n" + "lateral table(RAMP(\"product\".\"product_id\"))"; final String expected = "SELECT *\n" @@ -4350,7 +4350,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testUncollectExplicitAlias() { + @Test void testUncollectExplicitAlias() { final String sql = "select did + 1\n" + "from unnest(select collect(\"department_id\") as deptid" + " from \"department\") as t(did)"; @@ -4361,7 +4361,7 @@ private void checkLiteral2(String expression, String expected) { sql(sql).ok(expected); } - @Test public void testUncollectImplicitAlias() { + @Test void testUncollectImplicitAlias() { final String sql = "select did + 1\n" + "from unnest(select collect(\"department_id\") " + " from \"department\") as t(did)"; @@ -4373,7 +4373,7 @@ private void checkLiteral2(String expression, String expected) { } - @Test public void testWithinGroup1() { + @Test void testWithinGroup1() { final String query = "select \"product_class_id\", collect(\"net_weight\") " + "within group (order by \"net_weight\" desc) " + "from \"product\" group by \"product_class_id\""; @@ -4384,7 +4384,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testWithinGroup2() { + @Test void testWithinGroup2() { final String query = "select \"product_class_id\", collect(\"net_weight\") " + "within group (order by \"low_fat\", \"net_weight\" desc nulls last) " + "from \"product\" group by \"product_class_id\""; @@ -4395,7 +4395,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testWithinGroup3() { + @Test void testWithinGroup3() { final String query = "select \"product_class_id\", collect(\"net_weight\") " + "within group (order by \"net_weight\" desc), " + "min(\"low_fat\")" @@ -4407,7 +4407,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testWithinGroup4() { + @Test void testWithinGroup4() { // filter in AggregateCall is not unparsed final String query = "select \"product_class_id\", collect(\"net_weight\") " + "within group (order by \"net_weight\" desc) filter (where \"net_weight\" > 0)" @@ -4419,7 +4419,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonValueExpressionOperator() { + @Test void testJsonValueExpressionOperator() { String query = "select \"product_name\" format json, " + "\"product_name\" format json encoding utf8, " + "\"product_name\" format json encoding utf16, " @@ -4432,21 +4432,21 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonExists() { + @Test void testJsonExists() { String query = "select json_exists(\"product_name\", 'lax $') from \"product\""; final String expected = "SELECT JSON_EXISTS(\"product_name\", 'lax $')\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testJsonPretty() { + @Test void testJsonPretty() { String query = "select json_pretty(\"product_name\") from \"product\""; final String expected = "SELECT JSON_PRETTY(\"product_name\")\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testJsonValue() { + @Test void testJsonValue() { String query = "select json_value(\"product_name\", 'lax $') from \"product\""; // todo translate to JSON_VALUE rather than CAST final String expected = "SELECT CAST(JSON_VALUE_ANY(\"product_name\", " @@ -4455,7 +4455,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonQuery() { + @Test void testJsonQuery() { String query = "select json_query(\"product_name\", 'lax $') from \"product\""; final String expected = "SELECT JSON_QUERY(\"product_name\", 'lax $' " + "WITHOUT ARRAY WRAPPER NULL ON EMPTY NULL ON ERROR)\n" @@ -4463,21 +4463,21 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonArray() { + @Test void testJsonArray() { String query = "select json_array(\"product_name\", \"product_name\") from \"product\""; final String expected = "SELECT JSON_ARRAY(\"product_name\", \"product_name\" ABSENT ON NULL)\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testJsonArrayAgg() { + @Test void testJsonArrayAgg() { String query = "select json_arrayagg(\"product_name\") from \"product\""; final String expected = "SELECT JSON_ARRAYAGG(\"product_name\" ABSENT ON NULL)\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testJsonObject() { + @Test void testJsonObject() { String query = "select json_object(\"product_name\": \"product_id\") from \"product\""; final String expected = "SELECT " + "JSON_OBJECT(KEY \"product_name\" VALUE \"product_id\" NULL ON NULL)\n" @@ -4485,7 +4485,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonObjectAgg() { + @Test void testJsonObjectAgg() { String query = "select json_objectagg(\"product_name\": \"product_id\") from \"product\""; final String expected = "SELECT " + "JSON_OBJECTAGG(KEY \"product_name\" VALUE \"product_id\" NULL ON NULL)\n" @@ -4493,7 +4493,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonPredicate() { + @Test void testJsonPredicate() { String query = "select " + "\"product_name\" is json, " + "\"product_name\" is json value, " @@ -4521,7 +4521,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testCrossJoinEmulationForSpark() { + @Test void testCrossJoinEmulationForSpark() { String query = "select * from \"employee\", \"department\""; final String expected = "SELECT *\n" + "FROM foodmart.employee\n" @@ -4529,7 +4529,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).withSpark().ok(expected); } - @Test public void testSubstringInSpark() { + @Test void testSubstringInSpark() { final String query = "select substring(\"brand_name\" from 2) " + "from \"product\"\n"; final String expected = "SELECT SUBSTRING(brand_name, 2)\n" @@ -4537,7 +4537,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).withSpark().ok(expected); } - @Test public void testSubstringWithForInSpark() { + @Test void testSubstringWithForInSpark() { final String query = "select substring(\"brand_name\" from 2 for 3) " + "from \"product\"\n"; final String expected = "SELECT SUBSTRING(brand_name, 2, 3)\n" @@ -4545,7 +4545,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).withSpark().ok(expected); } - @Test public void testFloorInSpark() { + @Test void testFloorInSpark() { final String query = "select floor(\"hire_date\" TO MINUTE) " + "from \"employee\""; final String expected = "SELECT DATE_TRUNC('MINUTE', hire_date)\n" @@ -4553,7 +4553,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).withSpark().ok(expected); } - @Test public void testNumericFloorInSpark() { + @Test void testNumericFloorInSpark() { final String query = "select floor(\"salary\") " + "from \"employee\""; final String expected = "SELECT FLOOR(salary)\n" @@ -4561,14 +4561,14 @@ private void checkLiteral2(String expression, String expected) { sql(query).withSpark().ok(expected); } - @Test public void testJsonStorageSize() { + @Test void testJsonStorageSize() { String query = "select json_storage_size(\"product_name\") from \"product\""; final String expected = "SELECT JSON_STORAGE_SIZE(\"product_name\")\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testCubeInSpark() { + @Test void testCubeInSpark() { final String query = "select count(*) " + "from \"foodmart\".\"product\" " + "group by cube(\"product_id\",\"product_class_id\")"; @@ -4584,7 +4584,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedInSpark); } - @Test public void testRollupInSpark() { + @Test void testRollupInSpark() { final String query = "select count(*) " + "from \"foodmart\".\"product\" " + "group by rollup(\"product_id\",\"product_class_id\")"; @@ -4600,7 +4600,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedInSpark); } - @Test public void testJsonType() { + @Test void testJsonType() { String query = "select json_type(\"product_name\") from \"product\""; final String expected = "SELECT " + "JSON_TYPE(\"product_name\")\n" @@ -4608,7 +4608,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonDepth() { + @Test void testJsonDepth() { String query = "select json_depth(\"product_name\") from \"product\""; final String expected = "SELECT " + "JSON_DEPTH(\"product_name\")\n" @@ -4616,7 +4616,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonLength() { + @Test void testJsonLength() { String query = "select json_length(\"product_name\", 'lax $'), " + "json_length(\"product_name\") from \"product\""; final String expected = "SELECT JSON_LENGTH(\"product_name\", 'lax $'), " @@ -4625,21 +4625,21 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testJsonKeys() { + @Test void testJsonKeys() { String query = "select json_keys(\"product_name\", 'lax $') from \"product\""; final String expected = "SELECT JSON_KEYS(\"product_name\", 'lax $')\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testJsonRemove() { + @Test void testJsonRemove() { String query = "select json_remove(\"product_name\", '$[0]') from \"product\""; final String expected = "SELECT JSON_REMOVE(\"product_name\", '$[0]')\n" + "FROM \"foodmart\".\"product\""; sql(query).ok(expected); } - @Test public void testUnionAllWithNoOperandsUsingOracleDialect() { + @Test void testUnionAllWithNoOperandsUsingOracleDialect() { String query = "select A.\"department_id\" " + "from \"foodmart\".\"employee\" A " + " where A.\"department_id\" = ( select min( A.\"department_id\") from \"foodmart\".\"department\" B where 1=2 )"; @@ -4653,7 +4653,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).withOracle().ok(expected); } - @Test public void testUnionAllWithNoOperands() { + @Test void testUnionAllWithNoOperands() { String query = "select A.\"department_id\" " + "from \"foodmart\".\"employee\" A " + " where A.\"department_id\" = ( select min( A.\"department_id\") from \"foodmart\".\"department\" B where 1=2 )"; @@ -4672,7 +4672,7 @@ private void checkLiteral2(String expression, String expected) { sql(query).ok(expected); } - @Test public void testSmallintOracle() { + @Test void testSmallintOracle() { String query = "SELECT CAST(\"department_id\" AS SMALLINT) FROM \"employee\""; String expected = "SELECT CAST(\"department_id\" AS NUMBER(5))\n" + "FROM \"foodmart\".\"employee\""; @@ -4681,7 +4681,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testBigintOracle() { + @Test void testBigintOracle() { String query = "SELECT CAST(\"department_id\" AS BIGINT) FROM \"employee\""; String expected = "SELECT CAST(\"department_id\" AS NUMBER(19))\n" + "FROM \"foodmart\".\"employee\""; @@ -4690,7 +4690,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testDoubleOracle() { + @Test void testDoubleOracle() { String query = "SELECT CAST(\"department_id\" AS DOUBLE) FROM \"employee\""; String expected = "SELECT CAST(\"department_id\" AS DOUBLE PRECISION)\n" + "FROM \"foodmart\".\"employee\""; @@ -4699,7 +4699,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testDateLiteralOracle() { + @Test void testDateLiteralOracle() { String query = "SELECT DATE '1978-05-02' FROM \"employee\""; String expected = "SELECT TO_DATE('1978-05-02', 'YYYY-MM-DD')\n" + "FROM \"foodmart\".\"employee\""; @@ -4708,7 +4708,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testTimestampLiteralOracle() { + @Test void testTimestampLiteralOracle() { String query = "SELECT TIMESTAMP '1978-05-02 12:34:56.78' FROM \"employee\""; String expected = "SELECT TO_TIMESTAMP('1978-05-02 12:34:56.78'," + " 'YYYY-MM-DD HH24:MI:SS.FF')\n" @@ -4718,7 +4718,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testTimeLiteralOracle() { + @Test void testTimeLiteralOracle() { String query = "SELECT TIME '12:34:56.78' FROM \"employee\""; String expected = "SELECT TO_TIME('12:34:56.78', 'HH24:MI:SS.FF')\n" + "FROM \"foodmart\".\"employee\""; @@ -4727,7 +4727,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testSupportsDataType() { + @Test void testSupportsDataType() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType booleanDataType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); @@ -4740,7 +4740,7 @@ private void checkLiteral2(String expression, String expected) { assertTrue(postgresqlDialect.supportsDataType(integerDataType)); } - @Test public void testSelectNull() { + @Test void testSelectNull() { String query = "SELECT CAST(NULL AS INT)"; final String expected = "SELECT CAST(NULL AS INTEGER)\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; @@ -4749,7 +4749,7 @@ private void checkLiteral2(String expression, String expected) { sql(expected).exec(); } - @Test public void testSelectNullWithCount() { + @Test void testSelectNullWithCount() { String query = "SELECT COUNT(CAST(NULL AS INT))"; final String expected = "SELECT COUNT(CAST(NULL AS INTEGER))\n" + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")"; @@ -4758,7 +4758,7 @@ private void checkLiteral2(String expression, String expected) { sql(expected).exec(); } - @Test public void testSelectNullWithGroupByNull() { + @Test void testSelectNullWithGroupByNull() { String query = "SELECT COUNT(CAST(NULL AS INT)) FROM (VALUES (0))\n" + "AS \"t\" GROUP BY CAST(NULL AS VARCHAR CHARACTER SET \"ISO-8859-1\")"; final String expected = "SELECT COUNT(CAST(NULL AS INTEGER))\n" @@ -4769,7 +4769,7 @@ private void checkLiteral2(String expression, String expected) { sql(expected).exec(); } - @Test public void testSelectNullWithGroupByVar() { + @Test void testSelectNullWithGroupByVar() { String query = "SELECT COUNT(CAST(NULL AS INT)) FROM \"account\"\n" + "AS \"t\" GROUP BY \"account_type\""; final String expected = "SELECT COUNT(CAST(NULL AS INTEGER))\n" @@ -4780,7 +4780,7 @@ private void checkLiteral2(String expression, String expected) { sql(expected).exec(); } - @Test public void testSelectNullWithInsert() { + @Test void testSelectNullWithInsert() { String query = "insert into\n" + "\"account\"(\"account_id\",\"account_parent\",\"account_type\",\"account_rollup\")\n" + "select 1, cast(NULL AS INT), cast(123 as varchar), cast(123 as varchar)"; @@ -4798,7 +4798,7 @@ private void checkLiteral2(String expression, String expected) { sql(expected).exec(); } - @Test public void testSelectNullWithInsertFromJoin() { + @Test void testSelectNullWithInsertFromJoin() { String query = "insert into\n" + "\"account\"(\"account_id\",\"account_parent\",\n" + "\"account_type\",\"account_rollup\")\n" @@ -4828,7 +4828,7 @@ private void checkLiteral2(String expression, String expected) { sql(expected).exec(); } - @Test public void testCastInStringIntegerComparison() { + @Test void testCastInStringIntegerComparison() { final String query = "select \"employee_id\" " + "from \"foodmart\".\"employee\" " + "where 10 = cast('10' as int) and \"birth_date\" = cast('1914-02-02' as date) or " @@ -4847,7 +4847,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expectedBiqquery); } - @Test public void testDialectQuoteStringLiteral() { + @Test void testDialectQuoteStringLiteral() { dialects().forEach((dialect, databaseProduct) -> { assertThat(dialect.quoteStringLiteral(""), is("''")); assertThat(dialect.quoteStringLiteral("can't run"), @@ -4866,7 +4866,7 @@ private void checkLiteral2(String expression, String expected) { }); } - @Test public void testSelectCountStar() { + @Test void testSelectCountStar() { final String query = "select count(*) from \"product\""; final String expected = "SELECT COUNT(*)\n" + "FROM \"foodmart\".\"product\""; @@ -4874,7 +4874,7 @@ private void checkLiteral2(String expression, String expected) { sql.ok(expected); } - @Test public void testRowValueExpression() { + @Test void testRowValueExpression() { final String expected0 = "INSERT INTO SCOTT.DEPT (DEPTNO, DNAME, LOC)\n" + "SELECT 1, 'Fred', 'San Francisco'\n" + "FROM (VALUES (0)) t (ZERO)\n" @@ -4943,7 +4943,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected5); } - @Test public void testInsertValuesWithDynamicParams() { + @Test void testInsertValuesWithDynamicParams() { final String sql = "insert into \"DEPT\" values (?,?,?), (?,?,?)"; final String expected = "" + "INSERT INTO \"SCOTT\".\"DEPT\" (\"DEPTNO\", \"DNAME\", \"LOC\")\n" @@ -4957,7 +4957,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testInsertValuesWithExplicitColumnsAndDynamicParams() { + @Test void testInsertValuesWithExplicitColumnsAndDynamicParams() { final String sql = "" + "insert into \"DEPT\" (\"DEPTNO\", \"DNAME\", \"LOC\")\n" + "values (?,?,?), (?,?,?)"; @@ -4973,7 +4973,7 @@ private void checkLiteral2(String expression, String expected) { .ok(expected); } - @Test public void testTableFunctionScan() { + @Test void testTableFunctionScan() { final String query = "SELECT *\n" + "FROM TABLE(DEDUP(CURSOR(select \"product_id\", \"product_name\"\n" + "from \"product\"), CURSOR(select \"employee_id\", \"full_name\"\n" @@ -4990,7 +4990,7 @@ private void checkLiteral2(String expression, String expected) { + "FROM TABLE(RAMP(3))"); } - @Test public void testTableFunctionScanWithComplexQuery() { + @Test void testTableFunctionScanWithComplexQuery() { final String query = "SELECT *\n" + "FROM TABLE(DEDUP(CURSOR(select \"product_id\", \"product_name\"\n" + "from \"product\"\n" @@ -5013,7 +5013,7 @@ private void checkLiteral2(String expression, String expected) { * [CALCITE-3593] * RelToSqlConverter changes target of ambiguous HAVING clause with a Project * on Filter on Aggregate. */ - @Test public void testBigQueryHaving() { + @Test void testBigQueryHaving() { final String sql = "" + "SELECT \"DEPTNO\" - 10 \"DEPTNO\"\n" + "FROM \"EMP\"\n" diff --git a/core/src/test/java/org/apache/calcite/rel/rules/DateRangeRulesTest.java b/core/src/test/java/org/apache/calcite/rel/rules/DateRangeRulesTest.java index 70bf0d1e8299..e729288bd53b 100644 --- a/core/src/test/java/org/apache/calcite/rel/rules/DateRangeRulesTest.java +++ b/core/src/test/java/org/apache/calcite/rel/rules/DateRangeRulesTest.java @@ -38,9 +38,9 @@ import static org.hamcrest.core.Is.is; /** Unit tests for {@link DateRangeRules} algorithms. */ -public class DateRangeRulesTest { +class DateRangeRulesTest { - @Test public void testExtractYearFromDateColumn() { + @Test void testExtractYearFromDateColumn() { final Fixture2 f = new Fixture2(); final RexNode e = f.eq(f.literal(2014), f.exYearD); @@ -65,7 +65,7 @@ public class DateRangeRulesTest { is("<>(EXTRACT(FLAG(YEAR), $8), 2014)")); } - @Test public void testExtractYearFromTimestampColumn() { + @Test void testExtractYearFromTimestampColumn() { final Fixture2 f = new Fixture2(); checkDateRange(f, f.eq(f.exYearTs, f.literal(2014)), is("AND(>=($9, 2014-01-01 00:00:00), <($9, 2015-01-01 00:00:00))")); @@ -81,7 +81,7 @@ public class DateRangeRulesTest { is("<>(EXTRACT(FLAG(YEAR), $9), 2014)")); } - @Test public void testExtractYearAndMonthFromDateColumn() { + @Test void testExtractYearAndMonthFromDateColumn() { final Fixture2 f = new Fixture2(); checkDateRange(f, f.and(f.eq(f.exYearD, f.literal(2014)), f.eq(f.exMonthD, f.literal(6))), @@ -95,7 +95,7 @@ public class DateRangeRulesTest { /** Test case for * [CALCITE-1601] * DateRangeRules loses OR filters. */ - @Test public void testExtractYearAndMonthFromDateColumn2() { + @Test void testExtractYearAndMonthFromDateColumn2() { final Fixture2 f = new Fixture2(); final String s1 = "AND(" + "AND(>=($8, 2000-01-01), <($8, 2001-01-01))," @@ -116,7 +116,7 @@ public class DateRangeRulesTest { checkDateRange(f, e, "UTC", is(s1), is(s2)); } - @Test public void testExtractYearAndDayFromDateColumn() { + @Test void testExtractYearAndDayFromDateColumn() { final Fixture2 f = new Fixture2(); checkDateRange(f, f.and(f.eq(f.exYearD, f.literal(2010)), f.eq(f.exDayD, f.literal(31))), @@ -131,7 +131,7 @@ public class DateRangeRulesTest { } - @Test public void testExtractYearMonthDayFromDateColumn() { + @Test void testExtractYearMonthDayFromDateColumn() { final Fixture2 f = new Fixture2(); // The following condition finds the 2 leap days between 2010 and 2020, // namely 29th February 2012 and 2016. @@ -158,7 +158,7 @@ public class DateRangeRulesTest { + " AND(>=($8, 2016-02-29), <($8, 2016-03-01))))")); } - @Test public void testExtractYearMonthDayFromTimestampColumn() { + @Test void testExtractYearMonthDayFromTimestampColumn() { final Fixture2 f = new Fixture2(); checkDateRange(f, f.and(f.gt(f.exYearD, f.literal(2010)), @@ -182,7 +182,7 @@ public class DateRangeRulesTest { /** Test case #1 for * [CALCITE-1658] * DateRangeRules issues. */ - @Test public void testExtractWithOrCondition1() { + @Test void testExtractWithOrCondition1() { // (EXTRACT(YEAR FROM __time) = 2000 // AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) // OR (EXTRACT(YEAR FROM __time) = 2001 @@ -207,7 +207,7 @@ public class DateRangeRulesTest { /** Test case #2 for * [CALCITE-1658] * DateRangeRules issues. */ - @Test public void testExtractWithOrCondition2() { + @Test void testExtractWithOrCondition2() { // EXTRACT(YEAR FROM __time) IN (2000, 2001) // AND ((EXTRACT(YEAR FROM __time) = 2000 // AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) @@ -238,7 +238,7 @@ public class DateRangeRulesTest { /** Test case #3 for * [CALCITE-1658] * DateRangeRules issues. */ - @Test public void testExtractPartialRewriteForNotEqualsYear() { + @Test void testExtractPartialRewriteForNotEqualsYear() { // EXTRACT(YEAR FROM __time) <> 2000 // AND ((EXTRACT(YEAR FROM __time) = 2000 // AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) @@ -267,7 +267,7 @@ public class DateRangeRulesTest { /** Test case #4 for * [CALCITE-1658] * DateRangeRules issues. */ - @Test public void testExtractPartialRewriteForInMonth() { + @Test void testExtractPartialRewriteForInMonth() { // EXTRACT(MONTH FROM __time) in (1, 2, 3, 4, 5) // AND ((EXTRACT(YEAR FROM __time) = 2000 // AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) @@ -301,7 +301,7 @@ public class DateRangeRulesTest { + " AND(>=($8, 2001-01-01), <($8, 2001-02-01)))))")); } - @Test public void testExtractRewriteForInvalidMonthComparison() { + @Test void testExtractRewriteForInvalidMonthComparison() { // "EXTRACT(MONTH FROM ts) = 14" will never be TRUE final Fixture2 f = new Fixture2(); checkDateRange(f, @@ -341,7 +341,7 @@ public class DateRangeRulesTest { + " AND(>=($9, 2010-01-01 00:00:00), <($9, 2010-02-01 00:00:00)))")); } - @Test public void testExtractRewriteForInvalidDayComparison() { + @Test void testExtractRewriteForInvalidDayComparison() { final Fixture2 f = new Fixture2(); checkDateRange(f, f.and(f.eq(f.exYearTs, f.literal(2010)), @@ -358,7 +358,7 @@ public class DateRangeRulesTest { + " AND(>=($9, 2010-02-01 00:00:00), <($9, 2010-03-01 00:00:00)), false)")); } - @Test public void testUnboundYearExtractRewrite() { + @Test void testUnboundYearExtractRewrite() { final Fixture2 f = new Fixture2(); // No lower bound on YEAR checkDateRange(f, @@ -388,7 +388,7 @@ public class DateRangeRulesTest { } // Test reWrite with multiple operands - @Test public void testExtractRewriteMultipleOperands() { + @Test void testExtractRewriteMultipleOperands() { final Fixture2 f = new Fixture2(); checkDateRange(f, f.and(f.eq(f.exYearTs, f.literal(2010)), @@ -409,7 +409,7 @@ public class DateRangeRulesTest { + " <($8, 2011-06-01)))")); } - @Test public void testFloorEqRewrite() { + @Test void testFloorEqRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -460,7 +460,7 @@ public class DateRangeRulesTest { is("AND(>=($9, 2010-02-04 02:59:00), <($9, 2010-02-04 03:00:00))")); } - @Test public void testFloorLtRewrite() { + @Test void testFloorLtRewrite() { final Calendar c = Util.calendar(); c.clear(); @@ -475,7 +475,7 @@ public class DateRangeRulesTest { is("<($9, 2010-01-01 00:00:00)")); } - @Test public void testFloorLeRewrite() { + @Test void testFloorLeRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -489,7 +489,7 @@ public class DateRangeRulesTest { is("<($9, 2011-01-01 00:00:00)")); } - @Test public void testFloorGtRewrite() { + @Test void testFloorGtRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -503,7 +503,7 @@ public class DateRangeRulesTest { is(">=($9, 2011-01-01 00:00:00)")); } - @Test public void testFloorGeRewrite() { + @Test void testFloorGeRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -517,7 +517,7 @@ public class DateRangeRulesTest { is(">=($9, 2010-01-01 00:00:00)")); } - @Test public void testFloorExtractBothRewrite() { + @Test void testFloorExtractBothRewrite() { final Calendar c = Util.calendar(); c.clear(); Fixture2 f = new Fixture2(); @@ -551,7 +551,7 @@ public class DateRangeRulesTest { } - @Test public void testCeilEqRewrite() { + @Test void testCeilEqRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -602,7 +602,7 @@ public class DateRangeRulesTest { is("AND(>($9, 2010-02-04 02:58:00), <=($9, 2010-02-04 02:59:00))")); } - @Test public void testCeilLtRewrite() { + @Test void testCeilLtRewrite() { final Calendar c = Util.calendar(); c.clear(); @@ -617,7 +617,7 @@ public class DateRangeRulesTest { is("<=($9, 2009-01-01 00:00:00)")); } - @Test public void testCeilLeRewrite() { + @Test void testCeilLeRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -631,7 +631,7 @@ public class DateRangeRulesTest { is("<=($9, 2010-01-01 00:00:00)")); } - @Test public void testCeilGtRewrite() { + @Test void testCeilGtRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -645,7 +645,7 @@ public class DateRangeRulesTest { is(">($9, 2010-01-01 00:00:00)")); } - @Test public void testCeilGeRewrite() { + @Test void testCeilGeRewrite() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05); @@ -659,7 +659,7 @@ public class DateRangeRulesTest { is(">($9, 2009-01-01 00:00:00)")); } - @Test public void testFloorRewriteWithTimezone() { + @Test void testFloorRewriteWithTimezone() { final Calendar c = Util.calendar(); c.clear(); c.set(2010, Calendar.FEBRUARY, 1, 11, 30, 0); diff --git a/core/src/test/java/org/apache/calcite/rel/rules/EnumerableLimitRuleTest.java b/core/src/test/java/org/apache/calcite/rel/rules/EnumerableLimitRuleTest.java index 11d1bbf35977..e3b2ac30b970 100644 --- a/core/src/test/java/org/apache/calcite/rel/rules/EnumerableLimitRuleTest.java +++ b/core/src/test/java/org/apache/calcite/rel/rules/EnumerableLimitRuleTest.java @@ -48,14 +48,14 @@ /** * Tests the application of the {@code EnumerableLimitRule}. */ -public class EnumerableLimitRuleTest { +class EnumerableLimitRuleTest { /** Test case for * [CALCITE-2941] * EnumerableLimitRule on Sort with no collation creates EnumerableLimit with * wrong traitSet and cluster. */ - @Test public void enumerableLimitOnEmptySort() throws Exception { + @Test void enumerableLimitOnEmptySort() throws Exception { RuleSet prepareRules = RuleSets.ofList( EnumerableRules.ENUMERABLE_FILTER_RULE, diff --git a/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java b/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java index 6dde95c9ad7a..91a038c70d95 100644 --- a/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java +++ b/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java @@ -85,7 +85,7 @@ private RelNode transform(String sql, RuleSet prepareRules) throws Exception { *

Since join inputs are sorted, and this join preserves the order of the * left input, there shouldn't be any sort operator above the join. */ - @Test public void removeSortOverEnumerableHashJoin() throws Exception { + @Test void removeSortOverEnumerableHashJoin() throws Exception { RuleSet prepareRules = RuleSets.ofList( SortProjectTransposeRule.INSTANCE, @@ -116,7 +116,7 @@ private RelNode transform(String sql, RuleSet prepareRules) throws Exception { *

Since join inputs are sorted, and this join preserves the order of the * left input, there shouldn't be any sort operator above the join. */ - @Test public void removeSortOverEnumerableNestedLoopJoin() throws Exception { + @Test void removeSortOverEnumerableNestedLoopJoin() throws Exception { RuleSet prepareRules = RuleSets.ofList( SortProjectTransposeRule.INSTANCE, @@ -150,7 +150,7 @@ private RelNode transform(String sql, RuleSet prepareRules) throws Exception { * *

Until CALCITE-2018 is fixed we can add back EnumerableRules.ENUMERABLE_SORT_RULE */ - @Test public void removeSortOverEnumerableCorrelate() throws Exception { + @Test void removeSortOverEnumerableCorrelate() throws Exception { RuleSet prepareRules = RuleSets.ofList( SortProjectTransposeRule.INSTANCE, @@ -181,7 +181,7 @@ private RelNode transform(String sql, RuleSet prepareRules) throws Exception { *

Since join inputs are sorted, and this join preserves the order of the * left input, there shouldn't be any sort operator above the join. */ - @Test public void removeSortOverEnumerableSemiJoin() throws Exception { + @Test void removeSortOverEnumerableSemiJoin() throws Exception { RuleSet prepareRules = RuleSets.ofList( SortProjectTransposeRule.INSTANCE, diff --git a/core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java b/core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java index 9d9f48708a62..8c8275535d46 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java @@ -56,7 +56,7 @@ /** * Test for {@link RexBuilder}. */ -public class RexBuilderTest { +class RexBuilderTest { private static final int PRECISION = 256; @@ -85,7 +85,7 @@ private static class MySqlTypeFactoryImpl extends SqlTypeFactoryImpl { /** * Test RexBuilder.ensureType() */ - @Test public void testEnsureTypeWithAny() { + @Test void testEnsureTypeWithAny() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RexBuilder builder = new RexBuilder(typeFactory); @@ -100,7 +100,7 @@ private static class MySqlTypeFactoryImpl extends SqlTypeFactoryImpl { /** * Test RexBuilder.ensureType() */ - @Test public void testEnsureTypeWithItself() { + @Test void testEnsureTypeWithItself() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RexBuilder builder = new RexBuilder(typeFactory); @@ -115,7 +115,7 @@ private static class MySqlTypeFactoryImpl extends SqlTypeFactoryImpl { /** * Test RexBuilder.ensureType() */ - @Test public void testEnsureTypeWithDifference() { + @Test void testEnsureTypeWithDifference() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RexBuilder builder = new RexBuilder(typeFactory); @@ -135,7 +135,7 @@ private static class MySqlTypeFactoryImpl extends SqlTypeFactoryImpl { private static final int MOON_TIME = 10575000; /** Tests {@link RexBuilder#makeTimestampLiteral(TimestampString, int)}. */ - @Test public void testTimestampLiteral() { + @Test void testTimestampLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType timestampType = @@ -216,7 +216,7 @@ private void checkTimestamp(RexNode node) { /** Tests * {@link RexBuilder#makeTimestampWithLocalTimeZoneLiteral(TimestampString, int)}. */ - @Test public void testTimestampWithLocalTimeZoneLiteral() { + @Test void testTimestampWithLocalTimeZoneLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType timestampType = @@ -286,7 +286,7 @@ private void checkTimestampWithLocalTimeZone(RexNode node) { } /** Tests {@link RexBuilder#makeTimeLiteral(TimeString, int)}. */ - @Test public void testTimeLiteral() { + @Test void testTimeLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType timeType = typeFactory.createSqlType(SqlTypeName.TIME); @@ -365,7 +365,7 @@ private void checkTime(RexNode node) { } /** Tests {@link RexBuilder#makeDateLiteral(DateString)}. */ - @Test public void testDateLiteral() { + @Test void testDateLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType dateType = typeFactory.createSqlType(SqlTypeName.DATE); @@ -400,7 +400,7 @@ private void checkDate(RexNode node) { * [CALCITE-2306] * AssertionError in {@link RexLiteral#getValue3} with null literal of type * DECIMAL. */ - @Test public void testDecimalLiteral() { + @Test void testDecimalLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType type = typeFactory.createSqlType(SqlTypeName.DECIMAL); @@ -413,7 +413,7 @@ private void checkDate(RexNode node) { * [CALCITE-3587] * RexBuilder may lose decimal fraction for creating literal with DECIMAL type. */ - @Test public void testDecimal() { + @Test void testDecimal() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType type = typeFactory.createSqlType(SqlTypeName.DECIMAL, 4, 2); @@ -428,7 +428,7 @@ private void checkDate(RexNode node) { } /** Tests {@link DateString} year range. */ - @Test public void testDateStringYearError() { + @Test void testDateStringYearError() { try { final DateString dateString = new DateString(11969, 7, 21); fail("expected exception, got " + dateString); @@ -445,7 +445,7 @@ private void checkDate(RexNode node) { } /** Tests {@link DateString} month range. */ - @Test public void testDateStringMonthError() { + @Test void testDateStringMonthError() { try { final DateString dateString = new DateString(1969, 27, 21); fail("expected exception, got " + dateString); @@ -461,7 +461,7 @@ private void checkDate(RexNode node) { } /** Tests {@link DateString} day range. */ - @Test public void testDateStringDayError() { + @Test void testDateStringDayError() { try { final DateString dateString = new DateString(1969, 7, 41); fail("expected exception, got " + dateString); @@ -480,7 +480,7 @@ private void checkDate(RexNode node) { } /** Tests {@link TimeString} hour range. */ - @Test public void testTimeStringHourError() { + @Test void testTimeStringHourError() { try { final TimeString timeString = new TimeString(111, 34, 56); fail("expected exception, got " + timeString); @@ -503,7 +503,7 @@ private void checkDate(RexNode node) { } /** Tests {@link TimeString} minute range. */ - @Test public void testTimeStringMinuteError() { + @Test void testTimeStringMinuteError() { try { final TimeString timeString = new TimeString(12, 334, 56); fail("expected exception, got " + timeString); @@ -519,7 +519,7 @@ private void checkDate(RexNode node) { } /** Tests {@link TimeString} second range. */ - @Test public void testTimeStringSecondError() { + @Test void testTimeStringSecondError() { try { final TimeString timeString = new TimeString(12, 34, 567); fail("expected exception, got " + timeString); @@ -543,7 +543,7 @@ private void checkDate(RexNode node) { /** * Test string literal encoding. */ - @Test public void testStringLiteral() { + @Test void testStringLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType varchar = @@ -589,7 +589,7 @@ private void checkDate(RexNode node) { } /** Tests {@link RexBuilder#makeExactLiteral(java.math.BigDecimal)}. */ - @Test public void testBigDecimalLiteral() { + @Test void testBigDecimalLiteral() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RexBuilder builder = new RexBuilder(typeFactory); @@ -605,7 +605,7 @@ private void checkDate(RexNode node) { } /** Tests {@link RexCopier#visitOver(RexOver)} */ - @Test public void testCopyOver() { + @Test void testCopyOver() { final RelDataTypeFactory sourceTypeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType type = sourceTypeFactory.createSqlType(SqlTypeName.VARCHAR, 65536); @@ -644,7 +644,7 @@ private void checkDate(RexNode node) { } /** Tests {@link RexCopier#visitCorrelVariable(RexCorrelVariable)} */ - @Test public void testCopyCorrelVariable() { + @Test void testCopyCorrelVariable() { final RelDataTypeFactory sourceTypeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType type = sourceTypeFactory.createSqlType(SqlTypeName.VARCHAR, 65536); @@ -665,7 +665,7 @@ private void checkDate(RexNode node) { } /** Tests {@link RexCopier#visitLocalRef(RexLocalRef)} */ - @Test public void testCopyLocalRef() { + @Test void testCopyLocalRef() { final RelDataTypeFactory sourceTypeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType type = sourceTypeFactory.createSqlType(SqlTypeName.VARCHAR, 65536); @@ -685,7 +685,7 @@ private void checkDate(RexNode node) { } /** Tests {@link RexCopier#visitDynamicParam(RexDynamicParam)} */ - @Test public void testCopyDynamicParam() { + @Test void testCopyDynamicParam() { final RelDataTypeFactory sourceTypeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType type = sourceTypeFactory.createSqlType(SqlTypeName.VARCHAR, 65536); @@ -705,7 +705,7 @@ private void checkDate(RexNode node) { } /** Tests {@link RexCopier#visitRangeRef(RexRangeRef)} */ - @Test public void testCopyRangeRef() { + @Test void testCopyRangeRef() { final RelDataTypeFactory sourceTypeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); RelDataType type = sourceTypeFactory.createSqlType(SqlTypeName.VARCHAR, 65536); diff --git a/core/src/test/java/org/apache/calcite/rex/RexCallNormalizationTest.java b/core/src/test/java/org/apache/calcite/rex/RexCallNormalizationTest.java index a7f2fe0fa623..e1bcbe4dbb61 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexCallNormalizationTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexCallNormalizationTest.java @@ -18,8 +18,8 @@ import org.junit.jupiter.api.Test; -public class RexCallNormalizationTest extends RexProgramTestBase { - @Test public void digestIsNormalized() { +class RexCallNormalizationTest extends RexProgramTestBase { + @Test void digestIsNormalized() { final RexNode node = and(or(vBool(1), vBool()), vBool()); checkDigest(node, "AND(?0.bool0, OR(?0.bool0, ?0.bool1))"); checkRaw(node, "AND(OR(?0.bool1, ?0.bool0), ?0.bool0)"); @@ -29,7 +29,7 @@ public class RexCallNormalizationTest extends RexProgramTestBase { checkDigest(eq(vVarchar(), literal("01")), "=('01', ?0.varchar0)"); } - @Test public void skipNormalizationWorks() { + @Test void skipNormalizationWorks() { final RexNode node = and(or(vBool(1), vBool()), vBool()); try (RexNode.Closeable ignored = RexNode.skipNormalize()) { checkDigest(node, "AND(OR(?0.bool1, ?0.bool0), ?0.bool0)"); @@ -37,33 +37,33 @@ public class RexCallNormalizationTest extends RexProgramTestBase { } } - @Test public void skipNormalizeWorks() { + @Test void skipNormalizeWorks() { checkDigest(and(or(vBool(1), vBool()), vBool()), "AND(?0.bool0, OR(?0.bool0, ?0.bool1))"); } - @Test public void reversibleSameArgOpsNormalizedToLess() { + @Test void reversibleSameArgOpsNormalizedToLess() { checkDigest(lt(vBool(), vBool()), "<(?0.bool0, ?0.bool0)"); checkDigest(gt(vBool(), vBool()), "<(?0.bool0, ?0.bool0)"); checkDigest(le(vBool(), vBool()), "<=(?0.bool0, ?0.bool0)"); checkDigest(ge(vBool(), vBool()), "<=(?0.bool0, ?0.bool0)"); } - @Test public void reversibleDifferentArgTypesShouldNotBeShuffled() { + @Test void reversibleDifferentArgTypesShouldNotBeShuffled() { checkDigest(plus(vSmallInt(), vInt()), "+(?0.smallint0, ?0.int0)"); checkDigest(plus(vInt(), vSmallInt()), "+(?0.int0, ?0.smallint0)"); checkDigest(mul(vSmallInt(), vInt()), "*(?0.smallint0, ?0.int0)"); checkDigest(mul(vInt(), vSmallInt()), "*(?0.int0, ?0.smallint0)"); } - @Test public void reversibleDifferentNullabilityArgsAreNormalized() { + @Test void reversibleDifferentNullabilityArgsAreNormalized() { checkDigest(plus(vIntNotNull(), vInt()), "+(?0.int0, ?0.notNullInt0)"); checkDigest(plus(vInt(), vIntNotNull()), "+(?0.int0, ?0.notNullInt0)"); checkDigest(mul(vIntNotNull(), vInt()), "*(?0.int0, ?0.notNullInt0)"); checkDigest(mul(vInt(), vIntNotNull()), "*(?0.int0, ?0.notNullInt0)"); } - @Test public void symmetricalDifferentArgOps() { + @Test void symmetricalDifferentArgOps() { for (int i = 0; i < 2; i++) { int j = 1 - i; checkDigest(eq(vBool(i), vBool(j)), "=(?0.bool0, ?0.bool1)"); @@ -71,7 +71,7 @@ public class RexCallNormalizationTest extends RexProgramTestBase { } } - @Test public void reversibleDifferentArgOps() { + @Test void reversibleDifferentArgOps() { for (int i = 0; i < 2; i++) { int j = 1 - i; checkDigest( diff --git a/core/src/test/java/org/apache/calcite/rex/RexExecutorTest.java b/core/src/test/java/org/apache/calcite/rex/RexExecutorTest.java index de3a1ad5430c..a8a8226fad76 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexExecutorTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexExecutorTest.java @@ -63,10 +63,7 @@ /** * Unit test for {@link org.apache.calcite.rex.RexExecutorImpl}. */ -public class RexExecutorTest { - public RexExecutorTest() { - } - +class RexExecutorTest { protected void check(final Action action) throws Exception { Frameworks.withPrepare((cluster, relOptSchema, rootSchema, statement) -> { final RexBuilder rexBuilder = cluster.getRexBuilder(); @@ -80,7 +77,7 @@ protected void check(final Action action) throws Exception { /** Tests an executor that uses variables stored in a {@link DataContext}. * Can change the value of the variable and execute again. */ - @Test public void testVariableExecution() throws Exception { + @Test void testVariableExecution() throws Exception { check((rexBuilder, executor) -> { Object[] values = new Object[1]; final DataContext testContext = new TestDataContext(values); @@ -116,7 +113,7 @@ protected void check(final Action action) throws Exception { }); } - @Test public void testConstant() throws Exception { + @Test void testConstant() throws Exception { check((rexBuilder, executor) -> { final List reducedValues = new ArrayList<>(); final RexLiteral ten = rexBuilder.makeExactLiteral(BigDecimal.TEN); @@ -130,7 +127,7 @@ protected void check(final Action action) throws Exception { } /** Reduces several expressions to constants. */ - @Test public void testConstant2() throws Exception { + @Test void testConstant2() throws Exception { // Same as testConstant; 10 -> 10 checkConstant(10L, rexBuilder -> rexBuilder.makeExactLiteral(BigDecimal.TEN)); @@ -180,17 +177,17 @@ private void checkConstant(final Object operand, }); } - @Test public void testUserFromContext() throws Exception { + @Test void testUserFromContext() throws Exception { testContextLiteral(SqlStdOperatorTable.USER, DataContext.Variable.USER, "happyCalciteUser"); } - @Test public void testSystemUserFromContext() throws Exception { + @Test void testSystemUserFromContext() throws Exception { testContextLiteral(SqlStdOperatorTable.SYSTEM_USER, DataContext.Variable.SYSTEM_USER, ""); } - @Test public void testTimestampFromContext() throws Exception { + @Test void testTimestampFromContext() throws Exception { // CURRENT_TIMESTAMP actually rounds the value to nearest second // and that's why we do currentTimeInMillis / 1000 * 1000 long val = System.currentTimeMillis() / 1000 * 1000; @@ -229,7 +226,7 @@ private void testContextLiteral( }); } - @Test public void testSubstring() throws Exception { + @Test void testSubstring() throws Exception { check((rexBuilder, executor) -> { final List reducedValues = new ArrayList<>(); final RexLiteral hello = @@ -255,7 +252,7 @@ private void testContextLiteral( }); } - @Test public void testBinarySubstring() throws Exception { + @Test void testBinarySubstring() throws Exception { check((rexBuilder, executor) -> { final List reducedValues = new ArrayList<>(); // hello world! -> 48656c6c6f20776f726c6421 @@ -282,7 +279,7 @@ private void testContextLiteral( }); } - @Test public void testDeterministic1() throws Exception { + @Test void testDeterministic1() throws Exception { check((rexBuilder, executor) -> { final RexNode plus = rexBuilder.makeCall(SqlStdOperatorTable.PLUS, @@ -292,7 +289,7 @@ private void testContextLiteral( }); } - @Test public void testDeterministic2() throws Exception { + @Test void testDeterministic2() throws Exception { check((rexBuilder, executor) -> { final RexNode plus = rexBuilder.makeCall(PLUS_RANDOM, @@ -302,7 +299,7 @@ private void testContextLiteral( }); } - @Test public void testDeterministic3() throws Exception { + @Test void testDeterministic3() throws Exception { check((rexBuilder, executor) -> { final RexNode plus = rexBuilder.makeCall(SqlStdOperatorTable.PLUS, @@ -331,7 +328,7 @@ private void testContextLiteral( /** Test case for * [CALCITE-1009] * SelfPopulatingList is not thread-safe. */ - @Test public void testSelfPopulatingList() { + @Test void testSelfPopulatingList() { final List threads = new ArrayList<>(); //noinspection MismatchedQueryAndUpdateOfCollection final List list = new RexSlot.SelfPopulatingList("$", 1); @@ -365,7 +362,7 @@ public void run() { } } - @Test public void testSelfPopulatingList30() { + @Test void testSelfPopulatingList30() { //noinspection MismatchedQueryAndUpdateOfCollection final List list = new RexSlot.SelfPopulatingList("$", 30); final String s = list.get(30); @@ -392,11 +389,11 @@ private TestDataContext(Object[] values) { /** * Context that holds a value for a particular context name. */ - public static class SingleValueDataContext implements DataContext { + static class SingleValueDataContext implements DataContext { private final String name; private final Object value; - public SingleValueDataContext(String name, Object value) { + SingleValueDataContext(String name, Object value) { this.name = name; this.value = value; } diff --git a/core/src/test/java/org/apache/calcite/rex/RexLosslessCastTest.java b/core/src/test/java/org/apache/calcite/rex/RexLosslessCastTest.java index 7c7fa4127c0e..7124ac193811 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexLosslessCastTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexLosslessCastTest.java @@ -27,9 +27,9 @@ /** * Tests for {@link org.apache.calcite.rex.RexUtil#isLosslessCast(RexNode)} and related cases. */ -public class RexLosslessCastTest extends RexProgramTestBase { +class RexLosslessCastTest extends RexProgramTestBase { /** Unit test for {@link org.apache.calcite.rex.RexUtil#isLosslessCast(RexNode)}. */ - @Test public void testLosslessCast() { + @Test void testLosslessCast() { final RelDataType tinyIntType = typeFactory.createSqlType(SqlTypeName.TINYINT); final RelDataType smallIntType = typeFactory.createSqlType(SqlTypeName.SMALLINT); final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); @@ -127,7 +127,7 @@ public class RexLosslessCastTest extends RexProgramTestBase { varCharType11, rexBuilder.makeInputRef(varCharType10, 0))), is(true)); } - @Test public void removeRedundantCast() { + @Test void removeRedundantCast() { checkSimplify(cast(vInt(), nullable(tInt())), "?0.int0"); checkSimplifyUnchanged(cast(vInt(), tInt())); checkSimplify(cast(vIntNotNull(), nullable(tInt())), "?0.notNullInt0"); @@ -139,7 +139,7 @@ public class RexLosslessCastTest extends RexProgramTestBase { checkSimplifyUnchanged(cast(cast(vVarchar(), tInt()), tVarchar())); } - @Test public void removeLosslesssCastInt() { + @Test void removeLosslesssCastInt() { checkSimplifyUnchanged(cast(vInt(), tBigInt())); // A.1 checkSimplify(cast(cast(vInt(), tBigInt()), tInt()), "CAST(?0.int0):INTEGER NOT NULL"); @@ -153,7 +153,7 @@ public class RexLosslessCastTest extends RexProgramTestBase { "?0.notNullInt0"); } - @Test public void removeLosslesssCastChar() { + @Test void removeLosslesssCastChar() { checkSimplifyUnchanged(cast(vVarchar(), tChar(3))); checkSimplifyUnchanged(cast(cast(vVarchar(), tChar(3)), tVarchar(5))); diff --git a/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java b/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java index 14d2c0d4ecb0..063f1aa63518 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java @@ -68,11 +68,11 @@ * Unit tests for {@link RexProgram} and * {@link org.apache.calcite.rex.RexProgramBuilder}. */ -public class RexProgramTest extends RexProgramTestBase { +class RexProgramTest extends RexProgramTestBase { /** * Tests construction of a RexProgram. */ - @Test public void testBuildProgram() { + @Test void testBuildProgram() { final RexProgramBuilder builder = createProg(0); final RexProgram program = builder.getProgram(false); final String programString = program.toString(); @@ -97,7 +97,7 @@ public class RexProgramTest extends RexProgramTestBase { /** * Tests construction and normalization of a RexProgram. */ - @Test public void testNormalize() { + @Test void testNormalize() { final RexProgramBuilder builder = createProg(0); final String program = builder.getProgram(true).toString(); TestUtil.assertEqualsVerbose( @@ -110,7 +110,7 @@ public class RexProgramTest extends RexProgramTestBase { /** * Tests construction and normalization of a RexProgram. */ - @Test public void testElimDups() { + @Test void testElimDups() { final RexProgramBuilder builder = createProg(1); final String unnormalizedProgram = builder.getProgram(false).toString(); TestUtil.assertEqualsVerbose( @@ -132,7 +132,7 @@ public class RexProgramTest extends RexProgramTestBase { /** * Tests how the condition is simplified. */ - @Test public void testSimplifyCondition() { + @Test void testSimplifyCondition() { final RexProgram program = createProg(3).getProgram(false); assertThat(program.toString(), is("(expr#0..1=[{inputs}], expr#2=[+($0, 1)], expr#3=[77], " @@ -152,7 +152,7 @@ public class RexProgramTest extends RexProgramTestBase { /** * Tests how the condition is simplified. */ - @Test public void testSimplifyCondition2() { + @Test void testSimplifyCondition2() { final RexProgram program = createProg(4).getProgram(false); assertThat(program.toString(), is("(expr#0..1=[{inputs}], expr#2=[+($0, 1)], expr#3=[77], " @@ -173,7 +173,7 @@ public class RexProgramTest extends RexProgramTestBase { /** * Checks translation of AND(x, x). */ - @Test public void testDuplicateAnd() { + @Test void testDuplicateAnd() { // RexProgramBuilder used to translate AND(x, x) to x. // Now it translates it to AND(x, x). // The optimization of AND(x, x) => x occurs at a higher level. @@ -347,7 +347,7 @@ private RexProgramBuilder createProg(int variant) { } /** Unit test for {@link org.apache.calcite.plan.Strong}. */ - @Test public void testStrong() { + @Test void testStrong() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final ImmutableBitSet c = ImmutableBitSet.of(); @@ -471,7 +471,7 @@ private RexProgramBuilder createProg(int variant) { } - @Test public void testItemStrong() { + @Test void testItemStrong() { final ImmutableBitSet c0 = ImmutableBitSet.of(0); RexNode item = item(input(tArray(tInt()), 0), literal(0)); @@ -485,7 +485,7 @@ private RexProgramBuilder createProg(int variant) { assertThat(Strong.isNull(item, c0), is(true)); } - @Test public void xAndNotX() { + @Test void xAndNotX() { checkSimplify2( and(vBool(), not(vBool()), vBool(1), not(vBool(1))), @@ -505,7 +505,7 @@ private RexProgramBuilder createProg(int variant) { } @Disabled("CALCITE-3457: AssertionError in RexSimplify.validateStrongPolicy") - @Test public void reproducerFor3457() { + @Test void reproducerFor3457() { // Identified with RexProgramFuzzyTest#testFuzzy, seed=4887662474363391810L checkSimplify( eq(unaryMinus(abstractCast(literal(1), tInt(true))), @@ -513,7 +513,7 @@ private RexProgramBuilder createProg(int variant) { "true"); } - @Test public void testNoCommonReturnTypeFails() { + @Test void testNoCommonReturnTypeFails() { try { final RexNode node = coalesce(vVarchar(1), vInt(2)); fail("expected exception, got " + node); @@ -525,7 +525,7 @@ private RexProgramBuilder createProg(int variant) { } /** Unit test for {@link org.apache.calcite.rex.RexUtil#toCnf}. */ - @Test public void testCnf() { + @Test void testCnf() { final RelDataType booleanType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); @@ -602,7 +602,7 @@ private RexProgramBuilder createProg(int variant) { * [CALCITE-394] * Add RexUtil.toCnf, to convert expressions to conjunctive normal form * (CNF). */ - @Test public void testCnf2() { + @Test void testCnf2() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("x", intType) @@ -670,7 +670,7 @@ private RexProgramBuilder createProg(int variant) { /** Unit test for * [CALCITE-1290] * When converting to CNF, fail if the expression exceeds a threshold. */ - @Test public void testThresholdCnf() { + @Test void testThresholdCnf() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("x", intType) @@ -713,7 +713,7 @@ private RexProgramBuilder createProg(int variant) { /** Tests formulas of various sizes whose size is exponential when converted * to CNF. */ - @Test public void testCnfExponential() { + @Test void testCnfExponential() { // run out of memory if limit is higher than about 20 int limit = 16; for (int i = 2; i < limit; i++) { @@ -750,7 +750,7 @@ private void checkExponentialCnf(int n) { } /** Unit test for {@link org.apache.calcite.rex.RexUtil#pullFactors}. */ - @Test public void testPullFactors() { + @Test void testPullFactors() { final RelDataType booleanType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); @@ -820,7 +820,7 @@ private void checkExponentialCnf(int n) { and(gRef, or(trueLiteral, falseLiteral))))))))); } - @Test public void testSimplify() { + @Test void testSimplify() { final RelDataType booleanType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); @@ -1040,7 +1040,7 @@ private void checkExponentialCnf(int n) { "IS NOT NULL(?0.int1)"); } - @Test public void simplifyStrong() { + @Test void simplifyStrong() { checkSimplify(ge(trueLiteral, falseLiteral), "true"); checkSimplify3(ge(trueLiteral, nullBool), "null:BOOLEAN", "false", "true"); checkSimplify3(ge(nullBool, nullBool), "null:BOOLEAN", "false", "true"); @@ -1058,7 +1058,7 @@ private void checkExponentialCnf(int n) { checkSimplify(div(vInt(), nullInt), "null:INTEGER"); } - @Test public void testSimplifyFilter() { + @Test void testSimplifyFilter() { final RelDataType booleanType = typeFactory.createSqlType(SqlTypeName.BOOLEAN); final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); @@ -1253,7 +1253,7 @@ private void checkExponentialCnf(int n) { /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testSimplifyOrNotEqualsNotNullable() { + @Test void testSimplifyOrNotEqualsNotNullable() { checkSimplify( or( ne(vIntNotNull(), literal(1)), @@ -1264,7 +1264,7 @@ private void checkExponentialCnf(int n) { /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testSimplifyOrNotEqualsNotNullable2() { + @Test void testSimplifyOrNotEqualsNotNullable2() { checkSimplify( or( ne(vIntNotNull(0), literal(1)), @@ -1276,7 +1276,7 @@ private void checkExponentialCnf(int n) { /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testSimplifyOrNotEqualsNullable() { + @Test void testSimplifyOrNotEqualsNullable() { checkSimplify3( or( ne(vInt(), literal(1)), @@ -1287,7 +1287,7 @@ private void checkExponentialCnf(int n) { /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testSimplifyOrNotEqualsNullable2() { + @Test void testSimplifyOrNotEqualsNullable2() { checkSimplify3( or( ne(vInt(0), literal(1)), @@ -1298,7 +1298,7 @@ private void checkExponentialCnf(int n) { "true"); } - @Test public void testSimplifyAndPush() { + @Test void testSimplifyAndPush() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("a", intType) @@ -1369,7 +1369,7 @@ private void checkExponentialCnf(int n) { "false"); } - @Test public void testSimplifyOrTerms() { + @Test void testSimplifyOrTerms() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("a", intType).nullable(false) @@ -1462,7 +1462,7 @@ private void checkExponentialCnf(int n) { "true"); } - @Test public void testSimplifyItemRangeTerms() { + @Test void testSimplifyItemRangeTerms() { RexNode item = item(input(tArray(tInt()), 3), literal(1)); // paranoid validation doesn't support array types, disable it for a moment simplify = this.simplify.withParanoid(false); @@ -1476,7 +1476,7 @@ private void checkExponentialCnf(int n) { simplify = simplify.withParanoid(true); } - @Test public void testSimplifyNotAnd() { + @Test void testSimplifyNotAnd() { final RexNode e = or( le( vBool(1), @@ -1487,7 +1487,7 @@ private void checkExponentialCnf(int n) { checkSimplify(e, "OR(<=(?0.bool1, true), ?0.bool1)"); } - @Test public void testSimplifyUnknown() { + @Test void testSimplifyUnknown() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("a", intType).nullable(true) @@ -1539,7 +1539,7 @@ private void checkExponentialCnf(int n) { "true"); } - @Test public void testSimplifyAnd3() { + @Test void testSimplifyAnd3() { // in the case of 3-valued logic, the result must be unknown if a is unknown checkSimplify2( and(vBool(), not(vBool())), @@ -1550,7 +1550,7 @@ private void checkExponentialCnf(int n) { /** Unit test for * [CALCITE-2840] * Simplification should use more specific UnknownAs modes during simplification. */ - @Test public void testNestedAndSimplification() { + @Test void testNestedAndSimplification() { // to have the correct mode for the AND at the bottom, // both the OR and AND parent should retain the UnknownAs mode checkSimplify2( @@ -1565,21 +1565,21 @@ private void checkExponentialCnf(int n) { "AND(=(?0.int2, 2), OR(=(?0.int3, 3), =(?0.int0, 1)))"); } - @Test public void fieldAccessEqualsHashCode() { + @Test void fieldAccessEqualsHashCode() { assertEquals(vBool(), vBool(), "vBool() instances should be equal"); assertEquals(vBool().hashCode(), vBool().hashCode(), "vBool().hashCode()"); assertNotSame(vBool(), vBool(), "vBool() is expected to produce new RexFieldAccess"); assertNotEquals(vBool(0), vBool(1), "vBool(0) != vBool(1)"); } - @Test public void testSimplifyDynamicParam() { + @Test void testSimplifyDynamicParam() { checkSimplify(or(vBool(), vBool()), "?0.bool0"); } /** Unit test for * [CALCITE-1289] * RexUtil.simplifyCase() should account for nullability. */ - @Test public void testSimplifyCaseNotNullableBoolean() { + @Test void testSimplifyCaseNotNullableBoolean() { RexNode condition = eq(vVarchar(), literal("S")); RexCall caseNode = (RexCall) case_(condition, trueLiteral, falseLiteral); @@ -1591,7 +1591,7 @@ private void checkExponentialCnf(int n) { assertThat(result.getOperands().get(0), is(condition)); } - @Test public void testSimplifyCaseNullableBoolean() { + @Test void testSimplifyCaseNullableBoolean() { RexNode condition = eq(input(tVarchar(), 0), literal("S")); RexNode caseNode = case_(condition, trueLiteral, falseLiteral); @@ -1602,7 +1602,7 @@ private void checkExponentialCnf(int n) { assertThat(result, is(condition)); } - @Test public void testSimplifyRecurseIntoArithmetics() { + @Test void testSimplifyRecurseIntoArithmetics() { checkSimplify( plus(literal(1), case_( @@ -1612,7 +1612,7 @@ trueLiteral, literal(2), "+(1, 2)"); } - @Test public void testSimplifyCaseBranchesCollapse() { + @Test void testSimplifyCaseBranchesCollapse() { // case when x is true then 1 when x is not true then 1 else 2 end // => case when x is true or x is not true then 1 else 2 end checkSimplify( @@ -1623,7 +1623,7 @@ trueLiteral, literal(2), "CASE(OR(?0.bool0, IS NOT TRUE(?0.bool0)), 1, 2)"); } - @Test public void testSimplifyCaseBranchesCollapse2() { + @Test void testSimplifyCaseBranchesCollapse2() { // case when x is true then 1 when true then 1 else 2 end // => 1 checkSimplify( @@ -1634,7 +1634,7 @@ trueLiteral, literal(1), "1"); } - @Test public void testSimplifyCaseNullableVarChar() { + @Test void testSimplifyCaseNullableVarChar() { RexNode condition = eq(input(tVarchar(), 0), literal("S")); RexNode caseNode = case_(condition, literal("A"), literal("B")); @@ -1645,7 +1645,7 @@ trueLiteral, literal(1), assertThat(result, is(caseNode)); } - @Test public void testSimplifyCaseCasting() { + @Test void testSimplifyCaseCasting() { RexNode caseNode = case_(eq(vIntNotNull(), literal(3)), nullBool, falseLiteral); checkSimplify3(caseNode, "AND(=(?0.notNullInt0, 3), null)", @@ -1653,7 +1653,7 @@ trueLiteral, literal(1), "=(?0.notNullInt0, 3)"); } - @Test public void testSimplifyCaseAndNotSimplicationIsInAction() { + @Test void testSimplifyCaseAndNotSimplicationIsInAction() { RexNode caseNode = case_( eq(vIntNotNull(), literal(0)), falseLiteral, eq(vIntNotNull(), literal(1)), trueLiteral, @@ -1661,7 +1661,7 @@ trueLiteral, literal(1), checkSimplify(caseNode, "=(?0.notNullInt0, 1)"); } - @Test public void testSimplifyCaseBranchRemovalStrengthensType() { + @Test void testSimplifyCaseBranchRemovalStrengthensType() { RexNode caseNode = case_(falseLiteral, nullBool, eq(div(vInt(), literal(2)), literal(3)), trueLiteral, falseLiteral); @@ -1672,17 +1672,17 @@ trueLiteral, literal(1), res.getType().isNullable(), is(false)); } - @Test public void testSimplifyCaseCompaction() { + @Test void testSimplifyCaseCompaction() { RexNode caseNode = case_(vBool(0), vInt(0), vBool(1), vInt(0), vInt(1)); checkSimplify(caseNode, "CASE(OR(?0.bool0, ?0.bool1), ?0.int0, ?0.int1)"); } - @Test public void testSimplifyCaseCompaction2() { + @Test void testSimplifyCaseCompaction2() { RexNode caseNode = case_(vBool(0), vInt(0), vBool(1), vInt(1), vInt(1)); checkSimplify(caseNode, "CASE(?0.bool0, ?0.int0, ?0.int1)"); } - @Test public void testSimplifyCaseCompactionDiv() { + @Test void testSimplifyCaseCompactionDiv() { // FIXME: RexInterpreter currently evaluates children beforehand. simplify = simplify.withParanoid(false); RexNode caseNode = case_(vBool(0), vInt(0), @@ -1693,7 +1693,7 @@ trueLiteral, literal(1), } /** Tests a CASE value branch that contains division. */ - @Test public void testSimplifyCaseDiv1() { + @Test void testSimplifyCaseDiv1() { // FIXME: RexInterpreter currently evaluates children beforehand. simplify = simplify.withParanoid(false); RexNode caseNode = case_( @@ -1704,7 +1704,7 @@ trueLiteral, literal(1), } /** Tests a CASE condition that contains division, */ - @Test public void testSimplifyCaseDiv2() { + @Test void testSimplifyCaseDiv2() { // FIXME: RexInterpreter currently evaluates children beforehand. simplify = simplify.withParanoid(false); RexNode caseNode = case_( @@ -1714,14 +1714,14 @@ trueLiteral, literal(1), checkSimplifyUnchanged(caseNode); } - @Test public void testSimplifyCaseFirstBranchIsSafe() { + @Test void testSimplifyCaseFirstBranchIsSafe() { RexNode caseNode = case_( gt(div(vIntNotNull(), literal(1)), literal(1)), falseLiteral, trueLiteral); checkSimplify(caseNode, "<=(/(?0.notNullInt0, 1), 1)"); } - @Test public void testPushNotIntoCase() { + @Test void testPushNotIntoCase() { checkSimplify( not( case_( @@ -1731,13 +1731,13 @@ trueLiteral, literal(1), "CASE(?0.bool0, NOT(?0.bool1), >(/(?0.notNullInt0, 2), 1), NOT(?0.bool2), NOT(?0.bool3))"); } - @Test public void testNotRecursion() { + @Test void testNotRecursion() { checkSimplify( not(coalesce(nullBool, trueLiteral)), "false"); } - @Test public void testSimplifyAnd() { + @Test void testSimplifyAnd() { RelDataType booleanNotNullableType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BOOLEAN), false); @@ -1754,7 +1754,7 @@ trueLiteral, literal(1), assertThat(result.getType().getSqlTypeName(), is(SqlTypeName.BOOLEAN)); } - @Test public void testSimplifyIsNotNull() { + @Test void testSimplifyIsNotNull() { RelDataType intType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.INTEGER), false); @@ -1794,18 +1794,18 @@ trueLiteral, literal(1), /** Unit test for * [CALCITE-2929] * Simplification of IS NULL checks are incorrectly assuming that CAST-s are possible. */ - @Test public void testSimplifyCastIsNull() { + @Test void testSimplifyCastIsNull() { checkSimplifyUnchanged(isNull(cast(vVarchar(), tInt(true)))); } /** Unit test for * [CALCITE-2929] * Simplification of IS NULL checks are incorrectly assuming that CAST-s are possible. */ - @Test public void testSimplifyCastIsNull2() { + @Test void testSimplifyCastIsNull2() { checkSimplifyUnchanged(isNull(cast(vVarcharNotNull(), tInt(false)))); } - @Test public void checkSimplifyDynamicParam() { + @Test void checkSimplifyDynamicParam() { checkSimplify(isNotNull(lt(vInt(0), vInt(1))), "AND(IS NOT NULL(?0.int0), IS NOT NULL(?0.int1))"); checkSimplify(isNotNull(lt(vInt(0), vIntNotNull(2))), @@ -1816,7 +1816,7 @@ trueLiteral, literal(1), checkSimplify(isNotNull(lt(vInt(0), null_(tInt()))), "false"); } - @Test public void testSimplifyCastLiteral() { + @Test void testSimplifyCastLiteral() { final List literals = new ArrayList<>(); literals.add( rexBuilder.makeExactLiteral(BigDecimal.ONE, @@ -1914,7 +1914,7 @@ trueLiteral, literal(1), } } - @Test public void testCastLiteral() { + @Test void testCastLiteral() { assertNode("cast(literal int not null)", "42:INTEGER NOT NULL", cast(literal(42), tInt())); assertNode("cast(literal int)", @@ -1926,7 +1926,7 @@ trueLiteral, literal(1), "CAST(42):INTEGER", abstractCast(literal(42), nullable(tInt()))); } - @Test public void testSimplifyCastLiteral2() { + @Test void testSimplifyCastLiteral2() { final RexLiteral literalAbc = rexBuilder.makeLiteral("abc"); final RexLiteral literalOne = rexBuilder.makeExactLiteral(BigDecimal.ONE); final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); @@ -1952,7 +1952,7 @@ trueLiteral, literal(1), "1970-01-01 00:00:00"); // different from Hive } - @Test public void testSimplifyCastLiteral3() { + @Test void testSimplifyCastLiteral3() { // Default TimeZone is "America/Los_Angeles" (DummyDataContext) final RexLiteral literalDate = rexBuilder.makeDateLiteral(new DateString("2011-07-20")); final RexLiteral literalTime = rexBuilder.makeTimeLiteral(new TimeString("12:34:56"), 0); @@ -2028,14 +2028,14 @@ trueLiteral, literal(1), "2011-07-20 01:23:45:TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)"); } - @Test public void testRemovalOfNullabilityWideningCast() { + @Test void testRemovalOfNullabilityWideningCast() { RexNode expr = cast(isTrue(vBoolNotNull()), tBool(true)); assertThat(expr.getType().isNullable(), is(true)); RexNode result = simplify.simplifyUnknownAs(expr, RexUnknownAs.UNKNOWN); assertThat(result.getType().isNullable(), is(false)); } - @Test public void testCompareTimestampWithTimeZone() { + @Test void testCompareTimestampWithTimeZone() { final TimestampWithTimeZoneString timestampLTZChar1 = new TimestampWithTimeZoneString("2011-07-20 10:34:56 America/Los_Angeles"); final TimestampWithTimeZoneString timestampLTZChar2 = @@ -2050,7 +2050,7 @@ trueLiteral, literal(1), assertThat(timestampLTZChar1.equals(timestampLTZChar4), is(true)); } - @Test public void testSimplifyLiterals() { + @Test void testSimplifyLiterals() { final RexLiteral literalAbc = rexBuilder.makeLiteral("abc"); final RexLiteral literalDef = rexBuilder.makeLiteral("def"); @@ -2118,7 +2118,7 @@ trueLiteral, literal(1), /** Unit test for * [CALCITE-2421] * to-be-filled . */ - @Test public void testSelfComparisions() { + @Test void testSelfComparisions() { checkSimplify3(and(eq(vInt(), vInt()), eq(vInt(1), vInt(1))), "AND(OR(null, IS NOT NULL(?0.int0)), OR(null, IS NOT NULL(?0.int1)))", "AND(IS NOT NULL(?0.int0), IS NOT NULL(?0.int1))", @@ -2129,7 +2129,7 @@ trueLiteral, literal(1), "AND(IS NULL(?0.int0), IS NULL(?0.int1))"); } - @Test public void testBooleanComparisions() { + @Test void testBooleanComparisions() { checkSimplify(eq(vBool(), trueLiteral), "?0.bool0"); checkSimplify(ge(vBool(), trueLiteral), "?0.bool0"); checkSimplify(ne(vBool(), trueLiteral), "NOT(?0.bool0)"); @@ -2152,7 +2152,7 @@ trueLiteral, literal(1), checkSimplify(lt(vBoolNotNull(), falseLiteral), "false"); } - @Test public void testSimpleDynamicVars() { + @Test void testSimpleDynamicVars() { assertTypeAndToString( vBool(2), "?0.bool2", "BOOLEAN"); assertTypeAndToString( @@ -2176,7 +2176,7 @@ private void assertTypeAndToString( + (rexNode.getType().isNullable() ? "" : " NOT NULL"), "type of " + rexNode); } - @Test public void testIsDeterministic() { + @Test void testIsDeterministic() { SqlOperator ndc = new SqlSpecialOperator( "NDC", SqlKind.OTHER_FUNCTION, @@ -2194,7 +2194,7 @@ private void assertTypeAndToString( RexUtil.retainDeterministic(RelOptUtil.conjunctions(n)).size()); } - @Test public void testConstantMap() { + @Test void testConstantMap() { final RelDataType intType = typeFactory.createSqlType(SqlTypeName.INTEGER); final RelDataType rowType = typeFactory.builder() .add("a", intType) @@ -2239,7 +2239,7 @@ private void assertTypeAndToString( assertThat(getString(map3), is("{1=?0.a, 2=?0.a}")); } - @Test public void notDistinct() { + @Test void notDistinct() { checkSimplify( isFalse(isNotDistinctFrom(vBool(0), vBool(1))), "IS DISTINCT FROM(?0.bool0, ?0.bool1)"); @@ -2248,7 +2248,7 @@ private void assertTypeAndToString( /** Unit test for * [CALCITE-2505] * RexSimplify wrongly simplifies "COALESCE(+(NULL), x)" to "NULL". */ - @Test public void testSimplifyCoalesce() { + @Test void testSimplifyCoalesce() { checkSimplify(coalesce(vIntNotNull(), vInt()), // first arg not null "?0.notNullInt0"); checkSimplifyUnchanged(coalesce(vInt(), vIntNotNull())); @@ -2273,7 +2273,7 @@ private void assertTypeAndToString( "COALESCE(?0.int0, ?0.int1)"); } - @Test public void simplifyNull() { + @Test void simplifyNull() { checkSimplify3(nullBool, "null:BOOLEAN", "false", "true"); // null int must not be simplified to false checkSimplifyUnchanged(nullInt); @@ -2289,7 +2289,7 @@ private static String getString(ImmutableMap map) { return map2.toString(); } - @Test public void testSimplifyFalse() { + @Test void testSimplifyFalse() { final RelDataType booleanNullableType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BOOLEAN), true); @@ -2312,7 +2312,7 @@ private static String getString(ImmutableMap map) { assertThat(result2.getOperands().get(0), is(booleanInput)); } - @Test public void testSimplifyNot() { + @Test void testSimplifyNot() { // "NOT(NOT(x))" => "x" checkSimplify(not(not(vBool())), "?0.bool0"); // "NOT(true)" => "false" @@ -2339,7 +2339,7 @@ private static String getString(ImmutableMap map) { "AND(NOT(?0.bool0), NOT(?0.bool1))"); } - @Test public void testSimplifyAndNot() { + @Test void testSimplifyAndNot() { // "x > 1 AND NOT (y > 2)" -> "x > 1 AND y <= 2" checkSimplify(and(gt(vInt(1), literal(1)), not(gt(vInt(2), literal(2)))), "AND(>(?0.int1, 1), <=(?0.int2, 2))"); @@ -2360,7 +2360,7 @@ private static String getString(ImmutableMap map) { "true"); } - @Test public void testSimplifyOrNot() { + @Test void testSimplifyOrNot() { // "x > 1 OR NOT (y > 2)" -> "x > 1 OR y <= 2" checkSimplify(or(gt(vInt(1), literal(1)), not(gt(vInt(2), literal(2)))), "OR(>(?0.int1, 1), <=(?0.int2, 2))"); @@ -2382,7 +2382,7 @@ private static String getString(ImmutableMap map) { "IS NULL(?0.int1)"); } - @Test public void testInterpreter() { + @Test void testInterpreter() { assertThat(eval(trueLiteral), is(true)); assertThat(eval(nullInt), is(NullSentinel.INSTANCE)); assertThat(eval(eq(nullInt, nullInt)), @@ -2399,28 +2399,28 @@ private static String getString(ImmutableMap map) { is(false)); } - @Test public void testIsNullRecursion() { + @Test void testIsNullRecursion() { // make sure that simplifcation is visiting below isX expressions checkSimplify( isNull(or(coalesce(nullBool, trueLiteral), falseLiteral)), "false"); } - @Test public void testRedundantIsTrue() { + @Test void testRedundantIsTrue() { checkSimplify2( isTrue(isTrue(vBool())), "IS TRUE(?0.bool0)", "?0.bool0"); } - @Test public void testRedundantIsFalse() { + @Test void testRedundantIsFalse() { checkSimplify2( isTrue(isFalse(vBool())), "IS FALSE(?0.bool0)", "NOT(?0.bool0)"); } - @Test public void testRedundantIsNotTrue() { + @Test void testRedundantIsNotTrue() { checkSimplify3( isNotFalse(isNotTrue(vBool())), "IS NOT TRUE(?0.bool0)", @@ -2428,7 +2428,7 @@ private static String getString(ImmutableMap map) { "NOT(?0.bool0)"); } - @Test public void testRedundantIsNotFalse() { + @Test void testRedundantIsNotFalse() { checkSimplify3( isNotFalse(isNotFalse(vBool())), "IS NOT FALSE(?0.bool0)", @@ -2439,57 +2439,57 @@ private static String getString(ImmutableMap map) { /** Unit tests for * [CALCITE-2438] * RexCall#isAlwaysTrue returns incorrect result. */ - @Test public void testIsAlwaysTrueAndFalseXisNullisNotNullisFalse() { + @Test void testIsAlwaysTrueAndFalseXisNullisNotNullisFalse() { // "((x IS NULL) IS NOT NULL) IS FALSE" -> false checkIs(isFalse(isNotNull(isNull(vBool()))), false); } - @Test public void testIsAlwaysTrueAndFalseNotXisNullisNotNullisFalse() { + @Test void testIsAlwaysTrueAndFalseNotXisNullisNotNullisFalse() { // "(NOT ((x IS NULL) IS NOT NULL)) IS FALSE" -> true checkIs(isFalse(not(isNotNull(isNull(vBool())))), true); } - @Test public void testIsAlwaysTrueAndFalseXisNullisNotNullisTrue() { + @Test void testIsAlwaysTrueAndFalseXisNullisNotNullisTrue() { // "((x IS NULL) IS NOT NULL) IS TRUE" -> true checkIs(isTrue(isNotNull(isNull(vBool()))), true); } - @Test public void testIsAlwaysTrueAndFalseNotXisNullisNotNullisTrue() { + @Test void testIsAlwaysTrueAndFalseNotXisNullisNotNullisTrue() { // "(NOT ((x IS NULL) IS NOT NULL)) IS TRUE" -> false checkIs(isTrue(not(isNotNull(isNull(vBool())))), false); } - @Test public void testIsAlwaysTrueAndFalseNotXisNullisNotNullisNotTrue() { + @Test void testIsAlwaysTrueAndFalseNotXisNullisNotNullisNotTrue() { // "(NOT ((x IS NULL) IS NOT NULL)) IS NOT TRUE" -> true checkIs(isNotTrue(not(isNotNull(isNull(vBool())))), true); } - @Test public void testIsAlwaysTrueAndFalseXisNullisNotNull() { + @Test void testIsAlwaysTrueAndFalseXisNullisNotNull() { // "(x IS NULL) IS NOT NULL" -> true checkIs(isNotNull(isNull(vBool())), true); } - @Test public void testIsAlwaysTrueAndFalseXisNotNullisNotNull() { + @Test void testIsAlwaysTrueAndFalseXisNotNullisNotNull() { // "(x IS NOT NULL) IS NOT NULL" -> true checkIs(isNotNull(isNotNull(vBool())), true); } - @Test public void testIsAlwaysTrueAndFalseXisNullisNull() { + @Test void testIsAlwaysTrueAndFalseXisNullisNull() { // "(x IS NULL) IS NULL" -> false checkIs(isNull(isNull(vBool())), false); } - @Test public void testIsAlwaysTrueAndFalseXisNotNullisNull() { + @Test void testIsAlwaysTrueAndFalseXisNotNullisNull() { // "(x IS NOT NULL) IS NULL" -> false checkIs(isNull(isNotNull(vBool())), false); } - @Test public void testIsAlwaysTrueAndFalseXisNullisNotNullisNotFalse() { + @Test void testIsAlwaysTrueAndFalseXisNullisNotNullisNotFalse() { // "((x IS NULL) IS NOT NULL) IS NOT FALSE" -> true checkIs(isNotFalse(isNotNull(isNull(vBool()))), true); } - @Test public void testIsAlwaysTrueAndFalseXisNullisNotNullisNotTrue() { + @Test void testIsAlwaysTrueAndFalseXisNullisNotNullisNotTrue() { // "((x IS NULL) IS NOT NULL) IS NOT TRUE" -> false checkIs(isNotTrue(isNotNull(isNull(vBool()))), false); } @@ -2497,7 +2497,7 @@ private static String getString(ImmutableMap map) { /** Unit test for * [CALCITE-2842] * Computing digest of IN expressions leads to Exceptions. */ - @Test public void testInDigest() { + @Test void testInDigest() { RexNode e = in(vInt(), literal(1), literal(2)); assertThat(e.toString(), is("IN(?0.int0, 1, 2)")); } @@ -2505,7 +2505,7 @@ private static String getString(ImmutableMap map) { /** Unit test for * [CALCITE-3192] * Simplify OR incorrectly weaks condition. */ - @Test public void testOrSimplificationNotWeakensCondition() { + @Test void testOrSimplificationNotWeakensCondition() { // "1 < a or (a < 3 and b = 2)" can't be simplified if a is nullable. checkSimplifyUnchanged( or( @@ -2515,7 +2515,7 @@ private static String getString(ImmutableMap map) { vBoolNotNull(2)))); } - @Test public void testIsNullSimplificationWithUnaryPlus() { + @Test void testIsNullSimplificationWithUnaryPlus() { RexNode expr = isNotNull(coalesce(unaryPlus(vInt(1)), vIntNotNull(0))); RexNode s = simplify.simplifyUnknownAs(expr, RexUnknownAs.UNKNOWN); @@ -2524,7 +2524,7 @@ private static String getString(ImmutableMap map) { assertThat(s, is(trueLiteral)); } - @Test public void testIsNullSimplificationWithIsDistinctFrom() { + @Test void testIsNullSimplificationWithIsDistinctFrom() { RexNode expr = isNotNull( case_(vBool(), @@ -2536,7 +2536,7 @@ private static String getString(ImmutableMap map) { assertThat(s, is(trueLiteral)); } - @Test public void testSimplifyCastUnaryMinus() { + @Test void testSimplifyCastUnaryMinus() { RexNode expr = isNull(ne(unaryMinus(cast(unaryMinus(vIntNotNull(1)), nullable(tInt()))), vIntNotNull(1))); RexNode s = simplify.simplifyUnknownAs(expr, RexUnknownAs.UNKNOWN); @@ -2544,14 +2544,14 @@ private static String getString(ImmutableMap map) { assertThat(s, is(falseLiteral)); } - @Test public void testSimplifyRangeWithMultiPredicates() { + @Test void testSimplifyRangeWithMultiPredicates() { final RexNode ref = input(tInt(), 0); RelOptPredicateList relOptPredicateList = RelOptPredicateList.of(rexBuilder, ImmutableList.of(gt(ref, literal(1)), le(ref, literal(5)))); checkSimplifyFilter(gt(ref, literal(9)), relOptPredicateList, "false"); } - @Test public void testSimplifyNotEqual() { + @Test void testSimplifyNotEqual() { RexNode ref = input(tInt(), 0); RelOptPredicateList relOptPredicateList = RelOptPredicateList.of(rexBuilder, ImmutableList.of(eq(ref, literal(9)))); @@ -2565,7 +2565,7 @@ private static String getString(ImmutableMap map) { "OR(null, IS NOT NULL($0))"); } - @Test public void testSimplifyNonDeterministicFunction() { + @Test void testSimplifyNonDeterministicFunction() { final SqlOperator ndc = new SqlSpecialOperator( "NDC", SqlKind.OTHER_FUNCTION, diff --git a/core/src/test/java/org/apache/calcite/rex/RexProgramTestBase.java b/core/src/test/java/org/apache/calcite/rex/RexProgramTestBase.java index 9a542edafc83..140fb115d4ca 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexProgramTestBase.java +++ b/core/src/test/java/org/apache/calcite/rex/RexProgramTestBase.java @@ -27,7 +27,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -public class RexProgramTestBase extends RexProgramBuilderBase { +class RexProgramTestBase extends RexProgramBuilderBase { protected void checkDigest(RexNode node, String expected) { assertEquals(expected, node.toString(), () -> "Digest of " + node.toStringRaw()); diff --git a/core/src/test/java/org/apache/calcite/rex/RexSqlStandardConvertletTableTest.java b/core/src/test/java/org/apache/calcite/rex/RexSqlStandardConvertletTableTest.java index 52bac681ab43..8ad835725b14 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexSqlStandardConvertletTableTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexSqlStandardConvertletTableTest.java @@ -39,9 +39,9 @@ /** * Unit test for {@link org.apache.calcite.rex.RexSqlStandardConvertletTable}. */ -public class RexSqlStandardConvertletTableTest extends SqlToRelTestBase { +class RexSqlStandardConvertletTableTest extends SqlToRelTestBase { - @Test public void testCoalesce() { + @Test void testCoalesce() { final Project project = (Project) convertSqlToRel( "SELECT COALESCE(NULL, 'a')", false); final RexNode rex = project.getChildExps().get(0); @@ -52,7 +52,7 @@ public class RexSqlStandardConvertletTableTest extends SqlToRelTestBase { convertedSql.toString()); } - @Test public void testCaseWithValue() { + @Test void testCaseWithValue() { final Project project = (Project) convertSqlToRel( "SELECT CASE NULL WHEN NULL THEN NULL ELSE 'a' END", false); @@ -64,7 +64,7 @@ public class RexSqlStandardConvertletTableTest extends SqlToRelTestBase { convertedSql.toString()); } - @Test public void testCaseNoValue() { + @Test void testCaseNoValue() { final Project project = (Project) convertSqlToRel( "SELECT CASE WHEN NULL IS NULL THEN NULL ELSE 'a' END", false); final RexNode rex = project.getChildExps().get(0); diff --git a/core/src/test/java/org/apache/calcite/runtime/AutomatonTest.java b/core/src/test/java/org/apache/calcite/runtime/AutomatonTest.java index c8f401a9b003..2f0388cc0da9 100644 --- a/core/src/test/java/org/apache/calcite/runtime/AutomatonTest.java +++ b/core/src/test/java/org/apache/calcite/runtime/AutomatonTest.java @@ -32,7 +32,7 @@ import static org.hamcrest.core.Is.is; /** Unit tests for {@link Automaton}. */ -public class AutomatonTest { +class AutomatonTest { /** Creates a Matcher that matches a list of * {@link org.apache.calcite.runtime.Matcher.PartialMatch} if they @@ -44,7 +44,7 @@ public class AutomatonTest { .toString()); } - @Test public void testSimple() { + @Test void testSimple() { // pattern(a) final Pattern p = Pattern.builder().symbol("a").build(); assertThat(p.toString(), is("a")); @@ -59,7 +59,7 @@ public class AutomatonTest { assertThat(matcher.match(rows), isMatchList(expected)); } - @Test public void testSequence() { + @Test void testSequence() { // pattern(a b) final Pattern p = Pattern.builder().symbol("a").symbol("b").seq().build(); @@ -75,7 +75,7 @@ public class AutomatonTest { assertThat(matcher.match(rows), isMatchList(expected)); } - @Test public void testStar() { + @Test void testStar() { // pattern(a* b) final Pattern p = Pattern.builder() .symbol("a").star() @@ -93,7 +93,7 @@ public class AutomatonTest { assertThat(matcher.match(rows), isMatchList(expected)); } - @Test public void testPlus() { + @Test void testPlus() { // pattern(a+ b) final Pattern p = Pattern.builder() .symbol("a").plus() @@ -110,7 +110,7 @@ public class AutomatonTest { assertThat(matcher.match(rows), isMatchList(expected)); } - @Test public void testOr() { + @Test void testOr() { // pattern(a+ b) final Pattern p = Pattern.builder() .symbol("a") @@ -128,7 +128,7 @@ public class AutomatonTest { assertThat(matcher.match(rows), isMatchList(expected)); } - @Test public void testOptional() { + @Test void testOptional() { // pattern(a+ b) final Pattern p = Pattern.builder() .symbol("a") @@ -148,7 +148,7 @@ public class AutomatonTest { assertThat(matcher.match(chars(rows)), isMatchList(expected)); } - @Test public void testRepeat() { + @Test void testRepeat() { // pattern(a b{0, 2} c) checkRepeat(0, 2, "a (b){0, 2} c", "[[a, c], [a, b, c], [a, b, b, c]]"); // pattern(a b{0, 1} c) @@ -183,7 +183,7 @@ private void checkRepeat(int minRepeat, int maxRepeat, String pattern, assertThat(matcher.match(chars(rows)), isMatchList(expected)); } - @Test public void testRepeatComposite() { + @Test void testRepeatComposite() { // pattern(a (b a){1, 2} c) final Pattern p = Pattern.builder() .symbol("a") @@ -204,7 +204,7 @@ private void checkRepeat(int minRepeat, int maxRepeat, String pattern, isMatchList("[[a, b, a, c], [a, b, a, c], [a, b, a, b, a, c]]")); } - @Test public void testResultWithLabels() { + @Test void testResultWithLabels() { // pattern(a) final Pattern p = Pattern.builder() .symbol("A") diff --git a/core/src/test/java/org/apache/calcite/runtime/BinarySearchTest.java b/core/src/test/java/org/apache/calcite/runtime/BinarySearchTest.java index 560c66fe9e0e..395e37b89e56 100644 --- a/core/src/test/java/org/apache/calcite/runtime/BinarySearchTest.java +++ b/core/src/test/java/org/apache/calcite/runtime/BinarySearchTest.java @@ -30,7 +30,7 @@ /** * Tests {@link org.apache.calcite.runtime.BinarySearch}. */ -public class BinarySearchTest { +class BinarySearchTest { private void search(int key, int lower, int upper, Integer... array) { assertEquals(lower, lowerBound(array, key, naturalOrder()), () -> "lower bound of " + key + " in " + Arrays.toString(array)); @@ -38,35 +38,35 @@ private void search(int key, int lower, int upper, Integer... array) { () -> "upper bound of " + key + " in " + Arrays.toString(array)); } - @Test public void testSimple() { + @Test void testSimple() { search(1, 0, 0, 1, 2, 3); search(2, 1, 1, 1, 2, 3); search(3, 2, 2, 1, 2, 3); } - @Test public void testRepeated() { + @Test void testRepeated() { search(1, 0, 1, 1, 1, 2, 2, 3, 3); search(2, 2, 3, 1, 1, 2, 2, 3, 3); search(3, 4, 5, 1, 1, 2, 2, 3, 3); } - @Test public void testMissing() { + @Test void testMissing() { search(0, -1, -1, 1, 2, 4); search(3, 2, 1, 1, 2, 4); search(5, 3, 3, 1, 2, 4); } - @Test public void testEmpty() { + @Test void testEmpty() { search(42, -1, -1); } - @Test public void testSingle() { + @Test void testSingle() { search(41, -1, -1, 42); search(42, 0, 0, 42); search(43, 1, 1, 42); } - @Test public void testAllTheSame() { + @Test void testAllTheSame() { search(1, 0, 3, 1, 1, 1, 1); search(0, -1, -1, 1, 1, 1, 1); search(2, 4, 4, 1, 1, 1, 1); diff --git a/core/src/test/java/org/apache/calcite/runtime/DeterministicAutomatonTest.java b/core/src/test/java/org/apache/calcite/runtime/DeterministicAutomatonTest.java index da103a8cc0d3..d74929f60936 100644 --- a/core/src/test/java/org/apache/calcite/runtime/DeterministicAutomatonTest.java +++ b/core/src/test/java/org/apache/calcite/runtime/DeterministicAutomatonTest.java @@ -22,8 +22,8 @@ import static org.hamcrest.core.Is.is; /** Tests for the {@link DeterministicAutomaton} */ -public class DeterministicAutomatonTest { - @Test public void convertAutomaton() { +class DeterministicAutomatonTest { + @Test void convertAutomaton() { final Pattern.PatternBuilder builder = Pattern.builder(); final Pattern pattern = builder.symbol("A") .repeat(1, 2) @@ -45,7 +45,7 @@ public class DeterministicAutomatonTest { assertThat(da.getEndStates().size(), is(2)); } - @Test public void convertAutomaton2() { + @Test void convertAutomaton2() { final Pattern.PatternBuilder builder = Pattern.builder(); final Pattern pattern = builder .symbol("A") @@ -65,7 +65,7 @@ public class DeterministicAutomatonTest { assertThat(da.getEndStates().size(), is(1)); } - @Test public void convertAutomaton3() { + @Test void convertAutomaton3() { final Pattern.PatternBuilder builder = Pattern.builder(); final Pattern pattern = builder .symbol("A") @@ -83,7 +83,7 @@ public class DeterministicAutomatonTest { assertThat(da.getEndStates().size(), is(2)); } - @Test public void convertAutomaton4() { + @Test void convertAutomaton4() { final Pattern.PatternBuilder builder = Pattern.builder(); final Pattern pattern = builder .symbol("A") diff --git a/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java b/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java index 73ef4249a55d..79cf69871394 100644 --- a/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java +++ b/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java @@ -42,7 +42,7 @@ /** * Unit tests for {@link org.apache.calcite.runtime.Enumerables}. */ -public class EnumerablesTest { +class EnumerablesTest { private static final Enumerable EMPS = Linq4j.asEnumerable( Arrays.asList( new Emp(10, "Fred"), @@ -67,35 +67,35 @@ public class EnumerablesTest { private static final Predicate2 DEPT_EMP_EQUAL_DEPTNO = (d, e) -> d.deptno == e.deptno; - @Test public void testSemiJoinEmp() { + @Test void testSemiJoinEmp() { assertThat( EnumerableDefaults.semiJoin(EMPS, DEPTS, e -> e.deptno, d -> d.deptno, Functions.identityComparer()).toList().toString(), equalTo("[Emp(20, Theodore), Emp(20, Sebastian)]")); } - @Test public void testSemiJoinDept() { + @Test void testSemiJoinDept() { assertThat( EnumerableDefaults.semiJoin(DEPTS, EMPS, d -> d.deptno, e -> e.deptno, Functions.identityComparer()).toList().toString(), equalTo("[Dept(20, Sales)]")); } - @Test public void testAntiJoinEmp() { + @Test void testAntiJoinEmp() { assertThat( EnumerableDefaults.antiJoin(EMPS, DEPTS, e -> e.deptno, d -> d.deptno, Functions.identityComparer()).toList().toString(), equalTo("[Emp(10, Fred), Emp(30, Joe)]")); } - @Test public void testAntiJoinDept() { + @Test void testAntiJoinDept() { assertThat( EnumerableDefaults.antiJoin(DEPTS, EMPS, d -> d.deptno, e -> e.deptno, Functions.identityComparer()).toList().toString(), equalTo("[Dept(15, Marketing)]")); } - @Test public void testMergeJoin() { + @Test void testMergeJoin() { assertThat( EnumerableDefaults.mergeJoin( Linq4j.asEnumerable( @@ -122,7 +122,7 @@ public class EnumerablesTest { + " Emp(30, Greg), Dept(30, Development)]")); } - @Test public void testMergeJoinWithNullKeys() { + @Test void testMergeJoinWithNullKeys() { assertThat( EnumerableDefaults.mergeJoin( Linq4j.asEnumerable( @@ -146,7 +146,7 @@ public class EnumerablesTest { + " Emp(20, Theodore), Dept(30, Theodore)]")); } - @Test public void testMergeJoin2() { + @Test void testMergeJoin2() { // Matching keys at start testIntersect( Lists.newArrayList(1, 3, 4), @@ -169,7 +169,7 @@ public class EnumerablesTest { equalTo("[3, 4]")); } - @Test public void testMergeJoin3() { + @Test void testMergeJoin3() { // No overlap testIntersect( Lists.newArrayList(0, 2, 4), @@ -220,7 +220,7 @@ private static > void testIntersect( matcher); } - @Test public void testMergeJoinWithPredicate() { + @Test void testMergeJoinWithPredicate() { final List listEmp1 = Arrays.asList( new Emp(1, "Fred"), new Emp(2, "Fred"), @@ -306,14 +306,14 @@ private static > Enumerable intersect( Functions.identitySelector(), (v0, v1) -> v0, false, false); } - @Test public void testNestedLoopJoin() { + @Test void testNestedLoopJoin() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS, EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.INNER).toList().toString(), equalTo("[{Theodore, 20, 20, Sales}, {Sebastian, 20, 20, Sales}]")); } - @Test public void testNestedLoopLeftJoin() { + @Test void testNestedLoopLeftJoin() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS, EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.LEFT).toList().toString(), @@ -321,7 +321,7 @@ private static > Enumerable intersect( + "{Sebastian, 20, 20, Sales}, {Joe, 30, null, null}]")); } - @Test public void testNestedLoopRightJoin() { + @Test void testNestedLoopRightJoin() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS, EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.RIGHT).toList().toString(), @@ -329,7 +329,7 @@ private static > Enumerable intersect( + "{null, null, 15, Marketing}]")); } - @Test public void testNestedLoopFullJoin() { + @Test void testNestedLoopFullJoin() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS, EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.FULL).toList().toString(), @@ -338,7 +338,7 @@ private static > Enumerable intersect( + "{null, null, 15, Marketing}]")); } - @Test public void testNestedLoopFullJoinLeftEmpty() { + @Test void testNestedLoopFullJoinLeftEmpty() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS.take(0), DEPTS, EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.FULL) @@ -346,7 +346,7 @@ private static > Enumerable intersect( equalTo("[{null, null, 15, Marketing}, {null, null, 20, Sales}]")); } - @Test public void testNestedLoopFullJoinRightEmpty() { + @Test void testNestedLoopFullJoinRightEmpty() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS.take(0), EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.FULL).toList().toString(), @@ -354,35 +354,35 @@ private static > Enumerable intersect( + "{Sebastian, 20, null, null}, {Joe, 30, null, null}]")); } - @Test public void testNestedLoopFullJoinBothEmpty() { + @Test void testNestedLoopFullJoinBothEmpty() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS.take(0), DEPTS.take(0), EMP_DEPT_EQUAL_DEPTNO, EMP_DEPT_TO_STRING, JoinType.FULL).toList().toString(), equalTo("[]")); } - @Test public void testNestedLoopSemiJoinEmp() { + @Test void testNestedLoopSemiJoinEmp() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS, EMP_DEPT_EQUAL_DEPTNO, (e, d) -> e.toString(), JoinType.SEMI).toList().toString(), equalTo("[Emp(20, Theodore), Emp(20, Sebastian)]")); } - @Test public void testNestedLoopSemiJoinDept() { + @Test void testNestedLoopSemiJoinDept() { assertThat( EnumerableDefaults.nestedLoopJoin(DEPTS, EMPS, DEPT_EMP_EQUAL_DEPTNO, (d, e) -> d.toString(), JoinType.SEMI).toList().toString(), equalTo("[Dept(20, Sales)]")); } - @Test public void testNestedLoopAntiJoinEmp() { + @Test void testNestedLoopAntiJoinEmp() { assertThat( EnumerableDefaults.nestedLoopJoin(EMPS, DEPTS, EMP_DEPT_EQUAL_DEPTNO, (e, d) -> e.toString(), JoinType.ANTI).toList().toString(), equalTo("[Emp(10, Fred), Emp(30, Joe)]")); } - @Test public void testNestedLoopAntiJoinDept() { + @Test void testNestedLoopAntiJoinDept() { assertThat( EnumerableDefaults.nestedLoopJoin(DEPTS, EMPS, DEPT_EMP_EQUAL_DEPTNO, (d, e) -> d.toString(), JoinType.ANTI).toList().toString(), @@ -431,7 +431,7 @@ public void testMatch() { + "[Emp(20, Sebastian), Emp(30, Joe)] null 2]")); } - @Test public void testInnerHashJoin() { + @Test void testInnerHashJoin() { assertThat( EnumerableDefaults.hashJoin( Linq4j.asEnumerable( @@ -457,7 +457,7 @@ public void testMatch() { + " Emp(30, Greg), Dept(30, Development)]")); } - @Test public void testLeftHashJoinWithNonEquiConditions() { + @Test void testLeftHashJoinWithNonEquiConditions() { assertThat( EnumerableDefaults.hashJoin( Linq4j.asEnumerable( @@ -486,7 +486,7 @@ public void testMatch() { + " Emp(30, Greg), null]")); } - @Test public void testRightHashJoinWithNonEquiConditions() { + @Test void testRightHashJoinWithNonEquiConditions() { assertThat( EnumerableDefaults.hashJoin( Linq4j.asEnumerable( @@ -514,7 +514,7 @@ public void testMatch() { + " null, Dept(30, Development)]")); } - @Test public void testFullHashJoinWithNonEquiConditions() { + @Test void testFullHashJoinWithNonEquiConditions() { assertThat( EnumerableDefaults.hashJoin( Linq4j.asEnumerable( diff --git a/core/src/test/java/org/apache/calcite/sql/SqlSetOptionOperatorTest.java b/core/src/test/java/org/apache/calcite/sql/SqlSetOptionOperatorTest.java index 06b7a64f17ce..57ace1dafc9a 100644 --- a/core/src/test/java/org/apache/calcite/sql/SqlSetOptionOperatorTest.java +++ b/core/src/test/java/org/apache/calcite/sql/SqlSetOptionOperatorTest.java @@ -28,9 +28,9 @@ /** * Test for {@link SqlSetOption}. */ -public class SqlSetOptionOperatorTest { +class SqlSetOptionOperatorTest { - @Test public void testSqlSetOptionOperatorScopeSet() throws SqlParseException { + @Test void testSqlSetOptionOperatorScopeSet() throws SqlParseException { SqlNode node = parse("alter system set optionA.optionB.optionC = true"); checkSqlSetOptionSame(node); } @@ -39,17 +39,17 @@ public SqlNode parse(String s) throws SqlParseException { return SqlParser.create(s).parseStmt(); } - @Test public void testSqlSetOptionOperatorSet() throws SqlParseException { + @Test void testSqlSetOptionOperatorSet() throws SqlParseException { SqlNode node = parse("set optionA.optionB.optionC = true"); checkSqlSetOptionSame(node); } - @Test public void testSqlSetOptionOperatorScopeReset() throws SqlParseException { + @Test void testSqlSetOptionOperatorScopeReset() throws SqlParseException { SqlNode node = parse("alter session reset param1.param2.param3"); checkSqlSetOptionSame(node); } - @Test public void testSqlSetOptionOperatorReset() throws SqlParseException { + @Test void testSqlSetOptionOperatorReset() throws SqlParseException { SqlNode node = parse("reset param1.param2.param3"); checkSqlSetOptionSame(node); } diff --git a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java index e96bf6b87cda..df6c18087114 100644 --- a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java +++ b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java @@ -698,7 +698,7 @@ protected static SortedSet keywords(String dialect) { * "<IDENTIFIER>") are removed, but reserved words such as "AND" * remain. */ - @Test public void testExceptionCleanup() { + @Test void testExceptionCleanup() { sql("select 0.5e1^.1^ from sales.emps") .fails("(?s).*Encountered \".1\" at line 1, column 13.\n" + "Was expecting one of:\n" @@ -708,7 +708,7 @@ protected static SortedSet keywords(String dialect) { + ".*"); } - @Test public void testInvalidToken() { + @Test void testInvalidToken() { // Causes problems to the test infrastructure because the token mgr // throws a java.lang.Error. The usual case is that the parser throws // an exception. @@ -717,20 +717,20 @@ protected static SortedSet keywords(String dialect) { } // TODO: should fail in parser - @Test public void testStarAsFails() { + @Test void testStarAsFails() { sql("select * as x from emp") .ok("SELECT * AS `X`\n" + "FROM `EMP`"); } - @Test public void testDerivedColumnList() { + @Test void testDerivedColumnList() { sql("select * from emp as e (empno, gender) where true") .ok("SELECT *\n" + "FROM `EMP` AS `E` (`EMPNO`, `GENDER`)\n" + "WHERE TRUE"); } - @Test public void testDerivedColumnListInJoin() { + @Test void testDerivedColumnListInJoin() { final String sql = "select * from emp as e (empno, gender)\n" + " join dept as d (deptno, dname) on emp.deptno = dept.deptno"; final String expected = "SELECT *\n" @@ -742,7 +742,7 @@ protected static SortedSet keywords(String dialect) { /** Test case that does not reproduce but is related to * [CALCITE-2637] * Prefix '-' operator failed between BETWEEN and AND. */ - @Test public void testBetweenAnd() { + @Test void testBetweenAnd() { final String sql = "select * from emp\n" + "where deptno between - DEPTNO + 1 and 5"; final String expected = "SELECT *\n" @@ -751,7 +751,7 @@ protected static SortedSet keywords(String dialect) { sql(sql).ok(expected); } - @Test public void testBetweenAnd2() { + @Test void testBetweenAnd2() { final String sql = "select * from emp\n" + "where deptno between - DEPTNO + 1 and - empno - 3"; final String expected = "SELECT *\n" @@ -762,57 +762,57 @@ protected static SortedSet keywords(String dialect) { } @Disabled - @Test public void testDerivedColumnListNoAs() { + @Test void testDerivedColumnListNoAs() { sql("select * from emp e (empno, gender) where true").ok("foo"); } // jdbc syntax @Disabled - @Test public void testEmbeddedCall() { + @Test void testEmbeddedCall() { expr("{call foo(?, ?)}") .ok("foo"); } @Disabled - @Test public void testEmbeddedFunction() { + @Test void testEmbeddedFunction() { expr("{? = call bar (?, ?)}") .ok("foo"); } - @Test public void testColumnAliasWithAs() { + @Test void testColumnAliasWithAs() { sql("select 1 as foo from emp") .ok("SELECT 1 AS `FOO`\n" + "FROM `EMP`"); } - @Test public void testColumnAliasWithoutAs() { + @Test void testColumnAliasWithoutAs() { sql("select 1 foo from emp") .ok("SELECT 1 AS `FOO`\n" + "FROM `EMP`"); } - @Test public void testEmbeddedDate() { + @Test void testEmbeddedDate() { expr("{d '1998-10-22'}") .ok("DATE '1998-10-22'"); } - @Test public void testEmbeddedTime() { + @Test void testEmbeddedTime() { expr("{t '16:22:34'}") .ok("TIME '16:22:34'"); } - @Test public void testEmbeddedTimestamp() { + @Test void testEmbeddedTimestamp() { expr("{ts '1998-10-22 16:22:34'}") .ok("TIMESTAMP '1998-10-22 16:22:34'"); } - @Test public void testNot() { + @Test void testNot() { sql("select not true, not false, not null, not unknown from t") .ok("SELECT (NOT TRUE), (NOT FALSE), (NOT NULL), (NOT UNKNOWN)\n" + "FROM `T`"); } - @Test public void testBooleanPrecedenceAndAssociativity() { + @Test void testBooleanPrecedenceAndAssociativity() { sql("select * from t where true and false") .ok("SELECT *\n" + "FROM `T`\n" @@ -834,7 +834,7 @@ protected static SortedSet keywords(String dialect) { + "WHERE (1 AND TRUE)"); } - @Test public void testLessThanAssociativity() { + @Test void testLessThanAssociativity() { expr("NOT a = b") .ok("(NOT (`A` = `B`))"); @@ -897,7 +897,7 @@ protected static SortedSet keywords(String dialect) { .ok("((NOT (NOT (`A` = `B`))) OR (NOT (NOT (`C` = `D`))))"); } - @Test public void testIsBooleans() { + @Test void testIsBooleans() { String[] inOuts = {"NULL", "TRUE", "FALSE", "UNKNOWN"}; for (String inOut : inOuts) { @@ -913,7 +913,7 @@ protected static SortedSet keywords(String dialect) { } } - @Test public void testIsBooleanPrecedenceAndAssociativity() { + @Test void testIsBooleanPrecedenceAndAssociativity() { sql("select * from t where x is unknown is not unknown") .ok("SELECT *\n" + "FROM `T`\n" @@ -943,7 +943,7 @@ protected static SortedSet keywords(String dialect) { sql(sql).ok(expected); } - @Test public void testEqualNotEqual() { + @Test void testEqualNotEqual() { expr("'abc'=123") .ok("('abc' = 123)"); expr("'abc'<>123") @@ -954,7 +954,7 @@ protected static SortedSet keywords(String dialect) { .ok("(('abc' <> 123) = ('def' <> 456))"); } - @Test public void testBangEqualIsBad() { + @Test void testBangEqualIsBad() { // Quoth www.ocelot.ca: // "Other relators besides '=' are what you'd expect if // you've used any programming language: > and >= and < and <=. The @@ -967,7 +967,7 @@ protected static SortedSet keywords(String dialect) { .fails("Bang equal '!=' is not allowed under the current SQL conformance level"); } - @Test public void testBetween() { + @Test void testBetween() { sql("select * from t where price between 1 and 2") .ok("SELECT *\n" + "FROM `T`\n" @@ -1046,13 +1046,13 @@ protected static SortedSet keywords(String dialect) { .ok("VALUES (ROW((`A` BETWEEN ASYMMETRIC ((`B` OR (`C` AND `D`)) OR `E`) AND `F`)))"); } - @Test public void testOperateOnColumn() { + @Test void testOperateOnColumn() { sql("select c1*1,c2 + 2,c3/3,c4-4,c5*c4 from t") .ok("SELECT (`C1` * 1), (`C2` + 2), (`C3` / 3), (`C4` - 4), (`C5` * `C4`)\n" + "FROM `T`"); } - @Test public void testRow() { + @Test void testRow() { sql("select t.r.\"EXPR$1\", t.r.\"EXPR$0\" from (select (1,2) r from sales.depts) t") .ok("SELECT `T`.`R`.`EXPR$1`, `T`.`R`.`EXPR$0`\n" + "FROM (SELECT (ROW(1, 2)) AS `R`\n" @@ -1110,7 +1110,7 @@ protected static SortedSet keywords(String dialect) { sql(whereRow2).sansCarets().ok(whereExpected); } - @Test public void testRowValueExpression() { + @Test void testRowValueExpression() { final String expected0 = "INSERT INTO \"EMPS\"\n" + "VALUES (ROW(1, 'Fred')),\n" + "(ROW(2, 'Eric'))"; @@ -1146,7 +1146,7 @@ protected boolean isUnparserTest() { return false; } - @Test public void testRowWithDot() { + @Test void testRowWithDot() { sql("select (1,2).a from c.t") .ok("SELECT ((ROW(1, 2)).`A`)\nFROM `C`.`T`"); sql("select row(1,2).a from c.t") @@ -1155,14 +1155,14 @@ protected boolean isUnparserTest() { .ok("SELECT ((`TBL`.`FOO`(0).`COL`).`BAR`)\nFROM `TBL`"); } - @Test public void testPeriod() { + @Test void testPeriod() { // We don't have a PERIOD constructor currently; // ROW constructor is sufficient for now. expr("period (date '1969-01-05', interval '2-3' year to month)") .ok("(ROW(DATE '1969-01-05', INTERVAL '2-3' YEAR TO MONTH))"); } - @Test public void testOverlaps() { + @Test void testOverlaps() { final String[] ops = { "overlaps", "equals", "precedes", "succeeds", "immediately precedes", "immediately succeeds" @@ -1198,21 +1198,21 @@ void checkPeriodPredicate(Checker checker) { } /** Parses a list of statements (that contains only one statement). */ - @Test public void testStmtListWithSelect() { + @Test void testStmtListWithSelect() { final String expected = "SELECT *\n" + "FROM `EMP`,\n" + "`DEPT`"; sqlList("select * from emp, dept").ok(expected); } - @Test public void testStmtListWithSelectAndSemicolon() { + @Test void testStmtListWithSelectAndSemicolon() { final String expected = "SELECT *\n" + "FROM `EMP`,\n" + "`DEPT`"; sqlList("select * from emp, dept;").ok(expected); } - @Test public void testStmtListWithTwoSelect() { + @Test void testStmtListWithTwoSelect() { final String expected = "SELECT *\n" + "FROM `EMP`,\n" + "`DEPT`"; @@ -1220,7 +1220,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected, expected); } - @Test public void testStmtListWithTwoSelectSemicolon() { + @Test void testStmtListWithTwoSelectSemicolon() { final String expected = "SELECT *\n" + "FROM `EMP`,\n" + "`DEPT`"; @@ -1228,7 +1228,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected, expected); } - @Test public void testStmtListWithSelectDelete() { + @Test void testStmtListWithSelectDelete() { final String expected = "SELECT *\n" + "FROM `EMP`,\n" + "`DEPT`"; @@ -1237,7 +1237,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected, expected1); } - @Test public void testStmtListWithSelectDeleteUpdate() { + @Test void testStmtListWithSelectDeleteUpdate() { final String sql = "select * from emp, dept; " + "delete from emp; " + "update emps set empno = empno + 1"; @@ -1249,7 +1249,7 @@ void checkPeriodPredicate(Checker checker) { sqlList(sql).ok(expected, expected1, expected2); } - @Test public void testStmtListWithSemiColonInComment() { + @Test void testStmtListWithSemiColonInComment() { final String sql = "" + "select * from emp, dept; // comment with semicolon ; values 1\n" + "values 2"; @@ -1260,7 +1260,7 @@ void checkPeriodPredicate(Checker checker) { sqlList(sql).ok(expected, expected1); } - @Test public void testStmtListWithSemiColonInWhere() { + @Test void testStmtListWithSemiColonInWhere() { final String expected = "SELECT *\n" + "FROM `EMP`\n" + "WHERE (`NAME` LIKE 'toto;')"; @@ -1269,7 +1269,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected, expected1); } - @Test public void testStmtListWithInsertSelectInsert() { + @Test void testStmtListWithInsertSelectInsert() { final String sql = "insert into dept (name, deptno) values ('a', 123); " + "select * from emp where name like 'toto;'; " + "insert into dept (name, deptno) values ('b', 123);"; @@ -1284,14 +1284,14 @@ void checkPeriodPredicate(Checker checker) { } /** Should fail since the first statement lacks semicolon */ - @Test public void testStmtListWithoutSemiColon1() { + @Test void testStmtListWithoutSemiColon1() { sqlList("select * from emp where name like 'toto' " + "^delete^ from emp") .fails("(?s).*Encountered \"delete\" at .*"); } /** Should fail since the third statement lacks semicolon */ - @Test public void testStmtListWithoutSemiColon2() { + @Test void testStmtListWithoutSemiColon2() { sqlList("select * from emp where name like 'toto'; " + "delete from emp; " + "insert into dept (name, deptno) values ('a', 123) " @@ -1299,7 +1299,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"select\" at .*"); } - @Test public void testIsDistinctFrom() { + @Test void testIsDistinctFrom() { sql("select x is distinct from y from t") .ok("SELECT (`X` IS DISTINCT FROM `Y`)\n" + "FROM `T`"); @@ -1330,7 +1330,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE ((TRUE IS DISTINCT FROM TRUE) IS TRUE)"); } - @Test public void testIsNotDistinct() { + @Test void testIsNotDistinct() { sql("select x is not distinct from y from t") .ok("SELECT (`X` IS NOT DISTINCT FROM `Y`)\n" + "FROM `T`"); @@ -1341,7 +1341,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (TRUE IS NOT DISTINCT FROM TRUE)"); } - @Test public void testFloor() { + @Test void testFloor() { expr("floor(1.5)") .ok("FLOOR(1.5)"); expr("floor(x)") @@ -1410,7 +1410,7 @@ void checkPeriodPredicate(Checker checker) { .ok("FLOOR((`X` + INTERVAL '1:20' MINUTE TO SECOND) TO MILLENNIUM)"); } - @Test public void testCeil() { + @Test void testCeil() { expr("ceil(3453.2)") .ok("CEIL(3453.2)"); expr("ceil(x)") @@ -1478,7 +1478,7 @@ void checkPeriodPredicate(Checker checker) { .ok("CEIL((`X` + INTERVAL '1:20' MINUTE TO SECOND) TO MILLENNIUM)"); } - @Test public void testCast() { + @Test void testCast() { expr("cast(x as boolean)") .ok("CAST(`X` AS BOOLEAN)"); expr("cast(x as integer)") @@ -1540,7 +1540,7 @@ void checkPeriodPredicate(Checker checker) { .ok("CAST('foo' AS `BAR`)"); } - @Test public void testCastFails() { + @Test void testCastFails() { expr("cast(x as time with ^time^ zone)") .fails("(?s).*Encountered \"time\" at .*"); expr("cast(x as time(0) with ^time^ zone)") @@ -1555,7 +1555,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"without\" at line 1, column 23.\n.*"); } - @Test public void testLikeAndSimilar() { + @Test void testLikeAndSimilar() { sql("select * from t where x like '%abc%'") .ok("SELECT *\n" + "FROM `T`\n" @@ -1650,10 +1650,10 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (`A` LIKE `B` ESCAPE `C`)) ESCAPE `D`)))"); } - @Test public void testFoo() { + @Test void testFoo() { } - @Test public void testArithmeticOperators() { + @Test void testArithmeticOperators() { expr("1-2+3*4/5/6-7") .ok("(((1 - 2) + (((3 * 4) / 5) / 6)) - 7)"); expr("power(2,3)") @@ -1668,7 +1668,7 @@ void checkPeriodPredicate(Checker checker) { .ok("LOG10(0.2)"); } - @Test public void testExists() { + @Test void testExists() { sql("select * from dept where exists (select 1 from emp where emp.deptno = dept.deptno)") .ok("SELECT *\n" + "FROM `DEPT`\n" @@ -1677,7 +1677,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (`EMP`.`DEPTNO` = `DEPT`.`DEPTNO`)))"); } - @Test public void testExistsInWhere() { + @Test void testExistsInWhere() { sql("select * from emp where 1 = 2 and exists (select 1 from dept) and 3 = 4") .ok("SELECT *\n" + "FROM `EMP`\n" @@ -1685,22 +1685,22 @@ void checkPeriodPredicate(Checker checker) { + "FROM `DEPT`))) AND (3 = 4))"); } - @Test public void testFromWithAs() { + @Test void testFromWithAs() { sql("select 1 from emp as e where 1") .ok("SELECT 1\n" + "FROM `EMP` AS `E`\n" + "WHERE 1"); } - @Test public void testConcat() { + @Test void testConcat() { expr("'a' || 'b'").ok("('a' || 'b')"); } - @Test public void testReverseSolidus() { + @Test void testReverseSolidus() { expr("'\\'").ok("'\\'"); } - @Test public void testSubstring() { + @Test void testSubstring() { expr("substring('a'\nFROM \t 1)") .ok("SUBSTRING('a' FROM 1)"); expr("substring('a' FROM 1 FOR 3)") @@ -1716,7 +1716,7 @@ void checkPeriodPredicate(Checker checker) { .ok("SUBSTRING('a' FROM 1)"); } - @Test public void testFunction() { + @Test void testFunction() { sql("select substring('Eggs and ham', 1, 3 + 2) || ' benedict' from emp") .ok("SELECT (SUBSTRING('Eggs and ham' FROM 1 FOR (3 + 2)) || ' benedict')\n" + "FROM `EMP`"); @@ -1729,7 +1729,7 @@ void checkPeriodPredicate(Checker checker) { + " - (6 * LOG10(((7 / ABS(8)) + 9))))) * POWER(10, 11)))"); } - @Test public void testFunctionWithDistinct() { + @Test void testFunctionWithDistinct() { expr("count(DISTINCT 1)").ok("COUNT(DISTINCT 1)"); expr("count(ALL 1)").ok("COUNT(ALL 1)"); expr("count(1)").ok("COUNT(1)"); @@ -1738,17 +1738,17 @@ void checkPeriodPredicate(Checker checker) { + "FROM `EMP`"); } - @Test public void testFunctionCallWithDot() { + @Test void testFunctionCallWithDot() { expr("foo(a,b).c") .ok("(`FOO`(`A`, `B`).`C`)"); } - @Test public void testFunctionInFunction() { + @Test void testFunctionInFunction() { expr("ln(power(2,2))") .ok("LN(POWER(2, 2))"); } - @Test public void testFunctionNamedArgument() { + @Test void testFunctionNamedArgument() { expr("foo(x => 1)") .ok("`FOO`(`X` => 1)"); expr("foo(x => 1, \"y\" => 'a', z => x <= y)") @@ -1759,7 +1759,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"=>\" at .*"); } - @Test public void testFunctionDefaultArgument() { + @Test void testFunctionDefaultArgument() { sql("foo(1, DEFAULT, default, 'default', \"default\", 3)").expression() .ok("`FOO`(1, DEFAULT, DEFAULT, 'default', `default`, 3)"); sql("foo(DEFAULT)").expression() @@ -1782,7 +1782,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"\\+\" at .*"); } - @Test public void testDefault() { + @Test void testDefault() { sql("select ^DEFAULT^ from emp") .fails("(?s)Encountered \"DEFAULT\" at .*"); sql("select cast(empno ^+^ DEFAULT as double) from emp") @@ -1807,7 +1807,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s)Encountered \"DEFAULT\" at .*"); } - @Test public void testAggregateFilter() { + @Test void testAggregateFilter() { final String sql = "select\n" + " sum(sal) filter (where gender = 'F') as femaleSal,\n" + " sum(sal) filter (where true) allSal,\n" @@ -1821,14 +1821,14 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testGroup() { + @Test void testGroup() { sql("select deptno, min(foo) as x from emp group by deptno, gender") .ok("SELECT `DEPTNO`, MIN(`FOO`) AS `X`\n" + "FROM `EMP`\n" + "GROUP BY `DEPTNO`, `GENDER`"); } - @Test public void testGroupEmpty() { + @Test void testGroupEmpty() { sql("select count(*) from emp group by ()") .ok("SELECT COUNT(*)\n" + "FROM `EMP`\n" @@ -1860,7 +1860,7 @@ void checkPeriodPredicate(Checker checker) { + "GROUP BY (`EMPNO` + `DEPTNO`)"); } - @Test public void testHavingAfterGroup() { + @Test void testHavingAfterGroup() { final String sql = "select deptno from emp group by deptno, emp\n" + "having count(*) > 5 and 1 = 2 order by 5, 2"; final String expected = "SELECT `DEPTNO`\n" @@ -1871,20 +1871,20 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testHavingBeforeGroupFails() { + @Test void testHavingBeforeGroupFails() { final String sql = "select deptno from emp\n" + "having count(*) > 5 and deptno < 4 ^group^ by deptno, emp"; sql(sql).fails("(?s).*Encountered \"group\" at .*"); } - @Test public void testHavingNoGroup() { + @Test void testHavingNoGroup() { sql("select deptno from emp having count(*) > 5") .ok("SELECT `DEPTNO`\n" + "FROM `EMP`\n" + "HAVING (COUNT(*) > 5)"); } - @Test public void testGroupingSets() { + @Test void testGroupingSets() { sql("select deptno from emp\n" + "group by grouping sets (deptno, (deptno, gender), ())") .ok("SELECT `DEPTNO`\n" @@ -1921,7 +1921,7 @@ void checkPeriodPredicate(Checker checker) { + "GROUP BY GROUPING SETS(())"); } - @Test public void testGroupByCube() { + @Test void testGroupByCube() { final String sql = "select deptno from emp\n" + "group by cube ((a, b), (c, d))"; final String expected = "SELECT `DEPTNO`\n" @@ -1930,7 +1930,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testGroupByCube2() { + @Test void testGroupByCube2() { final String sql = "select deptno from emp\n" + "group by cube ((a, b), (c, d)) order by a"; final String expected = "SELECT `DEPTNO`\n" @@ -1944,7 +1944,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql2).fails("(?s)Encountered \"\\)\" at .*"); } - @Test public void testGroupByRollup() { + @Test void testGroupByRollup() { final String sql = "select deptno from emp\n" + "group by rollup (deptno, deptno + 1, gender)"; final String expected = "SELECT `DEPTNO`\n" @@ -1958,7 +1958,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql1).fails("(?s)Encountered \", rollup\" at .*"); } - @Test public void testGrouping() { + @Test void testGrouping() { final String sql = "select deptno, grouping(deptno) from emp\n" + "group by grouping sets (deptno, (deptno, gender), ())"; final String expected = "SELECT `DEPTNO`, GROUPING(`DEPTNO`)\n" @@ -1967,7 +1967,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testWith() { + @Test void testWith() { final String sql = "with femaleEmps as (select * from emps where gender = 'F')" + "select deptno from femaleEmps"; final String expected = "WITH `FEMALEEMPS` AS (SELECT *\n" @@ -1977,7 +1977,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testWith2() { + @Test void testWith2() { final String sql = "with femaleEmps as (select * from emps where gender = 'F'),\n" + "marriedFemaleEmps(x, y) as (select * from femaleEmps where maritaStatus = 'M')\n" + "select deptno from femaleEmps"; @@ -1990,14 +1990,14 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testWithFails() { + @Test void testWithFails() { final String sql = "with femaleEmps as ^select^ *\n" + "from emps where gender = 'F'\n" + "select deptno from femaleEmps"; sql(sql).fails("(?s)Encountered \"select\" at .*"); } - @Test public void testWithValues() { + @Test void testWithValues() { final String sql = "with v(i,c) as (values (1, 'a'), (2, 'bb'))\n" + "select c, i from v"; final String expected = "WITH `V` (`I`, `C`) AS (VALUES (ROW(1, 'a')),\n" @@ -2006,7 +2006,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testWithNestedFails() { + @Test void testWithNestedFails() { // SQL standard does not allow WITH to contain WITH final String sql = "with emp2 as (select * from emp)\n" + "^with^ dept2 as (select * from dept)\n" @@ -2014,7 +2014,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).fails("(?s)Encountered \"with\" at .*"); } - @Test public void testWithNestedInSubQuery() { + @Test void testWithNestedInSubQuery() { // SQL standard does not allow sub-query to contain WITH but we do final String sql = "with emp2 as (select * from emp)\n" + "(\n" @@ -2027,7 +2027,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testWithUnion() { + @Test void testWithUnion() { // Per the standard WITH ... SELECT ... UNION is valid even without parens. final String sql = "with emp2 as (select * from emp)\n" + "select * from emp2\n" @@ -2042,7 +2042,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testIdentifier() { + @Test void testIdentifier() { expr("ab").ok("`AB`"); expr(" \"a \"\" b!c\"").ok("`a \" b!c`"); expr(" ^`^a \" b!c`") @@ -2060,7 +2060,7 @@ void checkPeriodPredicate(Checker checker) { getTester().checkNode("VALUES \"a\".b", isQuoted(1, false)); } - @Test public void testBackTickIdentifier() { + @Test void testBackTickIdentifier() { quoting = Quoting.BACK_TICK; expr("ab").ok("`AB`"); expr(" `a \" b!c`").ok("`a \" b!c`"); @@ -2078,7 +2078,7 @@ void checkPeriodPredicate(Checker checker) { getTester().checkNode("VALUES `a`", isQuoted(0, true)); } - @Test public void testBracketIdentifier() { + @Test void testBracketIdentifier() { quoting = Quoting.BRACKET; expr("ab").ok("`AB`"); expr(" [a \" b!c]").ok("`a \" b!c`"); @@ -2111,7 +2111,7 @@ void checkPeriodPredicate(Checker checker) { getTester().checkNode("VALUES [a]", isQuoted(0, true)); } - @Test public void testBackTickQuery() { + @Test void testBackTickQuery() { quoting = Quoting.BACK_TICK; sql("select `x`.`b baz` from `emp` as `x` where `x`.deptno in (10, 20)") .ok("SELECT `x`.`b baz`\n" @@ -2119,19 +2119,19 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (`x`.`DEPTNO` IN (10, 20))"); } - @Test public void testInList() { + @Test void testInList() { sql("select * from emp where deptno in (10, 20) and gender = 'F'") .ok("SELECT *\n" + "FROM `EMP`\n" + "WHERE ((`DEPTNO` IN (10, 20)) AND (`GENDER` = 'F'))"); } - @Test public void testInListEmptyFails() { + @Test void testInListEmptyFails() { sql("select * from emp where deptno in (^)^ and gender = 'F'") .fails("(?s).*Encountered \"\\)\" at line 1, column 36\\..*"); } - @Test public void testInQuery() { + @Test void testInQuery() { sql("select * from emp where deptno in (select deptno from dept)") .ok("SELECT *\n" + "FROM `EMP`\n" @@ -2139,7 +2139,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `DEPT`))"); } - @Test public void testSomeEveryAndIntersectionAggQuery() { + @Test void testSomeEveryAndIntersectionAggQuery() { sql("select some(deptno = 10), every(deptno > 0), intersection(multiset[1,2]) from dept") .ok("SELECT SOME((`DEPTNO` = 10)), EVERY((`DEPTNO` > 0)), INTERSECTION((MULTISET[1, 2]))\n" + "FROM `DEPT`"); @@ -2148,7 +2148,7 @@ void checkPeriodPredicate(Checker checker) { /** * Tricky for the parser - looks like "IN (scalar, scalar)" but isn't. */ - @Test public void testInQueryWithComma() { + @Test void testInQueryWithComma() { sql("select * from emp where deptno in (select deptno from dept group by 1, 2)") .ok("SELECT *\n" + "FROM `EMP`\n" @@ -2157,7 +2157,7 @@ void checkPeriodPredicate(Checker checker) { + "GROUP BY 1, 2))"); } - @Test public void testInSetop() { + @Test void testInSetop() { sql("select * from emp where deptno in (\n" + "(select deptno from dept union select * from dept)" + "except\n" @@ -2174,7 +2174,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `DEPT`)) AND FALSE)"); } - @Test public void testSome() { + @Test void testSome() { final String sql = "select * from emp\n" + "where sal > some (select comm from emp)"; final String expected = "SELECT *\n" @@ -2207,7 +2207,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql5).ok(expected5); } - @Test public void testAll() { + @Test void testAll() { final String sql = "select * from emp\n" + "where sal <= all (select comm from emp) or sal > 10"; final String expected = "SELECT *\n" @@ -2217,7 +2217,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testAllList() { + @Test void testAllList() { final String sql = "select * from emp\n" + "where sal <= all (12, 20, 30)"; final String expected = "SELECT *\n" @@ -2226,7 +2226,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testUnion() { + @Test void testUnion() { sql("select * from a union select * from a") .ok("(SELECT *\n" + "FROM `A`\n" @@ -2247,7 +2247,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `A`)"); } - @Test public void testUnionOrder() { + @Test void testUnionOrder() { sql("select a, b from t " + "union all " + "select x, y from u " @@ -2260,7 +2260,7 @@ void checkPeriodPredicate(Checker checker) { + "ORDER BY 1, 2 DESC"); } - @Test public void testOrderUnion() { + @Test void testOrderUnion() { // ORDER BY inside UNION not allowed sql("select a from t order by a\n" + "^union^ all\n" @@ -2268,7 +2268,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"union\" at .*"); } - @Test public void testLimitUnion() { + @Test void testLimitUnion() { // LIMIT inside UNION not allowed sql("select a from t limit 10\n" + "^union^ all\n" @@ -2276,7 +2276,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"union\" at .*"); } - @Test public void testUnionOfNonQueryFails() { + @Test void testUnionOfNonQueryFails() { sql("select 1 from emp union ^2^ + 5") .fails("Non-query expression encountered in illegal context"); } @@ -2285,14 +2285,14 @@ void checkPeriodPredicate(Checker checker) { * In modern SQL, a query can occur almost everywhere that an expression * can. This test tests the few exceptions. */ - @Test public void testQueryInIllegalContext() { + @Test void testQueryInIllegalContext() { sql("select 0, multiset[^(^select * from emp), 2] from dept") .fails("Query expression encountered in illegal context"); sql("select 0, multiset[1, ^(^select * from emp), 2, 3] from dept") .fails("Query expression encountered in illegal context"); } - @Test public void testExcept() { + @Test void testExcept() { sql("select * from a except select * from a") .ok("(SELECT *\n" + "FROM `A`\n" @@ -2315,7 +2315,7 @@ void checkPeriodPredicate(Checker checker) { /** Tests MINUS, which is equivalent to EXCEPT but only supported in some * conformance levels (e.g. ORACLE). */ - @Test public void testSetMinus() { + @Test void testSetMinus() { final String pattern = "MINUS is not allowed under the current SQL conformance level"; final String sql = "select col1 from table1 ^MINUS^ select col1 from table2"; @@ -2343,7 +2343,7 @@ void checkPeriodPredicate(Checker checker) { * in the default conformance, where it is not allowed as an alternative to * EXCEPT. (It is reserved in Oracle but not in any version of the SQL * standard.) */ - @Test public void testMinusIsReserved() { + @Test void testMinusIsReserved() { sql("select ^minus^ from t") .fails("(?s).*Encountered \"minus\" at .*"); sql("select ^minus^ select") @@ -2352,7 +2352,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"minus\" at .*"); } - @Test public void testIntersect() { + @Test void testIntersect() { sql("select * from a intersect select * from a") .ok("(SELECT *\n" + "FROM `A`\n" @@ -2373,14 +2373,14 @@ void checkPeriodPredicate(Checker checker) { + "FROM `A`)"); } - @Test public void testJoinCross() { + @Test void testJoinCross() { sql("select * from a as a2 cross join b") .ok("SELECT *\n" + "FROM `A` AS `A2`\n" + "CROSS JOIN `B`"); } - @Test public void testJoinOn() { + @Test void testJoinOn() { sql("select * from a left join b on 1 = 1 and 2 = 2 where 3 = 3") .ok("SELECT *\n" + "FROM `A`\n" @@ -2388,7 +2388,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (3 = 3)"); } - @Test public void testJoinOnParentheses() { + @Test void testJoinOnParentheses() { if (!Bug.TODO_FIXED) { return; } @@ -2404,7 +2404,7 @@ void checkPeriodPredicate(Checker checker) { /** * Same as {@link #testJoinOnParentheses()} but fancy aliases. */ - @Test public void testJoinOnParenthesesPlus() { + @Test void testJoinOnParenthesesPlus() { if (!Bug.TODO_FIXED) { return; } @@ -2418,7 +2418,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (3 = 3)"); } - @Test public void testExplicitTableInJoin() { + @Test void testExplicitTableInJoin() { sql("select * from a left join (table b) on 2 = 2 where 3 = 3") .ok("SELECT *\n" + "FROM `A`\n" @@ -2426,7 +2426,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (3 = 3)"); } - @Test public void testSubQueryInJoin() { + @Test void testSubQueryInJoin() { if (!Bug.TODO_FIXED) { return; } @@ -2441,7 +2441,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (4 = 4)"); } - @Test public void testOuterJoinNoiseWord() { + @Test void testOuterJoinNoiseWord() { sql("select * from a left outer join b on 1 = 1 and 2 = 2 where 3 = 3") .ok("SELECT *\n" + "FROM `A`\n" @@ -2449,7 +2449,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (3 = 3)"); } - @Test public void testJoinQuery() { + @Test void testJoinQuery() { sql("select * from a join (select * from b) as b2 on true") .ok("SELECT *\n" + "FROM `A`\n" @@ -2457,13 +2457,13 @@ void checkPeriodPredicate(Checker checker) { + "FROM `B`) AS `B2` ON TRUE"); } - @Test public void testFullInnerJoinFails() { + @Test void testFullInnerJoinFails() { // cannot have more than one of INNER, FULL, LEFT, RIGHT, CROSS sql("select * from a ^full^ inner join b") .fails("(?s).*Encountered \"full inner\" at line 1, column 17.*"); } - @Test public void testFullOuterJoin() { + @Test void testFullOuterJoin() { // OUTER is an optional extra to LEFT, RIGHT, or FULL sql("select * from a full outer join b") .ok("SELECT *\n" @@ -2471,13 +2471,13 @@ void checkPeriodPredicate(Checker checker) { + "FULL JOIN `B`"); } - @Test public void testInnerOuterJoinFails() { + @Test void testInnerOuterJoinFails() { sql("select * from a ^inner^ outer join b") .fails("(?s).*Encountered \"inner outer\" at line 1, column 17.*"); } @Disabled - @Test public void testJoinAssociativity() { + @Test void testJoinAssociativity() { // joins are left-associative // 1. no parens needed sql("select * from (a natural left join b) left join c on b.c1 = c.c1") @@ -2498,14 +2498,14 @@ void checkPeriodPredicate(Checker checker) { // Note: "select * from a natural cross join b" is actually illegal SQL // ("cross" is the only join type which cannot be modified with the // "natural") but the parser allows it; we and catch it at validate time - @Test public void testNaturalCrossJoin() { + @Test void testNaturalCrossJoin() { sql("select * from a natural cross join b") .ok("SELECT *\n" + "FROM `A`\n" + "NATURAL CROSS JOIN `B`"); } - @Test public void testJoinUsing() { + @Test void testJoinUsing() { sql("select * from a join b using (x)") .ok("SELECT *\n" + "FROM `A`\n" @@ -2516,7 +2516,7 @@ void checkPeriodPredicate(Checker checker) { /** Tests CROSS APPLY, which is equivalent to CROSS JOIN and LEFT JOIN but * only supported in some conformance levels (e.g. SQL Server). */ - @Test public void testApply() { + @Test void testApply() { final String pattern = "APPLY operator is not allowed under the current SQL conformance level"; final String sql = "select * from dept\n" @@ -2538,7 +2538,7 @@ void checkPeriodPredicate(Checker checker) { } /** Tests OUTER APPLY. */ - @Test public void testOuterApply() { + @Test void testOuterApply() { conformance = SqlConformanceEnum.SQL_SERVER_2008; final String sql = "select * from dept outer apply table(ramp(deptno))"; final String expected = "SELECT *\n" @@ -2547,7 +2547,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testOuterApplySubQuery() { + @Test void testOuterApplySubQuery() { conformance = SqlConformanceEnum.SQL_SERVER_2008; final String sql = "select * from dept\n" + "outer apply (select * from emp where emp.deptno = dept.deptno)"; @@ -2559,7 +2559,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testOuterApplyValues() { + @Test void testOuterApplyValues() { conformance = SqlConformanceEnum.SQL_SERVER_2008; final String sql = "select * from dept\n" + "outer apply (select * from emp where emp.deptno = dept.deptno)"; @@ -2573,13 +2573,13 @@ void checkPeriodPredicate(Checker checker) { /** Even in SQL Server conformance mode, we do not yet support * 'function(args)' as an abbreviation for 'table(function(args)'. */ - @Test public void testOuterApplyFunctionFails() { + @Test void testOuterApplyFunctionFails() { conformance = SqlConformanceEnum.SQL_SERVER_2008; final String sql = "select * from dept outer apply ramp(deptno^)^)"; sql(sql).fails("(?s).*Encountered \"\\)\" at .*"); } - @Test public void testCrossOuterApply() { + @Test void testCrossOuterApply() { conformance = SqlConformanceEnum.SQL_SERVER_2008; final String sql = "select * from dept\n" + "cross apply table(ramp(deptno)) as t(a)\n" @@ -2591,7 +2591,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testTableSample() { + @Test void testTableSample() { final String sql0 = "select * from (" + " select * " + " from emp " @@ -2642,7 +2642,7 @@ void checkPeriodPredicate(Checker checker) { + "can not be parsed to type 'java\\.lang\\.Integer'"); } - @Test public void testLiteral() { + @Test void testLiteral() { expr("'foo'").same(); expr("100").same(); sql("select 1 as uno, 'x' as x, null as n from emp") @@ -2665,7 +2665,7 @@ void checkPeriodPredicate(Checker checker) { expr("NULL").same(); } - @Test public void testContinuedLiteral() { + @Test void testContinuedLiteral() { expr("'abba'\n'abba'") .ok("'abba'\n'abba'"); expr("'abba'\n'0001'") @@ -2683,7 +2683,7 @@ void checkPeriodPredicate(Checker checker) { .fails("Binary literal string must contain only characters '0' - '9', 'A' - 'F'"); } - @Test public void testMixedFrom() { + @Test void testMixedFrom() { // REVIEW: Is this syntax even valid? sql("select * from a join b using (x), c join d using (y)") .ok("SELECT *\n" @@ -2693,14 +2693,14 @@ void checkPeriodPredicate(Checker checker) { + "INNER JOIN `D` USING (`Y`)"); } - @Test public void testMixedStar() { + @Test void testMixedStar() { sql("select emp.*, 1 as foo from emp, dept") .ok("SELECT `EMP`.*, 1 AS `FOO`\n" + "FROM `EMP`,\n" + "`DEPT`"); } - @Test public void testSchemaTableStar() { + @Test void testSchemaTableStar() { sql("select schem.emp.*, emp.empno * dept.deptno\n" + "from schem.emp, dept") .ok("SELECT `SCHEM`.`EMP`.*, (`EMP`.`EMPNO` * `DEPT`.`DEPTNO`)\n" @@ -2708,20 +2708,20 @@ void checkPeriodPredicate(Checker checker) { + "`DEPT`"); } - @Test public void testCatalogSchemaTableStar() { + @Test void testCatalogSchemaTableStar() { sql("select cat.schem.emp.* from cat.schem.emp") .ok("SELECT `CAT`.`SCHEM`.`EMP`.*\n" + "FROM `CAT`.`SCHEM`.`EMP`"); } - @Test public void testAliasedStar() { + @Test void testAliasedStar() { // OK in parser; validator will give error sql("select emp.* as foo from emp") .ok("SELECT `EMP`.* AS `FOO`\n" + "FROM `EMP`"); } - @Test public void testNotExists() { + @Test void testNotExists() { sql("select * from dept where not not exists (select * from emp) and true") .ok("SELECT *\n" + "FROM `DEPT`\n" @@ -2729,14 +2729,14 @@ void checkPeriodPredicate(Checker checker) { + "FROM `EMP`)))) AND TRUE)"); } - @Test public void testOrder() { + @Test void testOrder() { sql("select * from emp order by empno, gender desc, deptno asc, empno asc, name desc") .ok("SELECT *\n" + "FROM `EMP`\n" + "ORDER BY `EMPNO`, `GENDER` DESC, `DEPTNO`, `EMPNO`, `NAME` DESC"); } - @Test public void testOrderNullsFirst() { + @Test void testOrderNullsFirst() { final String sql = "select * from emp\n" + "order by gender desc nulls last,\n" + " deptno asc nulls first,\n" @@ -2748,7 +2748,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testOrderInternal() { + @Test void testOrderInternal() { sql("(select * from emp order by empno) union select * from emp") .ok("((SELECT *\n" + "FROM `EMP`\n" @@ -2765,7 +2765,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (`A` = `B`)"); } - @Test public void testOrderIllegalInExpression() { + @Test void testOrderIllegalInExpression() { sql("select (select 1 from foo order by x,y) from t where a = b") .ok("SELECT (SELECT 1\n" + "FROM `FOO`\n" @@ -2776,7 +2776,7 @@ void checkPeriodPredicate(Checker checker) { .fails("ORDER BY unexpected"); } - @Test public void testOrderOffsetFetch() { + @Test void testOrderOffsetFetch() { sql("select a from foo order by b, c offset 1 row fetch first 2 row only") .ok("SELECT `A`\n" + "FROM `FOO`\n" @@ -2847,7 +2847,7 @@ void checkPeriodPredicate(Checker checker) { * "OFFSET ... FETCH". It all maps down to a parse tree that looks like * SQL:2008. */ - @Test public void testLimit() { + @Test void testLimit() { sql("select a from foo order by b, c limit 2 offset 1") .ok("SELECT `A`\n" + "FROM `FOO`\n" @@ -2869,7 +2869,7 @@ void checkPeriodPredicate(Checker checker) { /** Test case that does not reproduce but is related to * [CALCITE-1238] * Unparsing LIMIT without ORDER BY after validation. */ - @Test public void testLimitWithoutOrder() { + @Test void testLimitWithoutOrder() { final String expected = "SELECT `A`\n" + "FROM `FOO`\n" + "FETCH NEXT 2 ROWS ONLY"; @@ -2877,7 +2877,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testLimitOffsetWithoutOrder() { + @Test void testLimitOffsetWithoutOrder() { final String expected = "SELECT `A`\n" + "FROM `FOO`\n" + "OFFSET 1 ROWS\n" @@ -2886,7 +2886,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testLimitStartCount() { + @Test void testLimitStartCount() { conformance = SqlConformanceEnum.DEFAULT; final String error = "'LIMIT start, count' is not allowed under the " + "current SQL conformance level"; @@ -2934,7 +2934,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"all\" at line 1.*"); } - @Test public void testSqlInlineComment() { + @Test void testSqlInlineComment() { sql("select 1 from t --this is a comment\n") .ok("SELECT 1\n" + "FROM `T`"); @@ -2951,7 +2951,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `T`"); } - @Test public void testMultilineComment() { + @Test void testMultilineComment() { // on single line sql("select 1 /* , 2 */, 3 from t") .ok("SELECT 1, 3\n" @@ -3048,7 +3048,7 @@ void checkPeriodPredicate(Checker checker) { } // expressions - @Test public void testParseNumber() { + @Test void testParseNumber() { // Exacts expr("1").ok("1"); expr("+1.").ok("1"); @@ -3088,49 +3088,49 @@ void checkPeriodPredicate(Checker checker) { .ok("(1 + ((-2 * -3E-1) / -4))"); } - @Test public void testParseNumberFails() { + @Test void testParseNumberFails() { sql("SELECT 0.5e1^.1^ from t") .fails("(?s).*Encountered .*\\.1.* at line 1.*"); } - @Test public void testMinusPrefixInExpression() { + @Test void testMinusPrefixInExpression() { expr("-(1+2)") .ok("(- (1 + 2))"); } // operator precedence - @Test public void testPrecedence0() { + @Test void testPrecedence0() { expr("1 + 2 * 3 * 4 + 5") .ok("((1 + ((2 * 3) * 4)) + 5)"); } - @Test public void testPrecedence1() { + @Test void testPrecedence1() { expr("1 + 2 * (3 * (4 + 5))") .ok("(1 + (2 * (3 * (4 + 5))))"); } - @Test public void testPrecedence2() { + @Test void testPrecedence2() { expr("- - 1").ok("1"); // special case for unary minus } - @Test public void testPrecedence2b() { + @Test void testPrecedence2b() { expr("not not 1").ok("(NOT (NOT 1))"); // two prefixes } - @Test public void testPrecedence3() { + @Test void testPrecedence3() { expr("- 1 is null").ok("(-1 IS NULL)"); // prefix vs. postfix } - @Test public void testPrecedence4() { + @Test void testPrecedence4() { expr("1 - -2").ok("(1 - -2)"); // infix, prefix '-' } - @Test public void testPrecedence5() { + @Test void testPrecedence5() { expr("1++2").ok("(1 + 2)"); // infix, prefix '+' expr("1+ +2").ok("(1 + 2)"); // infix, prefix '+' } - @Test public void testPrecedenceSetOps() { + @Test void testPrecedenceSetOps() { final String sql = "select * from a union " + "select * from b intersect " + "select * from c intersect " @@ -3161,7 +3161,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testQueryInFrom() { + @Test void testQueryInFrom() { // one query with 'as', the other without sql("select * from (select * from emp) as e join (select * from dept) d") .ok("SELECT *\n" @@ -3171,7 +3171,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `DEPT`) AS `D`"); } - @Test public void testQuotesInString() { + @Test void testQuotesInString() { expr("'a''b'") .ok("'a''b'"); expr("'''x'") @@ -3182,7 +3182,7 @@ void checkPeriodPredicate(Checker checker) { .ok("'Quoted strings aren''t \"hard\"'"); } - @Test public void testScalarQueryInWhere() { + @Test void testScalarQueryInWhere() { sql("select * from emp where 3 = (select count(*) from dept where dept.deptno = emp.deptno)") .ok("SELECT *\n" + "FROM `EMP`\n" @@ -3191,7 +3191,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (`DEPT`.`DEPTNO` = `EMP`.`DEPTNO`)))"); } - @Test public void testScalarQueryInSelect() { + @Test void testScalarQueryInSelect() { sql("select x, (select count(*) from dept where dept.deptno = emp.deptno) from emp") .ok("SELECT `X`, (SELECT COUNT(*)\n" + "FROM `DEPT`\n" @@ -3199,61 +3199,61 @@ void checkPeriodPredicate(Checker checker) { + "FROM `EMP`"); } - @Test public void testSelectList() { + @Test void testSelectList() { sql("select * from emp, dept") .ok("SELECT *\n" + "FROM `EMP`,\n" + "`DEPT`"); } - @Test public void testSelectWithoutFrom() { + @Test void testSelectWithoutFrom() { sql("select 2+2") .ok("SELECT (2 + 2)"); } - @Test public void testSelectWithoutFrom2() { + @Test void testSelectWithoutFrom2() { sql("select 2+2 as x, 'a' as y") .ok("SELECT (2 + 2) AS `X`, 'a' AS `Y`"); } - @Test public void testSelectDistinctWithoutFrom() { + @Test void testSelectDistinctWithoutFrom() { sql("select distinct 2+2 as x, 'a' as y") .ok("SELECT DISTINCT (2 + 2) AS `X`, 'a' AS `Y`"); } - @Test public void testSelectWithoutFromWhereFails() { + @Test void testSelectWithoutFromWhereFails() { sql("select 2+2 as x ^where^ 1 > 2") .fails("(?s).*Encountered \"where\" at line .*"); } - @Test public void testSelectWithoutFromGroupByFails() { + @Test void testSelectWithoutFromGroupByFails() { sql("select 2+2 as x ^group^ by 1, 2") .fails("(?s).*Encountered \"group\" at line .*"); } - @Test public void testSelectWithoutFromHavingFails() { + @Test void testSelectWithoutFromHavingFails() { sql("select 2+2 as x ^having^ 1 > 2") .fails("(?s).*Encountered \"having\" at line .*"); } - @Test public void testSelectList3() { + @Test void testSelectList3() { sql("select 1, emp.*, 2 from emp") .ok("SELECT 1, `EMP`.*, 2\n" + "FROM `EMP`"); } - @Test public void testSelectList4() { + @Test void testSelectList4() { sql("select ^from^ emp") .fails("(?s).*Encountered \"from\" at line .*"); } - @Test public void testStar() { + @Test void testStar() { sql("select * from emp") .ok("SELECT *\n" + "FROM `EMP`"); } - @Test public void testCompoundStar() { + @Test void testCompoundStar() { final String sql = "select sales.emp.address.zipcode,\n" + " sales.emp.address.*\n" + "from sales.emp"; @@ -3263,13 +3263,13 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testSelectDistinct() { + @Test void testSelectDistinct() { sql("select distinct foo from bar") .ok("SELECT DISTINCT `FOO`\n" + "FROM `BAR`"); } - @Test public void testSelectAll() { + @Test void testSelectAll() { // "unique" is the default -- so drop the keyword sql("select * from (select all foo from bar) as xyz") .ok("SELECT *\n" @@ -3277,43 +3277,43 @@ void checkPeriodPredicate(Checker checker) { + "FROM `BAR`) AS `XYZ`"); } - @Test public void testSelectStream() { + @Test void testSelectStream() { sql("select stream foo from bar") .ok("SELECT STREAM `FOO`\n" + "FROM `BAR`"); } - @Test public void testSelectStreamDistinct() { + @Test void testSelectStreamDistinct() { sql("select stream distinct foo from bar") .ok("SELECT STREAM DISTINCT `FOO`\n" + "FROM `BAR`"); } - @Test public void testWhere() { + @Test void testWhere() { sql("select * from emp where empno > 5 and gender = 'F'") .ok("SELECT *\n" + "FROM `EMP`\n" + "WHERE ((`EMPNO` > 5) AND (`GENDER` = 'F'))"); } - @Test public void testNestedSelect() { + @Test void testNestedSelect() { sql("select * from (select * from emp)") .ok("SELECT *\n" + "FROM (SELECT *\n" + "FROM `EMP`)"); } - @Test public void testValues() { + @Test void testValues() { sql("values(1,'two')") .ok("VALUES (ROW(1, 'two'))"); } - @Test public void testValuesExplicitRow() { + @Test void testValuesExplicitRow() { sql("values row(1,'two')") .ok("VALUES (ROW(1, 'two'))"); } - @Test public void testFromValues() { + @Test void testFromValues() { sql("select * from (values(1,'two'), 3, (4, 'five'))") .ok("SELECT *\n" + "FROM (VALUES (ROW(1, 'two')),\n" @@ -3321,7 +3321,7 @@ void checkPeriodPredicate(Checker checker) { + "(ROW(4, 'five')))"); } - @Test public void testFromValuesWithoutParens() { + @Test void testFromValuesWithoutParens() { sql("select 1 from ^values^('x')") .fails("(?s)Encountered \"values\" at line 1, column 15\\.\n" + "Was expecting one of:\n" @@ -3336,7 +3336,7 @@ void checkPeriodPredicate(Checker checker) { + " \"\\(\" \\.\\.\\.\n.*"); } - @Test public void testEmptyValues() { + @Test void testEmptyValues() { sql("select * from (values(^)^)") .fails("(?s).*Encountered \"\\)\" at .*"); } @@ -3345,7 +3345,7 @@ void checkPeriodPredicate(Checker checker) { * [CALCITE-493] * Add EXTEND clause, for defining columns and their types at query/DML * time. */ - @Test public void testTableExtend() { + @Test void testTableExtend() { sql("select * from emp extend (x int, y varchar(10) not null)") .ok("SELECT *\n" + "FROM `EMP` EXTEND (`X` INTEGER, `Y` VARCHAR(10))"); @@ -3379,7 +3379,7 @@ void checkPeriodPredicate(Checker checker) { + "WHERE (`X` = `Y`)"); } - @Test public void testExplicitTable() { + @Test void testExplicitTable() { sql("table emp") .ok("(TABLE `EMP`)"); @@ -3387,19 +3387,19 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s)Encountered \"123\" at line 1, column 7\\.\n.*"); } - @Test public void testExplicitTableOrdered() { + @Test void testExplicitTableOrdered() { sql("table emp order by name") .ok("(TABLE `EMP`)\n" + "ORDER BY `NAME`"); } - @Test public void testSelectFromExplicitTable() { + @Test void testSelectFromExplicitTable() { sql("select * from (table emp)") .ok("SELECT *\n" + "FROM (TABLE `EMP`)"); } - @Test public void testSelectFromBareExplicitTableFails() { + @Test void testSelectFromBareExplicitTableFails() { sql("select * from table ^emp^") .fails("(?s).*Encountered \"emp\" at .*"); @@ -3407,13 +3407,13 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s)Encountered \"\\(\".*"); } - @Test public void testCollectionTable() { + @Test void testCollectionTable() { sql("select * from table(ramp(3, 4))") .ok("SELECT *\n" + "FROM TABLE(`RAMP`(3, 4))"); } - @Test public void testDescriptor() { + @Test void testDescriptor() { sql("select * from table(ramp(descriptor(column_name)))") .ok("SELECT *\n" + "FROM TABLE(`RAMP`(DESCRIPTOR(`COLUMN_NAME`)))"); @@ -3425,14 +3425,14 @@ void checkPeriodPredicate(Checker checker) { + "FROM TABLE(`RAMP`(DESCRIPTOR(`COLUMN_NAME1`, `COLUMN_NAME2`, `COLUMN_NAME3`)))"); } - @Test public void testCollectionTableWithCursorParam() { + @Test void testCollectionTableWithCursorParam() { sql("select * from table(dedup(cursor(select * from emps),'name'))") .ok("SELECT *\n" + "FROM TABLE(`DEDUP`((CURSOR ((SELECT *\n" + "FROM `EMPS`))), 'name'))"); } - @Test public void testCollectionTableWithColumnListParam() { + @Test void testCollectionTableWithColumnListParam() { sql("select * from table(dedup(cursor(select * from emps)," + "row(empno, name)))") .ok("SELECT *\n" @@ -3440,7 +3440,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `EMPS`))), (ROW(`EMPNO`, `NAME`))))"); } - @Test public void testLateral() { + @Test void testLateral() { // Bad: LATERAL table sql("select * from lateral ^emp^") .fails("(?s)Encountered \"emp\" at .*"); @@ -3476,7 +3476,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected2 + " AS `T` (`X`)"); } - @Test public void testTemporalTable() { + @Test void testTemporalTable() { final String sql0 = "select stream * from orders, products\n" + "for system_time as of TIMESTAMP '2011-01-02 00:00:00'"; final String expected0 = "SELECT STREAM *\n" @@ -3524,7 +3524,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql4).ok(expected4); } - @Test public void testCollectionTableWithLateral() { + @Test void testCollectionTableWithLateral() { final String sql = "select * from dept, lateral table(ramp(dept.deptno))"; final String expected = "SELECT *\n" + "FROM `DEPT`,\n" @@ -3532,7 +3532,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testCollectionTableWithLateral2() { + @Test void testCollectionTableWithLateral2() { final String sql = "select * from dept as d\n" + "cross join lateral table(ramp(dept.deptno)) as r"; final String expected = "SELECT *\n" @@ -3541,7 +3541,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testCollectionTableWithLateral3() { + @Test void testCollectionTableWithLateral3() { // LATERAL before first table in FROM clause doesn't achieve anything, but // it's valid. final String sql = "select * from lateral table(ramp(dept.deptno)), dept"; @@ -3551,7 +3551,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testIllegalCursors() { + @Test void testIllegalCursors() { sql("select ^cursor^(select * from emps) from emps") .fails("CURSOR expression encountered in illegal context"); sql("call list(^cursor^(select * from emps))") @@ -3560,7 +3560,7 @@ void checkPeriodPredicate(Checker checker) { .fails("CURSOR expression encountered in illegal context"); } - @Test public void testExplain() { + @Test void testExplain() { final String sql = "explain plan for select * from emps"; final String expected = "EXPLAIN PLAN" + " INCLUDING ATTRIBUTES WITH IMPLEMENTATION FOR\n" @@ -3569,7 +3569,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testExplainAsXml() { + @Test void testExplainAsXml() { final String sql = "explain plan as xml for select * from emps"; final String expected = "EXPLAIN PLAN" + " INCLUDING ATTRIBUTES WITH IMPLEMENTATION AS XML FOR\n" @@ -3578,7 +3578,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testExplainAsJson() { + @Test void testExplainAsJson() { final String sql = "explain plan as json for select * from emps"; final String expected = "EXPLAIN PLAN" + " INCLUDING ATTRIBUTES WITH IMPLEMENTATION AS JSON FOR\n" @@ -3587,34 +3587,34 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testExplainWithImpl() { + @Test void testExplainWithImpl() { sql("explain plan with implementation for select * from emps") .ok("EXPLAIN PLAN INCLUDING ATTRIBUTES WITH IMPLEMENTATION FOR\n" + "SELECT *\n" + "FROM `EMPS`"); } - @Test public void testExplainWithoutImpl() { + @Test void testExplainWithoutImpl() { sql("explain plan without implementation for select * from emps") .ok("EXPLAIN PLAN INCLUDING ATTRIBUTES WITHOUT IMPLEMENTATION FOR\n" + "SELECT *\n" + "FROM `EMPS`"); } - @Test public void testExplainWithType() { + @Test void testExplainWithType() { sql("explain plan with type for (values (true))") .ok("EXPLAIN PLAN INCLUDING ATTRIBUTES WITH TYPE FOR\n" + "(VALUES (ROW(TRUE)))"); } - @Test public void testExplainJsonFormat() { + @Test void testExplainJsonFormat() { final String sql = "explain plan as json for select * from emps"; TesterImpl tester = (TesterImpl) getTester(); SqlExplain sqlExplain = (SqlExplain) tester.parseStmtsAndHandleEx(sql).get(0); assertEquals(sqlExplain.isJson(), true); } - @Test public void testDescribeSchema() { + @Test void testDescribeSchema() { sql("describe schema A") .ok("DESCRIBE SCHEMA `A`"); // Currently DESCRIBE DATABASE, DESCRIBE CATALOG become DESCRIBE SCHEMA. @@ -3625,7 +3625,7 @@ void checkPeriodPredicate(Checker checker) { .ok("DESCRIBE SCHEMA `A`"); } - @Test public void testDescribeTable() { + @Test void testDescribeTable() { sql("describe emps") .ok("DESCRIBE TABLE `EMPS`"); sql("describe \"emps\"") @@ -3647,7 +3647,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"\\.\" at .*"); } - @Test public void testDescribeStatement() { + @Test void testDescribeStatement() { // Currently DESCRIBE STATEMENT becomes EXPLAIN. // See [CALCITE-1221] Implement DESCRIBE DATABASE, CATALOG, STATEMENT final String expected0 = "" @@ -3684,12 +3684,12 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"explain\" at .*"); } - @Test public void testSelectIsNotDdl() { + @Test void testSelectIsNotDdl() { sql("select 1 from t") .node(not(isDdl())); } - @Test public void testInsertSelect() { + @Test void testInsertSelect() { final String expected = "INSERT INTO `EMPS`\n" + "(SELECT *\n" + "FROM `EMPS`)"; @@ -3698,7 +3698,7 @@ void checkPeriodPredicate(Checker checker) { .node(not(isDdl())); } - @Test public void testInsertUnion() { + @Test void testInsertUnion() { final String expected = "INSERT INTO `EMPS`\n" + "(SELECT *\n" + "FROM `EMPS1`\n" @@ -3709,7 +3709,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testInsertValues() { + @Test void testInsertValues() { final String expected = "INSERT INTO `EMPS`\n" + "VALUES (ROW(1, 'Fredkin'))"; sql("insert into emps values (1,'Fredkin')") @@ -3717,7 +3717,7 @@ void checkPeriodPredicate(Checker checker) { .node(not(isDdl())); } - @Test public void testInsertValuesDefault() { + @Test void testInsertValuesDefault() { final String expected = "INSERT INTO `EMPS`\n" + "VALUES (ROW(1, DEFAULT, 'Fredkin'))"; sql("insert into emps values (1,DEFAULT,'Fredkin')") @@ -3725,7 +3725,7 @@ void checkPeriodPredicate(Checker checker) { .node(not(isDdl())); } - @Test public void testInsertValuesRawDefault() { + @Test void testInsertValuesRawDefault() { final String expected = "INSERT INTO `EMPS`\n" + "VALUES (ROW(DEFAULT))"; sql("insert into emps values ^default^") @@ -3735,7 +3735,7 @@ void checkPeriodPredicate(Checker checker) { .node(not(isDdl())); } - @Test public void testInsertColumnList() { + @Test void testInsertColumnList() { final String expected = "INSERT INTO `EMPS` (`X`, `Y`)\n" + "(SELECT *\n" + "FROM `EMPS`)"; @@ -3743,7 +3743,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testInsertCaseSensitiveColumnList() { + @Test void testInsertCaseSensitiveColumnList() { final String expected = "INSERT INTO `emps` (`x`, `y`)\n" + "(SELECT *\n" + "FROM `EMPS`)"; @@ -3751,7 +3751,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testInsertExtendedColumnList() { + @Test void testInsertExtendedColumnList() { String expected = "INSERT INTO `EMPS` EXTEND (`Z` BOOLEAN) (`X`, `Y`)\n" + "(SELECT *\n" + "FROM `EMPS`)"; @@ -3765,7 +3765,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testUpdateExtendedColumnList() { + @Test void testUpdateExtendedColumnList() { final String expected = "UPDATE `EMPDEFAULTS` EXTEND (`EXTRA` BOOLEAN, `NOTE` VARCHAR)" + " SET `DEPTNO` = 1" + ", `EXTRA` = TRUE" @@ -3780,7 +3780,7 @@ void checkPeriodPredicate(Checker checker) { } - @Test public void testUpdateCaseSensitiveExtendedColumnList() { + @Test void testUpdateCaseSensitiveExtendedColumnList() { final String expected = "UPDATE `EMPDEFAULTS` EXTEND (`extra` BOOLEAN, `NOTE` VARCHAR)" + " SET `DEPTNO` = 1" + ", `extra` = TRUE" @@ -3794,7 +3794,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testInsertCaseSensitiveExtendedColumnList() { + @Test void testInsertCaseSensitiveExtendedColumnList() { String expected = "INSERT INTO `emps` EXTEND (`z` BOOLEAN) (`x`, `y`)\n" + "(SELECT *\n" + "FROM `EMPS`)"; @@ -3808,7 +3808,7 @@ void checkPeriodPredicate(Checker checker) { .ok(expected); } - @Test public void testExplainInsert() { + @Test void testExplainInsert() { final String expected = "EXPLAIN PLAN INCLUDING ATTRIBUTES" + " WITH IMPLEMENTATION FOR\n" + "INSERT INTO `EMPS1`\n" @@ -3819,7 +3819,7 @@ void checkPeriodPredicate(Checker checker) { .node(not(isDdl())); } - @Test public void testUpsertValues() { + @Test void testUpsertValues() { final String expected = "UPSERT INTO `EMPS`\n" + "VALUES (ROW(1, 'Fredkin'))"; final String sql = "upsert into emps values (1,'Fredkin')"; @@ -3830,7 +3830,7 @@ void checkPeriodPredicate(Checker checker) { } } - @Test public void testUpsertSelect() { + @Test void testUpsertSelect() { final String sql = "upsert into emps select * from emp as e"; final String expected = "UPSERT INTO `EMPS`\n" + "(SELECT *\n" @@ -3840,7 +3840,7 @@ void checkPeriodPredicate(Checker checker) { } } - @Test public void testExplainUpsert() { + @Test void testExplainUpsert() { final String sql = "explain plan for upsert into emps1 values (1, 2)"; final String expected = "EXPLAIN PLAN INCLUDING ATTRIBUTES" + " WITH IMPLEMENTATION FOR\n" @@ -3851,26 +3851,26 @@ void checkPeriodPredicate(Checker checker) { } } - @Test public void testDelete() { + @Test void testDelete() { sql("delete from emps") .ok("DELETE FROM `EMPS`") .node(not(isDdl())); } - @Test public void testDeleteWhere() { + @Test void testDeleteWhere() { sql("delete from emps where empno=12") .ok("DELETE FROM `EMPS`\n" + "WHERE (`EMPNO` = 12)"); } - @Test public void testUpdate() { + @Test void testUpdate() { sql("update emps set empno = empno + 1, sal = sal - 1 where empno=12") .ok("UPDATE `EMPS` SET `EMPNO` = (`EMPNO` + 1)" + ", `SAL` = (`SAL` - 1)\n" + "WHERE (`EMPNO` = 12)"); } - @Test public void testMergeSelectSource() { + @Test void testMergeSelectSource() { final String sql = "merge into emps e " + "using (select * from tempemps where deptno is null) t " + "on e.empno = t.empno " @@ -3893,7 +3893,7 @@ void checkPeriodPredicate(Checker checker) { } /** Same as testMergeSelectSource but set with compound identifier. */ - @Test public void testMergeSelectSource2() { + @Test void testMergeSelectSource2() { final String sql = "merge into emps e " + "using (select * from tempemps where deptno is null) t " + "on e.empno = t.empno " @@ -3915,7 +3915,7 @@ void checkPeriodPredicate(Checker checker) { .node(not(isDdl())); } - @Test public void testMergeTableRefSource() { + @Test void testMergeTableRefSource() { final String sql = "merge into emps e " + "using tempemps as t " + "on e.empno = t.empno " @@ -3935,7 +3935,7 @@ void checkPeriodPredicate(Checker checker) { } /** Same with testMergeTableRefSource but set with compound identifier. */ - @Test public void testMergeTableRefSource2() { + @Test void testMergeTableRefSource2() { final String sql = "merge into emps e " + "using tempemps as t " + "on e.empno = t.empno " @@ -3954,13 +3954,13 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testBitStringNotImplemented() { + @Test void testBitStringNotImplemented() { // Bit-string is longer part of the SQL standard. We do not support it. sql("select B^'1011'^ || 'foobar' from (values (true))") .fails("(?s).*Encountered \"\\\\'1011\\\\'\" at line 1, column 9.*"); } - @Test public void testHexAndBinaryString() { + @Test void testHexAndBinaryString() { expr("x''=X'2'") .ok("(X'' = X'2')"); expr("x'fffff'=X''") @@ -3981,7 +3981,7 @@ void checkPeriodPredicate(Checker checker) { .ok("(X'001' = X'000102')"); } - @Test public void testHexAndBinaryStringFails() { + @Test void testHexAndBinaryStringFails() { sql("select ^x'FeedGoats'^ from t") .fails("Binary literal string must contain only characters '0' - '9', 'A' - 'F'"); sql("select ^x'abcdefG'^ from t") @@ -3996,7 +3996,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `T`"); } - @Test public void testStringLiteral() { + @Test void testStringLiteral() { expr("_latin1'hi'") .ok("_LATIN1'hi'"); expr("N'is it a plane? no it''s superman!'") @@ -4035,7 +4035,7 @@ void checkPeriodPredicate(Checker checker) { } } - @Test public void testStringLiteralFails() { + @Test void testStringLiteralFails() { sql("select N ^'space'^") .fails("(?s).*Encountered .*space.* at line 1, column ...*"); sql("select _latin1\n^'newline'^") @@ -4049,7 +4049,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `T`"); } - @Test public void testStringLiteralChain() { + @Test void testStringLiteralChain() { final String fooBar = "'foo'\n" + "'bar'"; @@ -4110,7 +4110,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s)Encountered \"when\" at .*"); } - @Test public void testCaseExpressionFails() { + @Test void testCaseExpressionFails() { // Missing 'END' sql("select case col1 when 1 then 'one' ^from^ t") .fails("(?s).*from.*"); @@ -4120,7 +4120,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*when1.*"); } - @Test public void testNullIf() { + @Test void testNullIf() { expr("nullif(v1,v2)") .ok("NULLIF(`V1`, `V2`)"); if (isReserved("NULLIF")) { @@ -4129,7 +4129,7 @@ void checkPeriodPredicate(Checker checker) { } } - @Test public void testCoalesce() { + @Test void testCoalesce() { expr("coalesce(v1)") .ok("COALESCE(`V1`)"); expr("coalesce(v1,v2)") @@ -4138,7 +4138,7 @@ void checkPeriodPredicate(Checker checker) { .ok("COALESCE(`V1`, `V2`, `V3`)"); } - @Test public void testLiteralCollate() { + @Test void testLiteralCollate() { if (!Bug.FRG78_FIXED) { return; } @@ -4159,24 +4159,24 @@ void checkPeriodPredicate(Checker checker) { .ok("('str1' COLLATE ISO-8859-1$sv_SE$primary <= 'str2' COLLATE ISO-8859-1$sv_FI$primary)"); } - @Test public void testCharLength() { + @Test void testCharLength() { expr("char_length('string')") .ok("CHAR_LENGTH('string')"); expr("character_length('string')") .ok("CHARACTER_LENGTH('string')"); } - @Test public void testPosition() { + @Test void testPosition() { expr("posiTion('mouse' in 'house')") .ok("POSITION('mouse' IN 'house')"); } - @Test public void testReplace() { + @Test void testReplace() { expr("replace('x', 'y', 'z')") .ok("REPLACE('x', 'y', 'z')"); } - @Test public void testDateLiteral() { + @Test void testDateLiteral() { final String expected = "SELECT DATE '1980-01-01'\n" + "FROM `T`"; sql("select date '1980-01-01' from t").ok(expected); @@ -4195,7 +4195,7 @@ void checkPeriodPredicate(Checker checker) { } // check date/time functions. - @Test public void testTimeDate() { + @Test void testTimeDate() { // CURRENT_TIME - returns time w/ timezone expr("CURRENT_TIME(3)") .ok("CURRENT_TIME(3)"); @@ -4297,7 +4297,7 @@ void checkPeriodPredicate(Checker checker) { /** * Tests for casting to/from date/time types. */ - @Test public void testDateTimeCast() { + @Test void testDateTimeCast() { // checkExp("CAST(DATE '2001-12-21' AS CHARACTER VARYING)", // "CAST(2001-12-21)"); expr("CAST('2001-12-21' AS DATE)") @@ -4312,7 +4312,7 @@ void checkPeriodPredicate(Checker checker) { .ok("CAST(DATE '2004-12-21' AS VARCHAR(10))"); } - @Test public void testTrim() { + @Test void testTrim() { expr("trim('mustache' FROM 'beard')") .ok("TRIM(BOTH 'mustache' FROM 'beard')"); expr("trim('mustache')") @@ -4334,26 +4334,26 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*'FROM' without operands preceding it is illegal.*"); } - @Test public void testConvertAndTranslate() { + @Test void testConvertAndTranslate() { expr("convert('abc' using conversion)") .ok("CONVERT('abc' USING `CONVERSION`)"); expr("translate('abc' using lazy_translation)") .ok("TRANSLATE('abc' USING `LAZY_TRANSLATION`)"); } - @Test public void testTranslate3() { + @Test void testTranslate3() { expr("translate('aaabbbccc', 'ab', '+-')") .ok("TRANSLATE('aaabbbccc', 'ab', '+-')"); } - @Test public void testOverlay() { + @Test void testOverlay() { expr("overlay('ABCdef' placing 'abc' from 1)") .ok("OVERLAY('ABCdef' PLACING 'abc' FROM 1)"); expr("overlay('ABCdef' placing 'abc' from 1 for 3)") .ok("OVERLAY('ABCdef' PLACING 'abc' FROM 1 FOR 3)"); } - @Test public void testJdbcFunctionCall() { + @Test void testJdbcFunctionCall() { expr("{fn apa(1,'1')}") .ok("{fn APA(1, '1') }"); expr("{ Fn apa(log10(ln(1))+2)}") @@ -4396,7 +4396,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s)Encountered \"INTERVAL\" at.*"); } - @Test public void testWindowReference() { + @Test void testWindowReference() { expr("sum(sal) over (w)") .ok("(SUM(`SAL`) OVER (`W`))"); @@ -4405,7 +4405,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s)Encountered \"w1\" at.*"); } - @Test public void testWindowInSubQuery() { + @Test void testWindowInSubQuery() { final String sql = "select * from (\n" + " select sum(x) over w, sum(y) over w\n" + " from s\n" @@ -4417,7 +4417,7 @@ void checkPeriodPredicate(Checker checker) { sql(sql).ok(expected); } - @Test public void testWindowSpec() { + @Test void testWindowSpec() { // Correct syntax final String sql1 = "select count(z) over w as foo\n" + "from Bids\n" @@ -4480,7 +4480,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"order\".*"); } - @Test public void testWindowSpecPartial() { + @Test void testWindowSpecPartial() { // ALLOW PARTIAL is the default, and is omitted when the statement is // unparsed. sql("select sum(x) over (order by x allow partial) from bids") @@ -4500,7 +4500,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `BIDS`"); } - @Test public void testNullTreatment() { + @Test void testNullTreatment() { sql("select lead(x) respect nulls over (w) from t") .ok("SELECT (LEAD(`X`) RESPECT NULLS OVER (`W`))\n" + "FROM `T`"); @@ -4538,7 +4538,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `T`"); } - @Test public void testAs() { + @Test void testAs() { // AS is optional for column aliases sql("select x y from t") .ok("SELECT `X` AS `Y`\n" @@ -4573,7 +4573,7 @@ void checkPeriodPredicate(Checker checker) { .fails("(?s).*Encountered \"over\".*"); } - @Test public void testAsAliases() { + @Test void testAsAliases() { sql("select x from t as t1 (a, b) where foo") .ok("SELECT `X`\n" + "FROM `T` AS `T1` (`A`, `B`)\n" @@ -4602,7 +4602,7 @@ void checkPeriodPredicate(Checker checker) { + " \",\" \\.\\.\\..*"); } - @Test public void testOver() { + @Test void testOver() { expr("sum(sal) over ()") .ok("(SUM(`SAL`) OVER ())"); expr("sum(sal) over (partition by x, y)") @@ -4646,36 +4646,36 @@ void checkPeriodPredicate(Checker checker) { + "AND INTERVAL '5' DAY FOLLOWING))"); } - @Test public void testElementFunc() { + @Test void testElementFunc() { expr("element(a)") .ok("ELEMENT(`A`)"); } - @Test public void testCardinalityFunc() { + @Test void testCardinalityFunc() { expr("cardinality(a)") .ok("CARDINALITY(`A`)"); } - @Test public void testMemberOf() { + @Test void testMemberOf() { expr("a member of b") .ok("(`A` MEMBER OF `B`)"); expr("a member of multiset[b]") .ok("(`A` MEMBER OF (MULTISET[`B`]))"); } - @Test public void testSubMultisetrOf() { + @Test void testSubMultisetrOf() { expr("a submultiset of b") .ok("(`A` SUBMULTISET OF `B`)"); } - @Test public void testIsASet() { + @Test void testIsASet() { expr("b is a set") .ok("(`B` IS A SET)"); expr("a is a set") .ok("(`A` IS A SET)"); } - @Test public void testMultiset() { + @Test void testMultiset() { expr("multiset[1]") .ok("(MULTISET[1])"); expr("multiset[1,2.3]") @@ -4692,7 +4692,7 @@ void checkPeriodPredicate(Checker checker) { + "FROM `T`)))"); } - @Test public void testMultisetUnion() { + @Test void testMultisetUnion() { expr("a multiset union b") .ok("(`A` MULTISET UNION ALL `B`)"); expr("a multiset union all b") @@ -4701,7 +4701,7 @@ void checkPeriodPredicate(Checker checker) { .ok("(`A` MULTISET UNION DISTINCT `B`)"); } - @Test public void testMultisetExcept() { + @Test void testMultisetExcept() { expr("a multiset EXCEPT b") .ok("(`A` MULTISET EXCEPT ALL `B`)"); expr("a multiset EXCEPT all b") @@ -4710,7 +4710,7 @@ void checkPeriodPredicate(Checker checker) { .ok("(`A` MULTISET EXCEPT DISTINCT `B`)"); } - @Test public void testMultisetIntersect() { + @Test void testMultisetIntersect() { expr("a multiset INTERSECT b") .ok("(`A` MULTISET INTERSECT ALL `B`)"); expr("a multiset INTERSECT all b") @@ -4719,7 +4719,7 @@ void checkPeriodPredicate(Checker checker) { .ok("(`A` MULTISET INTERSECT DISTINCT `B`)"); } - @Test public void testMultisetMixed() { + @Test void testMultisetMixed() { expr("multiset[1] MULTISET union b") .ok("((MULTISET[1]) MULTISET UNION ALL `B`)"); final String sql = "a MULTISET union b " @@ -4732,7 +4732,7 @@ void checkPeriodPredicate(Checker checker) { expr(sql).ok(expected); } - @Test public void testMapItem() { + @Test void testMapItem() { expr("a['foo']") .ok("`A`['foo']"); expr("a['x' || 'y']") @@ -4743,7 +4743,7 @@ void checkPeriodPredicate(Checker checker) { .ok("`A`['foo']['bar']"); } - @Test public void testMapItemPrecedence() { + @Test void testMapItemPrecedence() { expr("1 + a['foo'] * 3") .ok("(1 + (`A`['foo'] * 3))"); expr("1 * a['foo'] + 3") @@ -4754,7 +4754,7 @@ void checkPeriodPredicate(Checker checker) { .ok("`A`[`B`[('foo' || 'bar')]]"); } - @Test public void testArrayElement() { + @Test void testArrayElement() { expr("a[1]") .ok("`A`[1]"); expr("a[b[1]]") @@ -4763,14 +4763,14 @@ void checkPeriodPredicate(Checker checker) { .ok("`A`[(`B`[(1 + 2)] + 3)]"); } - @Test public void testArrayElementWithDot() { + @Test void testArrayElementWithDot() { expr("a[1+2].b.c[2].d") .ok("(((`A`[(1 + 2)].`B`).`C`)[2].`D`)"); expr("a[b[1]].c.f0[d[1]]") .ok("((`A`[`B`[1]].`C`).`F0`)[`D`[1]]"); } - @Test public void testArrayValueConstructor() { + @Test void testArrayValueConstructor() { expr("array[1, 2]").ok("(ARRAY[1, 2])"); expr("array [1, 2]").ok("(ARRAY[1, 2])"); // with space @@ -4781,7 +4781,7 @@ void checkPeriodPredicate(Checker checker) { .ok("(ARRAY[(ROW(1, 'a')), (ROW(2, 'b'))])"); } - @Test public void testCastAsCollectionType() { + @Test void testCastAsCollectionType() { // test array type. expr("cast(a as int array)") .ok("CAST(`A` AS INTEGER ARRAY)"); @@ -4813,7 +4813,7 @@ void checkPeriodPredicate(Checker checker) { .ok("CAST(`A` AS `MYUDT` ARRAY MULTISET)"); } - @Test public void testCastAsRowType() { + @Test void testCastAsRowType() { expr("cast(a as row(f0 int, f1 varchar))") .ok("CAST(`A` AS ROW(`F0` INTEGER, `F1` VARCHAR))"); expr("cast(a as row(f0 int not null, f1 varchar null))") @@ -4832,7 +4832,7 @@ void checkPeriodPredicate(Checker checker) { .ok("CAST(`A` AS ROW(`F0` VARCHAR, `F1` TIMESTAMP NULL) MULTISET)"); } - @Test public void testMapValueConstructor() { + @Test void testMapValueConstructor() { expr("map[1, 'x', 2, 'y']") .ok("(MAP[1, 'x', 2, 'y'])"); expr("map [1, 'x', 2, 'y']") @@ -6455,7 +6455,7 @@ public void subTestIntervalSecondFailsValidation() { *

A substantially identical set of tests exists in SqlValidatorTest, and * any changes here should be synchronized there. */ - @Test public void testIntervalLiterals() { + @Test void testIntervalLiterals() { subTestIntervalYearPositive(); subTestIntervalYearToMonthPositive(); subTestIntervalMonthPositive(); @@ -6485,7 +6485,7 @@ public void subTestIntervalSecondFailsValidation() { subTestIntervalSecondFailsValidation(); } - @Test public void testUnparseableIntervalQualifiers() { + @Test void testUnparseableIntervalQualifiers() { // No qualifier expr("interval '1^'^") .fails("Encountered \"\" at line 1, column 12\\.\n" @@ -6747,7 +6747,7 @@ public void subTestIntervalSecondFailsValidation() { .fails(ANY); } - @Test public void testUnparseableIntervalQualifiers2() { + @Test void testUnparseableIntervalQualifiers2() { expr("interval '1-2' day(3) ^to^ year(2)") .fails(ANY); expr("interval '1-2' day(3) ^to^ month(2)") @@ -6869,7 +6869,7 @@ public void subTestIntervalSecondFailsValidation() { } /** Tests that plural time units are allowed when not in strict mode. */ - @Test public void testIntervalPluralUnits() { + @Test void testIntervalPluralUnits() { expr("interval '2' years") .hasWarning(checkWarnings("YEARS")) .ok("INTERVAL '2' YEAR"); @@ -6907,7 +6907,7 @@ public void subTestIntervalSecondFailsValidation() { }; } - @Test public void testMiscIntervalQualifier() { + @Test void testMiscIntervalQualifier() { expr("interval '-' day") .ok("INTERVAL '-' DAY"); @@ -6921,7 +6921,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("INTERVAL '1:x:2' HOUR TO SECOND"); } - @Test public void testIntervalOperators() { + @Test void testIntervalOperators() { expr("-interval '1' day") .ok("(- INTERVAL '1' DAY)"); expr("interval '1' day + interval '1' day") @@ -6941,7 +6941,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("INTERVAL 'wael was here' HOUR"); } - @Test public void testDateMinusDate() { + @Test void testDateMinusDate() { expr("(date1 - date2) HOUR") .ok("((`DATE1` - `DATE2`) HOUR)"); expr("(date1 - date2) YEAR TO MONTH") @@ -6956,7 +6956,7 @@ public void subTestIntervalSecondFailsValidation() { + "Was expecting ..DATETIME - DATETIME. INTERVALQUALIFIER.*"); } - @Test public void testExtract() { + @Test void testExtract() { expr("extract(year from x)") .ok("EXTRACT(YEAR FROM `X`)"); expr("extract(month from x)") @@ -6990,7 +6990,7 @@ public void subTestIntervalSecondFailsValidation() { .fails("(?s)Encountered \"to\".*"); } - @Test public void testGeometry() { + @Test void testGeometry() { expr("cast(null as ^geometry^)") .fails("Geo-spatial extensions and the GEOMETRY data type are not enabled"); conformance = SqlConformanceEnum.LENIENT; @@ -6998,7 +6998,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("CAST(NULL AS GEOMETRY)"); } - @Test public void testIntervalArithmetics() { + @Test void testIntervalArithmetics() { expr("TIME '23:59:59' - interval '1' hour ") .ok("(TIME '23:59:59' - INTERVAL '1' HOUR)"); expr("TIMESTAMP '2000-01-01 23:59:59.1' - interval '1' hour ") @@ -7024,7 +7024,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("(INTERVAL '1' HOUR / 8)"); } - @Test public void testIntervalCompare() { + @Test void testIntervalCompare() { expr("interval '1' hour = interval '1' second") .ok("(INTERVAL '1' HOUR = INTERVAL '1' SECOND)"); expr("interval '1' hour <> interval '1' second") @@ -7039,7 +7039,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("(INTERVAL '1' HOUR >= INTERVAL '1' SECOND)"); } - @Test public void testCastToInterval() { + @Test void testCastToInterval() { expr("cast(x as interval year)") .ok("CAST(`X` AS INTERVAL YEAR)"); expr("cast(x as interval month)") @@ -7070,7 +7070,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("CAST(INTERVAL '3-2' YEAR TO MONTH AS CHAR(5))"); } - @Test public void testCastToVarchar() { + @Test void testCastToVarchar() { expr("cast(x as varchar(5))") .ok("CAST(`X` AS VARCHAR(5))"); expr("cast(x as varchar)") @@ -7081,7 +7081,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("CAST(`X` AS VARBINARY)"); } - @Test public void testTimestampAddAndDiff() { + @Test void testTimestampAddAndDiff() { Map> tsi = ImmutableMap.>builder() .put("MICROSECOND", Arrays.asList("FRAC_SECOND", "MICROSECOND", "SQL_TSI_MICROSECOND")) @@ -7117,7 +7117,7 @@ public void subTestIntervalSecondFailsValidation() { .fails("(?s).*Was expecting one of.*"); } - @Test public void testTimestampAdd() { + @Test void testTimestampAdd() { final String sql = "select * from t\n" + "where timestampadd(sql_tsi_month, 5, hiredate) < curdate"; final String expected = "SELECT *\n" @@ -7126,7 +7126,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testTimestampDiff() { + @Test void testTimestampDiff() { final String sql = "select * from t\n" + "where timestampdiff(frac_second, 5, hiredate) < curdate"; final String expected = "SELECT *\n" @@ -7135,7 +7135,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testUnnest() { + @Test void testUnnest() { sql("select*from unnest(x)") .ok("SELECT *\n" + "FROM (UNNEST(`X`))"); @@ -7160,7 +7160,7 @@ public void subTestIntervalSecondFailsValidation() { .fails("(?s)Encountered \"unnest\" at .*"); } - @Test public void testUnnestWithOrdinality() { + @Test void testUnnestWithOrdinality() { sql("select * from unnest(x) with ordinality") .ok("SELECT *\n" + "FROM (UNNEST(`X`) WITH ORDINALITY)"); @@ -7174,7 +7174,7 @@ public void subTestIntervalSecondFailsValidation() { .fails("(?s)Encountered \"with\" at .*"); } - @Test public void testParensInFrom() { + @Test void testParensInFrom() { // UNNEST may not occur within parentheses. // FIXME should fail at "unnest" sql("select *from ^(^unnest(x))") @@ -7201,7 +7201,7 @@ public void subTestIntervalSecondFailsValidation() { } } - @Test public void testProcedureCall() { + @Test void testProcedureCall() { sql("call blubber(5)") .ok("CALL `BLUBBER`(5)"); sql("call \"blubber\"(5)") @@ -7210,7 +7210,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("CALL `WHALE`.`BLUBBER`(5)"); } - @Test public void testNewSpecification() { + @Test void testNewSpecification() { expr("new udt()") .ok("(NEW `UDT`())"); expr("new my.udt(1, 'hey')") @@ -7221,12 +7221,12 @@ public void subTestIntervalSecondFailsValidation() { .ok("(1 + (NEW `UDT`()))"); } - @Test public void testMultisetCast() { + @Test void testMultisetCast() { expr("cast(multiset[1] as double multiset)") .ok("CAST((MULTISET[1]) AS DOUBLE MULTISET)"); } - @Test public void testAddCarets() { + @Test void testAddCarets() { assertEquals( "values (^foo^)", SqlParserUtil.addCarets("values (foo)", 1, 9, 1, 12)); @@ -7238,7 +7238,7 @@ public void subTestIntervalSecondFailsValidation() { SqlParserUtil.addCarets("abcdef", 1, 7, 1, 7)); } - @Test public void testMetadata() { + @Test protected void testMetadata() { SqlAbstractParserImpl.Metadata metadata = getSqlParser("").getMetadata(); assertThat(metadata.isReservedFunctionName("ABS"), is(true)); assertThat(metadata.isReservedFunctionName("FOO"), is(false)); @@ -7284,7 +7284,7 @@ public void subTestIntervalSecondFailsValidation() { * the {@link #RESERVED_KEYWORDS} list. If not, add the keyword to the * non-reserved keyword list in the parser. */ - @Test public void testNoUnintendedNewReservedKeywords() { + @Test void testNoUnintendedNewReservedKeywords() { assumeTrue(isNotSubclass(), "don't run this test for sub-classes"); final SqlAbstractParserImpl.Metadata metadata = getSqlParser("").getMetadata(); @@ -7310,7 +7310,7 @@ public void subTestIntervalSecondFailsValidation() { assertThat(reason, reservedKeywords, is(getReservedKeywords())); } - @Test public void testTabStop() { + @Test void testTabStop() { sql("SELECT *\n\tFROM mytable") .ok("SELECT *\n" + "FROM `MYTABLE`"); @@ -7321,7 +7321,7 @@ public void subTestIntervalSecondFailsValidation() { .fails("(?s).*Encountered \"= =\" at line 1, column 32\\..*"); } - @Test public void testLongIdentifiers() { + @Test void testLongIdentifiers() { StringBuilder ident128Builder = new StringBuilder(); for (int i = 0; i < 128; i++) { ident128Builder.append((char) ('a' + (i % 26))); @@ -7351,7 +7351,7 @@ public void subTestIntervalSecondFailsValidation() { * * @see org.apache.calcite.test.SqlValidatorTest#testQuotedFunction() */ - @Test public void testQuotedFunction() { + @Test void testQuotedFunction() { expr("\"CAST\"(1 ^as^ double)") .fails("(?s).*Encountered \"as\" at .*"); expr("\"POSITION\"('b' ^in^ 'alphabet')") @@ -7365,7 +7365,7 @@ public void subTestIntervalSecondFailsValidation() { /** * Tests that applying member function of a specific type as a suffix function */ - @Test public void testMemberFunction() { + @Test void testMemberFunction() { sql("SELECT myColumn.func(a, b) FROM tbl") .ok("SELECT `MYCOLUMN`.`FUNC`(`A`, `B`)\n" + "FROM `TBL`"); @@ -7380,7 +7380,7 @@ public void subTestIntervalSecondFailsValidation() { + "FROM `TBL`"); } - @Test public void testUnicodeLiteral() { + @Test void testUnicodeLiteral() { // Note that here we are constructing a SQL statement which directly // contains Unicode characters (not SQL Unicode escape sequences). The // escaping here is Java-only, so by the time it gets to the SQL @@ -7415,7 +7415,7 @@ public void subTestIntervalSecondFailsValidation() { sql(in3).ok(out3); } - @Test public void testUnicodeEscapedLiteral() { + @Test void testUnicodeEscapedLiteral() { // Note that here we are constructing a SQL statement which // contains SQL-escaped Unicode characters to be handled // by the SQL parser. @@ -7431,7 +7431,7 @@ public void subTestIntervalSecondFailsValidation() { sql(in.replace("\\", "!") + "UESCAPE '!'").ok(out); } - @Test public void testIllegalUnicodeEscape() { + @Test void testIllegalUnicodeEscape() { expr("U&'abc' UESCAPE '!!'") .fails(".*must be exactly one character.*"); expr("U&'abc' UESCAPE ''") @@ -7456,7 +7456,7 @@ public void subTestIntervalSecondFailsValidation() { .fails(".*is not exactly four hex digits.*"); } - @Test public void testSqlOptions() throws SqlParseException { + @Test void testSqlOptions() throws SqlParseException { SqlNode node = getSqlParser("alter system set schema = true").parseStmt(); SqlSetOption opt = (SqlSetOption) node; assertThat(opt.getScope(), equalTo("SYSTEM")); @@ -7520,7 +7520,7 @@ public void subTestIntervalSecondFailsValidation() { .fails("(?s)Encountered \",\" at line 1, column 23\\..*"); } - @Test public void testSequence() { + @Test void testSequence() { sql("select next value for my_schema.my_seq from t") .ok("SELECT (NEXT VALUE FOR `MY_SCHEMA`.`MY_SEQ`)\n" + "FROM `T`"); @@ -7552,7 +7552,7 @@ public void subTestIntervalSecondFailsValidation() { + "VALUES (ROW(1, (CURRENT VALUE FOR `MY_SEQ`)))"); } - @Test public void testMatchRecognize1() { + @Test void testMatchRecognize1() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7575,7 +7575,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize2() { + @Test void testMatchRecognize2() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7594,7 +7594,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize3() { + @Test void testMatchRecognize3() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7613,7 +7613,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize4() { + @Test void testMatchRecognize4() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7632,7 +7632,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize5() { + @Test void testMatchRecognize5() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7651,7 +7651,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize6() { + @Test void testMatchRecognize6() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7670,7 +7670,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize7() { + @Test void testMatchRecognize7() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7689,7 +7689,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize8() { + @Test void testMatchRecognize8() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7708,7 +7708,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize9() { + @Test void testMatchRecognize9() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7727,7 +7727,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize10() { + @Test void testMatchRecognize10() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7749,7 +7749,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognize11() { + @Test void testMatchRecognize11() { final String sql = "select *\n" + " from t match_recognize (\n" + " pattern ( \"a\" \"b c\")\n" @@ -7766,7 +7766,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause() { + @Test void testMatchRecognizeDefineClause() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7785,7 +7785,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause2() { + @Test void testMatchRecognizeDefineClause2() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7803,7 +7803,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause3() { + @Test void testMatchRecognizeDefineClause3() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7822,7 +7822,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeDefineClause4() { + @Test void testMatchRecognizeDefineClause4() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7840,7 +7840,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures1() { + @Test void testMatchRecognizeMeasures1() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7869,7 +7869,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures2() { + @Test void testMatchRecognizeMeasures2() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7893,7 +7893,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures3() { + @Test void testMatchRecognizeMeasures3() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7917,7 +7917,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures4() { + @Test void testMatchRecognizeMeasures4() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7943,7 +7943,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures5() { + @Test void testMatchRecognizeMeasures5() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7968,7 +7968,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeMeasures6() { + @Test void testMatchRecognizeMeasures6() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -7993,7 +7993,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip1() { + @Test void testMatchRecognizePatternSkip1() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8014,7 +8014,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip2() { + @Test void testMatchRecognizePatternSkip2() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8035,7 +8035,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip3() { + @Test void testMatchRecognizePatternSkip3() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8056,7 +8056,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip4() { + @Test void testMatchRecognizePatternSkip4() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8077,7 +8077,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizePatternSkip5() { + @Test void testMatchRecognizePatternSkip5() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8102,7 +8102,7 @@ public void subTestIntervalSecondFailsValidation() { * [CALCITE-2993] * ParseException may be thrown for legal SQL queries due to incorrect * "LOOKAHEAD(1)" hints. */ - @Test public void testMatchRecognizePatternSkip6() { + @Test void testMatchRecognizePatternSkip6() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8123,7 +8123,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset1() { + @Test void testMatchRecognizeSubset1() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8144,7 +8144,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset2() { + @Test void testMatchRecognizeSubset2() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8170,7 +8170,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeSubset3() { + @Test void testMatchRecognizeSubset3() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8196,7 +8196,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeRowsPerMatch1() { + @Test void testMatchRecognizeRowsPerMatch1() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8224,7 +8224,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeRowsPerMatch2() { + @Test void testMatchRecognizeRowsPerMatch2() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8252,7 +8252,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testMatchRecognizeWithin() { + @Test void testMatchRecognizeWithin() { final String sql = "select *\n" + " from t match_recognize\n" + " (\n" @@ -8280,7 +8280,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testWithinGroupClause1() { + @Test void testWithinGroupClause1() { final String sql = "select col1,\n" + " collect(col2) within group (order by col3)\n" + "from t\n" @@ -8293,7 +8293,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testWithinGroupClause2() { + @Test void testWithinGroupClause2() { final String sql = "select collect(col2) within group (order by col3)\n" + "from t\n" + "order by col1 limit 10"; @@ -8305,13 +8305,13 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testWithinGroupClause3() { + @Test void testWithinGroupClause3() { final String sql = "select collect(col2) within group (^)^ " + "from t order by col1 limit 10"; sql(sql).fails("(?s).*Encountered \"\\)\" at line 1, column 36\\..*"); } - @Test public void testWithinGroupClause4() { + @Test void testWithinGroupClause4() { final String sql = "select col1,\n" + " collect(col2) within group (order by col3, col4)\n" + "from t\n" @@ -8324,7 +8324,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testWithinGroupClause5() { + @Test void testWithinGroupClause5() { final String sql = "select col1,\n" + " collect(col2) within group (\n" + " order by col3 desc nulls first, col4 asc nulls last)\n" @@ -8338,7 +8338,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testJsonValueExpressionOperator() { + @Test void testJsonValueExpressionOperator() { expr("foo format json") .ok("`FOO` FORMAT JSON"); // Currently, encoding js not valid @@ -8360,14 +8360,14 @@ public void subTestIntervalSecondFailsValidation() { + "FROM `TAB`"); } - @Test public void testJsonExists() { + @Test void testJsonExists() { expr("json_exists('{\"foo\": \"bar\"}', 'lax $.foo')") .ok("JSON_EXISTS('{\"foo\": \"bar\"}', 'lax $.foo')"); expr("json_exists('{\"foo\": \"bar\"}', 'lax $.foo' error on error)") .ok("JSON_EXISTS('{\"foo\": \"bar\"}', 'lax $.foo' ERROR ON ERROR)"); } - @Test public void testJsonValue() { + @Test void testJsonValue() { expr("json_value('{\"foo\": \"100\"}', 'lax $.foo' " + "returning integer)") .ok("JSON_VALUE('{\"foo\": \"100\"}', 'lax $.foo' " @@ -8378,7 +8378,7 @@ public void subTestIntervalSecondFailsValidation() { + "RETURNING INTEGER DEFAULT 10 ON EMPTY ERROR ON ERROR)"); } - @Test public void testJsonQuery() { + @Test void testJsonQuery() { expr("json_query('{\"foo\": \"bar\"}', 'lax $' WITHOUT ARRAY WRAPPER)") .ok("JSON_QUERY('{\"foo\": \"bar\"}', " + "'lax $' WITHOUT ARRAY WRAPPER NULL ON EMPTY NULL ON ERROR)"); @@ -8421,7 +8421,7 @@ public void subTestIntervalSecondFailsValidation() { + "'lax $' WITHOUT ARRAY WRAPPER EMPTY ARRAY ON EMPTY EMPTY OBJECT ON ERROR)"); } - @Test public void testJsonObject() { + @Test void testJsonObject() { expr("json_object('foo': 'bar')") .ok("JSON_OBJECT(KEY 'foo' VALUE 'bar' NULL ON NULL)"); expr("json_object('foo': 'bar', 'foo2': 'bar2')") @@ -8452,7 +8452,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_OBJECT(KEY `KEY` VALUE `VALUE` NULL ON NULL)"); } - @Test public void testJsonType() { + @Test void testJsonType() { expr("json_type('11.56')") .ok("JSON_TYPE('11.56')"); expr("json_type('{}')") @@ -8465,7 +8465,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_TYPE('{\"foo\": \"100\"}')"); } - @Test public void testJsonDepth() { + @Test void testJsonDepth() { expr("json_depth('11.56')") .ok("JSON_DEPTH('11.56')"); expr("json_depth('{}')") @@ -8478,7 +8478,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_DEPTH('{\"foo\": \"100\"}')"); } - @Test public void testJsonLength() { + @Test void testJsonLength() { expr("json_length('{\"foo\": \"bar\"}')") .ok("JSON_LENGTH('{\"foo\": \"bar\"}')"); expr("json_length('{\"foo\": \"bar\"}', 'lax $')") @@ -8489,7 +8489,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_LENGTH('{\"foo\": \"bar\"}', 'invalid $')"); } - @Test public void testJsonKeys() { + @Test void testJsonKeys() { expr("json_keys('{\"foo\": \"bar\"}', 'lax $')") .ok("JSON_KEYS('{\"foo\": \"bar\"}', 'lax $')"); expr("json_keys('{\"foo\": \"bar\"}', 'strict $')") @@ -8498,14 +8498,14 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_KEYS('{\"foo\": \"bar\"}', 'invalid $')"); } - @Test public void testJsonRemove() { + @Test void testJsonRemove() { expr("json_remove('[\"a\", [\"b\", \"c\"], \"d\"]', '$')") .ok("JSON_REMOVE('[\"a\", [\"b\", \"c\"], \"d\"]', '$')"); expr("json_remove('[\"a\", [\"b\", \"c\"], \"d\"]', '$[1]', '$[0]')") .ok("JSON_REMOVE('[\"a\", [\"b\", \"c\"], \"d\"]', '$[1]', '$[0]')"); } - @Test public void testJsonObjectAgg() { + @Test void testJsonObjectAgg() { expr("json_objectagg(k_column: v_column)") .ok("JSON_OBJECTAGG(KEY `K_COLUMN` VALUE `V_COLUMN` NULL ON NULL)"); expr("json_objectagg(k_column value v_column)") @@ -8522,7 +8522,7 @@ public void subTestIntervalSecondFailsValidation() { + "FORMAT JSON NULL ON NULL)"); } - @Test public void testJsonArray() { + @Test void testJsonArray() { expr("json_array('foo')") .ok("JSON_ARRAY('foo' ABSENT ON NULL)"); expr("json_array(null)") @@ -8533,21 +8533,21 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_ARRAY(JSON_ARRAY('foo', 'bar' ABSENT ON NULL) FORMAT JSON ABSENT ON NULL)"); } - @Test public void testJsonPretty() { + @Test void testJsonPretty() { expr("json_pretty('foo')") .ok("JSON_PRETTY('foo')"); expr("json_pretty(null)") .ok("JSON_PRETTY(NULL)"); } - @Test public void testJsonStorageSize() { + @Test void testJsonStorageSize() { expr("json_storage_size('foo')") .ok("JSON_STORAGE_SIZE('foo')"); expr("json_storage_size(null)") .ok("JSON_STORAGE_SIZE(NULL)"); } - @Test public void testJsonArrayAgg1() { + @Test void testJsonArrayAgg1() { expr("json_arrayagg(\"column\")") .ok("JSON_ARRAYAGG(`column` ABSENT ON NULL)"); expr("json_arrayagg(\"column\" null on null)") @@ -8556,7 +8556,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("JSON_ARRAYAGG(JSON_ARRAY(`column` ABSENT ON NULL) FORMAT JSON ABSENT ON NULL)"); } - @Test public void testJsonArrayAgg2() { + @Test void testJsonArrayAgg2() { expr("json_arrayagg(\"column\" order by \"column\")") .ok("JSON_ARRAYAGG(`column` ABSENT ON NULL) WITHIN GROUP (ORDER BY `column`)"); expr("json_arrayagg(\"column\") within group (order by \"column\")") @@ -8566,7 +8566,7 @@ public void subTestIntervalSecondFailsValidation() { + "in a single JSON_ARRAYAGG call is not allowed.*"); } - @Test public void testJsonPredicate() { + @Test void testJsonPredicate() { expr("'{}' is json") .ok("('{}' IS JSON VALUE)"); expr("'{}' is json value") @@ -8589,7 +8589,7 @@ public void subTestIntervalSecondFailsValidation() { .ok("('100' IS NOT JSON SCALAR)"); } - @Test public void testParseWithReader() throws Exception { + @Test void testParseWithReader() throws Exception { String query = "select * from dual"; SqlParser sqlParserReader = getSqlParser(new StringReader(query), b -> b); SqlNode node1 = sqlParserReader.parseQuery(); @@ -8598,7 +8598,7 @@ public void subTestIntervalSecondFailsValidation() { assertEquals(node2.toString(), node1.toString()); } - @Test public void testConfigureFromDialect() throws SqlParseException { + @Test void testConfigureFromDialect() throws SqlParseException { // Calcite's default converts unquoted identifiers to upper case sql("select unquotedColumn from \"doubleQuotedTable\"") .withDialect(SqlDialect.DatabaseProduct.CALCITE.getDialect()) @@ -8631,7 +8631,7 @@ public void subTestIntervalSecondFailsValidation() { + "FROM doubleQuotedTable"); } - @Test public void testParenthesizedSubQueries() { + @Test void testParenthesizedSubQueries() { final String expected = "SELECT *\n" + "FROM (SELECT *\n" + "FROM `TAB`) AS `X`"; @@ -8643,7 +8643,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql2).ok(expected); } - @Test public void testQueryHint() { + @Test void testQueryHint() { final String sql = "select " + "/*+ properties(k1='v1', k2='v2', 'a.b.c'='v3'), " + "no_hash_join, Index(idx1, idx2), " @@ -8659,7 +8659,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testTableHintsInQuery() { + @Test void testTableHintsInQuery() { final String hint = "/*+ PROPERTIES(K1 ='v1', K2 ='v2'), INDEX(IDX0, IDX1) */"; final String sql1 = String.format(Locale.ROOT, "select * from t %s", hint); final String expected1 = "SELECT *\n" @@ -8686,7 +8686,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql3).ok(expected3); } - @Test public void testTableHintsInInsert() { + @Test void testTableHintsInInsert() { final String sql = "insert into emps\n" + "/*+ PROPERTIES(k1='v1', k2='v2'), INDEX(idx0, idx1) */\n" + "select * from emps"; @@ -8697,7 +8697,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testTableHintsInDelete() { + @Test void testTableHintsInDelete() { final String sql = "delete from emps\n" + "/*+ properties(k1='v1', k2='v2'), index(idx1, idx2), no_hash_join */\n" + "where empno=12"; @@ -8707,7 +8707,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testTableHintsInUpdate() { + @Test void testTableHintsInUpdate() { final String sql = "update emps\n" + "/*+ properties(k1='v1', k2='v2'), index(idx1, idx2), no_hash_join */\n" + "set empno = empno + 1, sal = sal - 1\n" @@ -8721,7 +8721,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testTableHintsInMerge() { + @Test void testTableHintsInMerge() { final String sql = "merge into emps\n" + "/*+ properties(k1='v1', k2='v2'), index(idx1, idx2), no_hash_join */ e\n" + "using tempemps as t\n" @@ -8744,7 +8744,7 @@ public void subTestIntervalSecondFailsValidation() { sql(sql).ok(expected); } - @Test public void testInvalidHintFormat() { + @Test void testInvalidHintFormat() { final String sql1 = "select " + "/*+ properties(^k1^=123, k2='v2'), no_hash_join() */ " + "empno, ename, deptno from emps"; diff --git a/core/src/test/java/org/apache/calcite/sql/parser/SqlUnParserTest.java b/core/src/test/java/org/apache/calcite/sql/parser/SqlUnParserTest.java index 4153663505e9..0ac4f4012dad 100644 --- a/core/src/test/java/org/apache/calcite/sql/parser/SqlUnParserTest.java +++ b/core/src/test/java/org/apache/calcite/sql/parser/SqlUnParserTest.java @@ -20,7 +20,7 @@ * Extension to {@link SqlParserTest} which ensures that every expression can * un-parse successfully. */ -public class SqlUnParserTest extends SqlParserTest { +class SqlUnParserTest extends SqlParserTest { @Override protected Tester getTester() { return new UnparsingTesterImpl(); } diff --git a/core/src/test/java/org/apache/calcite/sql/parser/parserextensiontesting/ExtensionSqlParserTest.java b/core/src/test/java/org/apache/calcite/sql/parser/parserextensiontesting/ExtensionSqlParserTest.java index 70da4a93d3d8..7070b104d910 100644 --- a/core/src/test/java/org/apache/calcite/sql/parser/parserextensiontesting/ExtensionSqlParserTest.java +++ b/core/src/test/java/org/apache/calcite/sql/parser/parserextensiontesting/ExtensionSqlParserTest.java @@ -29,29 +29,29 @@ *

This test runs all test cases of the base {@link SqlParserTest}, as well * as verifying specific extension points. */ -public class ExtensionSqlParserTest extends SqlParserTest { +class ExtensionSqlParserTest extends SqlParserTest { @Override protected SqlParserImplFactory parserImplFactory() { return ExtensionSqlParserImpl.FACTORY; } - @Test public void testAlterSystemExtension() { + @Test void testAlterSystemExtension() { sql("alter system upload jar '/path/to/jar'") .ok("ALTER SYSTEM UPLOAD JAR '/path/to/jar'"); } - @Test public void testAlterSystemExtensionWithoutAlter() { + @Test void testAlterSystemExtensionWithoutAlter() { // We need to include the scope for custom alter operations sql("^upload^ jar '/path/to/jar'") .fails("(?s).*Encountered \"upload\" at .*"); } - @Test public void testCreateTable() { + @Test void testCreateTable() { sql("CREATE TABLE foo.baz(i INTEGER, j VARCHAR(10) NOT NULL)") .ok("CREATE TABLE `FOO`.`BAZ` (`I` INTEGER, `J` VARCHAR(10) NOT NULL)"); } - @Test public void testExtendedSqlStmt() { + @Test void testExtendedSqlStmt() { sql("DESCRIBE SPACE POWER") .node(new IsNull()); sql("DESCRIBE SEA ^POWER^") diff --git a/core/src/test/java/org/apache/calcite/sql/test/DocumentationTest.java b/core/src/test/java/org/apache/calcite/sql/test/DocumentationTest.java index e01be71cb4b2..0a79f6985ae8 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/DocumentationTest.java +++ b/core/src/test/java/org/apache/calcite/sql/test/DocumentationTest.java @@ -52,10 +52,10 @@ import static org.junit.jupiter.api.Assertions.fail; /** Various automated checks on the documentation. */ -public class DocumentationTest { +class DocumentationTest { /** Generates a copy of {@code reference.md} with the current set of key * words. Fails if the copy is different from the original. */ - @Test public void testGenerateKeyWords() throws IOException { + @Test void testGenerateKeyWords() throws IOException { final FileFixture f = new FileFixture(); f.outFile.getParentFile().mkdirs(); try (BufferedReader r = Util.reader(f.inFile); @@ -100,7 +100,7 @@ public class DocumentationTest { /** Tests that every function in {@link SqlStdOperatorTable} is documented in * reference.md. */ - @Test public void testAllFunctionsAreDocumented() throws IOException { + @Test void testAllFunctionsAreDocumented() throws IOException { final FileFixture f = new FileFixture(); final Map map = new TreeMap<>(); addOperators(map, "", SqlStdOperatorTable.instance().getOperatorList()); diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlAdvisorTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlAdvisorTest.java index b0e5761aa47b..51f4a863b5b2 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/SqlAdvisorTest.java +++ b/core/src/test/java/org/apache/calcite/sql/test/SqlAdvisorTest.java @@ -53,7 +53,7 @@ * for SqlAdvisor. */ @ExtendWith(SqlValidatorTestCase.LexConfiguration.class) -public class SqlAdvisorTest extends SqlValidatorTestCase { +class SqlAdvisorTest extends SqlValidatorTestCase { public static final SqlTestFactory ADVISOR_TEST_FACTORY = SqlTestFactory.INSTANCE.withValidator( SqlAdvisorValidator::new); @@ -596,7 +596,7 @@ protected static List plus(List... lists) { return result; } - @Test public void testFrom() throws Exception { + @Test void testFrom() throws Exception { String sql; sql = "select a.empno, b.deptno from ^dummy a, sales.dummy b"; @@ -613,19 +613,19 @@ protected static List plus(List... lists) { assertHint(sql, SCHEMAS, getSalesTables(), getFromKeywords()); // join } - @Test public void testFromComplete() { + @Test void testFromComplete() { String sql = "select a.empno, b.deptno from dummy a, sales.^"; assertComplete(sql, getSalesTables()); } - @Test public void testGroup() { + @Test void testGroup() { // This test is hard because the statement is not valid if you replace // '^' with a dummy identifier. String sql = "select a.empno, b.deptno from emp group ^"; assertComplete(sql, Arrays.asList("KEYWORD(BY)")); } - @Test public void testJoin() throws Exception { + @Test void testJoin() throws Exception { String sql; // from @@ -656,7 +656,7 @@ protected static List plus(List... lists) { assertComplete(sql, QUANTIFIERS, EXPR_KEYWORDS); // join } - @Test public void testJoinKeywords() { + @Test void testJoinKeywords() { // variety of keywords possible List list = getJoinKeywords(); String sql = "select * from dummy join sales.emp ^"; @@ -664,13 +664,13 @@ protected static List plus(List... lists) { assertComplete(sql, list); } - @Test public void testSimplifyStarAlias() { + @Test void testSimplifyStarAlias() { String sql; sql = "select ax^ from (select * from dummy a)"; assertSimplify(sql, "SELECT ax _suggest_ FROM ( SELECT * FROM dummy a )"); } - @Test public void testSimlifySubQueryStar() { + @Test void testSimlifySubQueryStar() { String sql; sql = "select ax^ from (select (select * from dummy) axc from dummy a)"; assertSimplify(sql, @@ -694,7 +694,7 @@ protected static List plus(List... lists) { assertSimplify(sql, "SELECT _suggest_ FROM ( SELECT a.x + b.y FROM dummy a , dummy b )"); } - @Test public void testSimlifySubQueryMultipleFrom() { + @Test void testSimlifySubQueryMultipleFrom() { String sql; // "dummy b" should be removed sql = "select axc from (select (select ^ from dummy) axc from dummy a), dummy b"; @@ -707,7 +707,7 @@ protected static List plus(List... lists) { "SELECT * FROM ( SELECT ( SELECT _suggest_ FROM dummy ) axc FROM dummy a )"); } - @Test public void testSimlifyMinus() { + @Test void testSimlifyMinus() { String sql; sql = "select ^ from dummy a minus select * from dummy b"; assertSimplify(sql, "SELECT _suggest_ FROM dummy a"); @@ -716,7 +716,7 @@ protected static List plus(List... lists) { assertSimplify(sql, "SELECT _suggest_ FROM dummy b"); } - @Test public void testOnCondition() throws Exception { + @Test void testOnCondition() throws Exception { String sql; sql = @@ -745,7 +745,7 @@ protected static List plus(List... lists) { assertComplete(sql, DEPT_COLUMNS); // on right } - @Test public void testFromWhere() throws Exception { + @Test void testFromWhere() throws Exception { String sql; sql = @@ -788,7 +788,7 @@ protected static List plus(List... lists) { EXPR_KEYWORDS); } - @Test public void testWhereList() throws Exception { + @Test void testWhereList() throws Exception { String sql; sql = @@ -817,7 +817,7 @@ protected static List plus(List... lists) { assertComplete(sql, PREDICATE_KEYWORDS, WHERE_KEYWORDS); } - @Test public void testSelectList() throws Exception { + @Test void testSelectList() throws Exception { String sql; sql = @@ -870,7 +870,7 @@ protected static List plus(List... lists) { assertComplete(sql, EMP_COLUMNS, STAR_KEYWORD); } - @Test public void testOrderByList() throws Exception { + @Test void testOrderByList() throws Exception { String sql; sql = "select emp.empno from sales.emp where empno=1 order by ^dummy"; @@ -905,7 +905,7 @@ protected static List plus(List... lists) { assertComplete(sql, PREDICATE_KEYWORDS, ORDER_KEYWORDS, FETCH_OFFSET); } - @Test public void testSubQuery() throws Exception { + @Test void testSubQuery() throws Exception { String sql; final List xyColumns = Arrays.asList( @@ -958,7 +958,7 @@ protected static List plus(List... lists) { assertComplete(sql, getSelectKeywords(), tTable, EMP_COLUMNS, EXPR_KEYWORDS); } - @Test public void testSubQueryInWhere() { + @Test void testSubQueryInWhere() { String sql; // Aliases from enclosing sub-queries are inherited: hence A from @@ -981,7 +981,7 @@ protected static List plus(List... lists) { EXPR_KEYWORDS); } - @Test public void testSimpleParserTokenizer() { + @Test void testSimpleParserTokenizer() { String sql = "select" + " 12" @@ -1061,7 +1061,7 @@ protected static List plus(List... lists) { assertTokenizesTo("123", "ID(123)\n"); } - @Test public void testSimpleParser() { + @Test void testSimpleParser() { String sql; String expected; @@ -1244,19 +1244,19 @@ protected static List plus(List... lists) { assertSimplify(sql, expected); } - @WithLex(Lex.SQL_SERVER) @Test public void testSimpleParserQuotedIdSqlServer() { + @WithLex(Lex.SQL_SERVER) @Test void testSimpleParserQuotedIdSqlServer() { testSimpleParserQuotedIdImpl(); } - @WithLex(Lex.MYSQL) @Test public void testSimpleParserQuotedIdMySql() { + @WithLex(Lex.MYSQL) @Test void testSimpleParserQuotedIdMySql() { testSimpleParserQuotedIdImpl(); } - @WithLex(Lex.JAVA) @Test public void testSimpleParserQuotedIdJava() { + @WithLex(Lex.JAVA) @Test void testSimpleParserQuotedIdJava() { testSimpleParserQuotedIdImpl(); } - @Test public void testSimpleParserQuotedIdDefault() { + @Test void testSimpleParserQuotedIdDefault() { testSimpleParserQuotedIdImpl(); } @@ -1292,7 +1292,7 @@ private void testSimpleParserQuotedIdImpl() { assertSimplify(sql, expected); } - @Test public void testPartialIdentifier() { + @Test void testPartialIdentifier() { String sql = "select * from emp where e^ and emp.deptno = 10"; String expected = "COLUMN(EMPNO)\n" @@ -1407,7 +1407,7 @@ private void testSimpleParserQuotedIdImpl() { } @Disabled("Inserts are not supported by SimpleParser yet") - @Test public void testInsert() throws Exception { + @Test void testInsert() throws Exception { String sql; sql = "insert into emp(empno, mgr) select ^ from dept a"; assertComplete( @@ -1429,7 +1429,7 @@ private void testSimpleParserQuotedIdImpl() { assertComplete(sql, "", null); } - @Test public void testNestSchema() throws Exception { + @Test void testNestSchema() throws Exception { String sql; sql = "select * from sales.n^"; assertComplete( @@ -1457,7 +1457,7 @@ private void testSimpleParserQuotedIdImpl() { } @Disabled("The set of completion results is empty") - @Test public void testNestTable1() throws Exception { + @Test void testNestTable1() throws Exception { String sql; // select scott.emp.deptno from scott.emp; # valid sql = "select catalog.sales.emp.em^ from catalog.sales.emp"; @@ -1475,7 +1475,7 @@ private void testSimpleParserQuotedIdImpl() { ImmutableMap.of("TABLE(EMP)", "emp")); } - @Test public void testNestTable2() throws Exception { + @Test void testNestTable2() throws Exception { String sql; // select scott.emp.deptno from scott.emp as e; # not valid sql = "select catalog.sales.emp.em^ from catalog.sales.emp as e"; @@ -1487,7 +1487,7 @@ private void testSimpleParserQuotedIdImpl() { @Disabled("The set of completion results is empty") - @Test public void testNestTable3() throws Exception { + @Test void testNestTable3() throws Exception { String sql; // select scott.emp.deptno from emp; # valid sql = "select catalog.sales.emp.em^ from emp"; @@ -1505,7 +1505,7 @@ private void testSimpleParserQuotedIdImpl() { ImmutableMap.of("TABLE(EMP)", "emp")); } - @Test public void testNestTable4() throws Exception { + @Test void testNestTable4() throws Exception { String sql; // select scott.emp.deptno from emp as emp; # not valid sql = "select catalog.sales.emp.em^ from catalog.sales.emp as emp"; @@ -1515,7 +1515,7 @@ private void testSimpleParserQuotedIdImpl() { "em"); } - @Test public void testNestTableSchemaMustMatch() throws Exception { + @Test void testNestTableSchemaMustMatch() throws Exception { String sql; // select foo.emp.deptno from emp; # not valid sql = "select sales.nest.em^ from catalog.sales.emp_r"; @@ -1525,7 +1525,7 @@ private void testSimpleParserQuotedIdImpl() { "em"); } - @WithLex(Lex.SQL_SERVER) @Test public void testNestSchemaSqlServer() throws Exception { + @WithLex(Lex.SQL_SERVER) @Test void testNestSchemaSqlServer() throws Exception { String sql; sql = "select * from SALES.N^"; assertComplete( @@ -1552,7 +1552,7 @@ private void testSimpleParserQuotedIdImpl() { assertComplete(sql, "", "NU"); } - @Test public void testUnion() throws Exception { + @Test void testUnion() throws Exception { // we simplify set ops such as UNION by removing other queries - // thereby avoiding validation errors due to mismatched select lists String sql = @@ -1573,7 +1573,7 @@ private void testSimpleParserQuotedIdImpl() { assertSimplify(sql, simplified); } - @WithLex(Lex.SQL_SERVER) @Test public void testMssql() { + @WithLex(Lex.SQL_SERVER) @Test void testMssql() { String sql = "select 1 from [emp] union select 2 from [DEPT] a where ^ and deptno < 5"; String simplified = diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java index d2f98ba08f9b..638682f250d7 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java +++ b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java @@ -369,10 +369,10 @@ protected SqlTester tester(SqlLibrary library) { /** * For development. Put any old code in here. */ - @Test public void testDummy() { + @Test void testDummy() { } - @Test public void testSqlOperatorOverloading() { + @Test void testSqlOperatorOverloading() { final SqlStdOperatorTable operatorTable = SqlStdOperatorTable.instance(); for (SqlOperator sqlOperator : operatorTable.getOperatorList()) { String operatorName = sqlOperator.getName(); @@ -389,7 +389,7 @@ protected SqlTester tester(SqlLibrary library) { } } - @Test public void testBetween() { + @Test void testBetween() { tester.setFor( SqlStdOperatorTable.BETWEEN, SqlTester.VmName.EXPAND); @@ -423,7 +423,7 @@ protected SqlTester tester(SqlLibrary library) { tester.checkBoolean("x'0A00015A' between x'0A0001A0' and x'0A0001B0'", Boolean.FALSE); } - @Test public void testNotBetween() { + @Test void testNotBetween() { tester.setFor(SqlStdOperatorTable.NOT_BETWEEN, VM_EXPAND); tester.checkBoolean("2 not between 1 and 3", Boolean.FALSE); tester.checkBoolean("3 not between 1 and 3", Boolean.FALSE); @@ -534,7 +534,7 @@ private void checkCastToString(String value, String type, String expected) { expected + spaces); } - @Test public void testCastToString() { + @Test void testCastToString() { tester.setFor(SqlStdOperatorTable.CAST); checkCastToString("cast(cast('abc' as char(4)) as varchar(6))", null, "abc "); @@ -680,7 +680,7 @@ private void checkCastToString(String value, String type, String expected) { } } - @Test public void testCastExactNumericLimits() { + @Test void testCastExactNumericLimits() { tester.setFor(SqlStdOperatorTable.CAST); // Test casting for min,max, out of range for exact numeric types @@ -757,7 +757,7 @@ private void checkCastToString(String value, String type, String expected) { } } - @Test public void testCastToExactNumeric() { + @Test void testCastToExactNumeric() { tester.setFor(SqlStdOperatorTable.CAST); checkCastToScalarOkay("1", "BIGINT"); @@ -787,7 +787,7 @@ private void checkCastToString(String value, String type, String expected) { "654342432412312"); } - @Test public void testCastStringToDecimal() { + @Test void testCastStringToDecimal() { tester.setFor(SqlStdOperatorTable.CAST); if (!DECIMAL) { return; @@ -822,7 +822,7 @@ private void checkCastToString(String value, String type, String expected) { true); } - @Test public void testCastIntervalToNumeric() { + @Test void testCastIntervalToNumeric() { tester.setFor(SqlStdOperatorTable.CAST); // interval to decimal @@ -951,7 +951,7 @@ private void checkCastToString(String value, String type, String expected) { "-1"); } - @Test public void testCastToInterval() { + @Test void testCastToInterval() { tester.setFor(SqlStdOperatorTable.CAST); tester.checkScalar( "cast(5 as interval second)", @@ -1004,7 +1004,7 @@ private void checkCastToString(String value, String type, String expected) { "INTERVAL MINUTE(4) NOT NULL"); } - @Test public void testCastIntervalToInterval() { + @Test void testCastIntervalToInterval() { tester.checkScalar( "cast(interval '2 5' day to hour as interval hour to minute)", "+53:00", @@ -1027,7 +1027,7 @@ private void checkCastToString(String value, String type, String expected) { "INTERVAL DAY TO HOUR NOT NULL"); } - @Test public void testCastWithRoundingToScalar() { + @Test void testCastWithRoundingToScalar() { tester.setFor(SqlStdOperatorTable.CAST); checkCastToScalarOkay("1.25", "INTEGER", "1"); @@ -1067,7 +1067,7 @@ private void checkCastToString(String value, String type, String expected) { true); } - @Test public void testCastDecimalToDoubleToInteger() { + @Test void testCastDecimalToDoubleToInteger() { tester.setFor(SqlStdOperatorTable.CAST); tester.checkScalarExact( @@ -1093,7 +1093,7 @@ private void checkCastToString(String value, String type, String expected) { "-2"); } - @Test public void testCastApproxNumericLimits() { + @Test void testCastApproxNumericLimits() { tester.setFor(SqlStdOperatorTable.CAST); // Test casting for min,max, out of range for approx numeric types @@ -1214,7 +1214,7 @@ private void checkCastToString(String value, String type, String expected) { } } - @Test public void testCastToApproxNumeric() { + @Test void testCastToApproxNumeric() { tester.setFor(SqlStdOperatorTable.CAST); checkCastToApproxOkay("1", "DOUBLE", 1, 0); @@ -1226,7 +1226,7 @@ private void checkCastToString(String value, String type, String expected) { checkCastToApproxOkay("0e0", "REAL", 0, 0); } - @Test public void testCastNull() { + @Test void testCastNull() { tester.setFor(SqlStdOperatorTable.CAST); // null @@ -1248,7 +1248,7 @@ private void checkCastToString(String value, String type, String expected) { /** Test case for * [CALCITE-1439] * Handling errors during constant reduction. */ - @Test public void testCastInvalid() { + @Test void testCastInvalid() { // Before CALCITE-1439 was fixed, constant reduction would kick in and // generate Java constants that throw when the class is loaded, thus // ExceptionInInitializerError. @@ -1265,7 +1265,7 @@ private void checkCastToString(String value, String type, String expected) { } } - @Test public void testCastDateTime() { + @Test void testCastDateTime() { // Test cast for date/time/timestamp tester.setFor(SqlStdOperatorTable.CAST); @@ -1350,7 +1350,7 @@ private void checkCastToString(String value, String type, String expected) { "TIMESTAMP(0) NOT NULL"); } - @Test public void testCastStringToDateTime() { + @Test void testCastStringToDateTime() { tester.checkScalar( "cast('12:42:25' as TIME)", "12:42:25", @@ -1559,7 +1559,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { } } - @Test public void testCastToBoolean() { + @Test void testCastToBoolean() { tester.setFor(SqlStdOperatorTable.CAST); // string to boolean @@ -1583,7 +1583,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { true); } - @Test public void testCase() { + @Test void testCase() { tester.setFor(SqlStdOperatorTable.CASE); tester.checkScalarExact("case when 'a'='a' then 1 end", "1"); @@ -1780,13 +1780,13 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { // TODO: Check case with multisets } - @Test public void testCaseNull() { + @Test void testCaseNull() { tester.setFor(SqlStdOperatorTable.CASE); tester.checkScalarExact("case when 1 = 1 then 10 else null end", "10"); tester.checkNull("case when 1 = 2 then 10 else null end"); } - @Test public void testCaseType() { + @Test void testCaseType() { tester.setFor(SqlStdOperatorTable.CASE); tester.checkType( "case 1 when 1 then current_timestamp else null end", @@ -1810,7 +1810,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { * *

See FRG-97 "Support for JDBC escape syntax is incomplete". */ - @Test public void testJdbcFn() { + @Test void testJdbcFn() { tester.setFor(new SqlJdbcFunctionCall("dummy")); // There follows one test for each function in appendix C of the JDBC @@ -2014,7 +2014,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { } - @Test public void testChr() { + @Test void testChr() { tester.setFor(SqlLibraryOperators.CHR, VM_FENNEL, VM_JAVA); final SqlTester tester1 = oracleTester(); tester1.checkScalar("chr(97)", @@ -2027,7 +2027,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "No match found for function signature CHR\\(\\)", false); } - @Test public void testSelect() { + @Test void testSelect() { tester.check( "select * from (values(1))", SqlTests.INTEGER_TYPE_CHECKER, @@ -2069,7 +2069,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { } } - @Test public void testLiteralChain() { + @Test void testLiteralChain() { tester.setFor(SqlStdOperatorTable.LITERAL_CHAIN, VM_EXPAND); tester.checkString( "'buttered'\n' toast'", @@ -2088,7 +2088,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester.checkBoolean("x''\n'ab' = x'ab'", Boolean.TRUE); } - @Test public void testComplexLiteral() { + @Test void testComplexLiteral() { tester.check("select 2 * 2 * x from (select 2 as x)", new SqlTests.StringTypeChecker("INTEGER NOT NULL"), "8", @@ -2103,11 +2103,11 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { 0); } - @Test public void testRow() { + @Test void testRow() { tester.setFor(SqlStdOperatorTable.ROW, VM_FENNEL); } - @Test public void testAndOperator() { + @Test void testAndOperator() { tester.setFor(SqlStdOperatorTable.AND); tester.checkBoolean("true and false", Boolean.FALSE); tester.checkBoolean("true and true", Boolean.TRUE); @@ -2121,7 +2121,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester.checkBoolean("true and (not false)", Boolean.TRUE); } - @Test public void testAndOperator2() { + @Test void testAndOperator2() { tester.checkBoolean( "case when false then unknown else true end and true", Boolean.TRUE); @@ -2133,7 +2133,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { Boolean.TRUE); } - @Test public void testAndOperatorLazy() { + @Test void testAndOperatorLazy() { tester.setFor(SqlStdOperatorTable.AND); // lazy eval returns FALSE; @@ -2146,7 +2146,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { Boolean.FALSE, INVALID_ARG_FOR_POWER, CODE_2201F)); } - @Test public void testConcatOperator() { + @Test void testConcatOperator() { tester.setFor(SqlStdOperatorTable.CONCAT); tester.checkString(" 'a'||'b' ", "ab", "CHAR(2) NOT NULL"); tester.checkNull(" 'a' || cast(null as char(2)) "); @@ -2206,7 +2206,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester3.checkFails("^concat('a')^", INVALID_ARGUMENTS_NUMBER, false); } - @Test public void testModOperator() { + @Test void testModOperator() { // "%" is allowed under MYSQL_5 SQL conformance level final SqlTester tester1 = tester.withConformance(SqlConformanceEnum.MYSQL_5); tester1.setFor(SqlStdOperatorTable.PERCENT_REMAINDER); @@ -2236,7 +2236,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "-2"); } - @Test public void testModPrecedence() { + @Test void testModPrecedence() { // "%" is allowed under MYSQL_5 SQL conformance level final SqlTester tester1 = tester.withConformance(SqlConformanceEnum.MYSQL_5); tester1.setFor(SqlStdOperatorTable.PERCENT_REMAINDER); @@ -2244,7 +2244,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester1.checkScalarExact("(1 + 5 % 3) % 4 + 14 % 17", "17"); } - @Test public void testModOperatorNull() { + @Test void testModOperatorNull() { // "%" is allowed under MYSQL_5 SQL conformance level final SqlTester tester1 = tester.withConformance(SqlConformanceEnum.MYSQL_5); tester1.checkNull("cast(null as integer) % 2"); @@ -2255,7 +2255,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester1.checkNull("4 % cast(null as decimal(12,0))"); } - @Test public void testModOperatorDivByZero() { + @Test void testModOperatorDivByZero() { // "%" is allowed under MYSQL_5 SQL conformance level final SqlTester tester1 = tester.withConformance(SqlConformanceEnum.MYSQL_5); // The extra CASE expression is to fool Janino. It does constant @@ -2268,7 +2268,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "3 % case 'a' when 'a' then 0 end", DIVISION_BY_ZERO_MESSAGE, true); } - @Test public void testDivideOperator() { + @Test void testDivideOperator() { tester.setFor(SqlStdOperatorTable.DIVIDE); tester.checkScalarExact( "10 / 5", @@ -2324,7 +2324,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { } } - @Test public void testDivideOperatorIntervals() { + @Test void testDivideOperatorIntervals() { tester.checkScalar( "interval '-2:2' hour to minute / 3", "-0:41", @@ -2347,7 +2347,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "INTERVAL YEAR TO MONTH NOT NULL"); } - @Test public void testEqualsOperator() { + @Test void testEqualsOperator() { tester.setFor(SqlStdOperatorTable.EQUALS); tester.checkBoolean("1=1", Boolean.TRUE); tester.checkBoolean("1=1.0", Boolean.TRUE); @@ -2392,7 +2392,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester.checkNull("cast(null as varchar(10))='a'"); } - @Test public void testEqualsOperatorInterval() { + @Test void testEqualsOperatorInterval() { tester.checkBoolean( "interval '2' day = interval '1' day", Boolean.FALSE); @@ -2406,7 +2406,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "cast(null as interval hour) = interval '2' minute"); } - @Test public void testGreaterThanOperator() { + @Test void testGreaterThanOperator() { tester.setFor(SqlStdOperatorTable.GREATER_THAN); tester.checkBoolean("1>2", Boolean.FALSE); tester.checkBoolean( @@ -2441,7 +2441,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester.checkBoolean("x'0A000130'>x'0A0001B0'", Boolean.FALSE); } - @Test public void testGreaterThanOperatorIntervals() { + @Test void testGreaterThanOperatorIntervals() { tester.checkBoolean( "interval '2' day > interval '1' day", Boolean.TRUE); @@ -2472,7 +2472,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "interval '2:2' hour to minute > cast(null as interval second)"); } - @Test public void testIsDistinctFromOperator() { + @Test void testIsDistinctFromOperator() { tester.setFor( SqlStdOperatorTable.IS_DISTINCT_FROM, VM_EXPAND); @@ -2510,7 +2510,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { Boolean.FALSE); } - @Test public void testIsNotDistinctFromOperator() { + @Test void testIsNotDistinctFromOperator() { tester.setFor( SqlStdOperatorTable.IS_NOT_DISTINCT_FROM, VM_EXPAND); @@ -2552,7 +2552,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { Boolean.TRUE); } - @Test public void testGreaterThanOrEqualOperator() { + @Test void testGreaterThanOrEqualOperator() { tester.setFor(SqlStdOperatorTable.GREATER_THAN_OR_EQUAL); tester.checkBoolean("1>=2", Boolean.FALSE); tester.checkBoolean("-1>=1", Boolean.FALSE); @@ -2575,7 +2575,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { tester.checkBoolean("x'0A0001B0'>=x'0A0001B0'", Boolean.TRUE); } - @Test public void testGreaterThanOrEqualOperatorIntervals() { + @Test void testGreaterThanOrEqualOperatorIntervals() { tester.checkBoolean( "interval '2' day >= interval '1' day", Boolean.TRUE); @@ -2606,7 +2606,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { "interval '2:2' hour to minute >= cast(null as interval second)"); } - @Test public void testInOperator() { + @Test void testInOperator() { tester.setFor(SqlStdOperatorTable.IN, VM_EXPAND); tester.checkBoolean("1 in (0, 1, 2)", true); tester.checkBoolean("3 in (0, 1, 2)", false); @@ -2636,7 +2636,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { false); } - @Test public void testNotInOperator() { + @Test void testNotInOperator() { tester.setFor(SqlStdOperatorTable.NOT_IN, VM_EXPAND); tester.checkBoolean("1 not in (0, 1, 2)", false); tester.checkBoolean("3 not in (0, 1, 2)", true); @@ -2668,7 +2668,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { false); } - @Test public void testOverlapsOperator() { + @Test void testOverlapsOperator() { tester.setFor(SqlStdOperatorTable.OVERLAPS, VM_EXPAND); tester.checkBoolean( "(date '1-2-3', date '1-2-3') overlaps (date '1-2-3', interval '1' year)", @@ -2718,7 +2718,7 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) { *

Tests OVERLAP and similar period operators CONTAINS, EQUALS, PRECEDES, * SUCCEEDS, IMMEDIATELY PRECEDES, IMMEDIATELY SUCCEEDS for DATE, TIME and * TIMESTAMP values. */ - @Test public void testPeriodOperators() { + @Test void testPeriodOperators() { String[] times = { "TIME '01:00:00'", "TIME '02:00:00'", @@ -2866,7 +2866,7 @@ private void checkOverlaps(OverlapChecker c) { c.isTrue("($3,$0) IMMEDIATELY SUCCEEDS ($0,$0)"); } - @Test public void testLessThanOperator() { + @Test void testLessThanOperator() { tester.setFor(SqlStdOperatorTable.LESS_THAN); tester.checkBoolean("1<2", Boolean.TRUE); tester.checkBoolean("-1<1", Boolean.TRUE); @@ -2894,7 +2894,7 @@ private void checkOverlaps(OverlapChecker c) { tester.checkBoolean("x'0A000130'[CALCITE-1864] * Allow NULL literal as argument. */ - @Test public void testNullOperand() { + @Test void testNullOperand() { checkNullOperand(tester, "="); checkNullOperand(tester, ">"); checkNullOperand(tester, "<"); @@ -3308,7 +3308,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkBoolean("null " + op + " null", null); } - @Test public void testNotEqualsOperator() { + @Test void testNotEqualsOperator() { tester.setFor(SqlStdOperatorTable.NOT_EQUALS); tester.checkBoolean("1<>1", Boolean.FALSE); tester.checkBoolean("'a'<>'A'", Boolean.TRUE); @@ -3329,7 +3329,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkBoolean("1 != null", null); } - @Test public void testNotEqualsOperatorIntervals() { + @Test void testNotEqualsOperatorIntervals() { tester.checkBoolean( "interval '2' day <> interval '1' day", Boolean.TRUE); @@ -3343,7 +3343,7 @@ private void checkNullOperand(SqlTester tester, String op) { "cast(null as interval hour) <> interval '2' minute"); } - @Test public void testOrOperator() { + @Test void testOrOperator() { tester.setFor(SqlStdOperatorTable.OR); tester.checkBoolean("true or false", Boolean.TRUE); tester.checkBoolean("false or false", Boolean.FALSE); @@ -3351,7 +3351,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("false or cast(null as boolean)"); } - @Test public void testOrOperatorLazy() { + @Test void testOrOperatorLazy() { tester.setFor(SqlStdOperatorTable.OR); // need to evaluate 2nd argument if first evaluates to null, therefore @@ -3387,7 +3387,7 @@ private void checkNullOperand(SqlTester tester, String op) { "1 < cast(null as integer) or sqrt(4) = 2", Boolean.TRUE); } - @Test public void testPlusOperator() { + @Test void testPlusOperator() { tester.setFor(SqlStdOperatorTable.PLUS); tester.checkScalarExact("1+2", "3"); tester.checkScalarExact("-1+2", "1"); @@ -3449,12 +3449,12 @@ private void checkNullOperand(SqlTester tester, String op) { } } - @Test public void testPlusOperatorAny() { + @Test void testPlusOperatorAny() { tester.setFor(SqlStdOperatorTable.PLUS); tester.checkScalar("1+CAST(2 AS ANY)", "3", "ANY NOT NULL"); } - @Test public void testPlusIntervalOperator() { + @Test void testPlusIntervalOperator() { tester.setFor(SqlStdOperatorTable.PLUS); tester.checkScalar( "interval '2' day + interval '1' day", @@ -3538,11 +3538,11 @@ private void checkNullOperand(SqlTester tester, String op) { "TIMESTAMP(0) NOT NULL"); } - @Test public void testDescendingOperator() { + @Test void testDescendingOperator() { tester.setFor(SqlStdOperatorTable.DESC, VM_EXPAND); } - @Test public void testIsNotNullOperator() { + @Test void testIsNotNullOperator() { tester.setFor(SqlStdOperatorTable.IS_NOT_NULL); tester.checkBoolean("true is not null", Boolean.TRUE); tester.checkBoolean( @@ -3550,7 +3550,7 @@ private void checkNullOperand(SqlTester tester, String op) { Boolean.FALSE); } - @Test public void testIsNullOperator() { + @Test void testIsNullOperator() { tester.setFor(SqlStdOperatorTable.IS_NULL); tester.checkBoolean("true is null", Boolean.FALSE); tester.checkBoolean( @@ -3558,7 +3558,7 @@ private void checkNullOperand(SqlTester tester, String op) { Boolean.TRUE); } - @Test public void testIsNotTrueOperator() { + @Test void testIsNotTrueOperator() { tester.setFor(SqlStdOperatorTable.IS_NOT_TRUE); tester.checkBoolean("true is not true", Boolean.FALSE); tester.checkBoolean("false is not true", Boolean.TRUE); @@ -3571,7 +3571,7 @@ private void checkNullOperand(SqlTester tester, String op) { false); } - @Test public void testIsTrueOperator() { + @Test void testIsTrueOperator() { tester.setFor(SqlStdOperatorTable.IS_TRUE); tester.checkBoolean("true is true", Boolean.TRUE); tester.checkBoolean("false is true", Boolean.FALSE); @@ -3580,7 +3580,7 @@ private void checkNullOperand(SqlTester tester, String op) { Boolean.FALSE); } - @Test public void testIsNotFalseOperator() { + @Test void testIsNotFalseOperator() { tester.setFor(SqlStdOperatorTable.IS_NOT_FALSE); tester.checkBoolean("false is not false", Boolean.FALSE); tester.checkBoolean("true is not false", Boolean.TRUE); @@ -3589,7 +3589,7 @@ private void checkNullOperand(SqlTester tester, String op) { Boolean.TRUE); } - @Test public void testIsFalseOperator() { + @Test void testIsFalseOperator() { tester.setFor(SqlStdOperatorTable.IS_FALSE); tester.checkBoolean("false is false", Boolean.TRUE); tester.checkBoolean("true is false", Boolean.FALSE); @@ -3598,7 +3598,7 @@ private void checkNullOperand(SqlTester tester, String op) { Boolean.FALSE); } - @Test public void testIsNotUnknownOperator() { + @Test void testIsNotUnknownOperator() { tester.setFor(SqlStdOperatorTable.IS_NOT_UNKNOWN, VM_EXPAND); tester.checkBoolean("false is not unknown", Boolean.TRUE); tester.checkBoolean("true is not unknown", Boolean.TRUE); @@ -3612,7 +3612,7 @@ private void checkNullOperand(SqlTester tester, String op) { false); } - @Test public void testIsUnknownOperator() { + @Test void testIsUnknownOperator() { tester.setFor(SqlStdOperatorTable.IS_UNKNOWN, VM_EXPAND); tester.checkBoolean("false is unknown", Boolean.FALSE); tester.checkBoolean("true is unknown", Boolean.FALSE); @@ -3626,7 +3626,7 @@ private void checkNullOperand(SqlTester tester, String op) { false); } - @Test public void testIsASetOperator() { + @Test void testIsASetOperator() { tester.setFor(SqlStdOperatorTable.IS_A_SET, VM_EXPAND); tester.checkBoolean("multiset[1] is a set", Boolean.TRUE); tester.checkBoolean("multiset[1, 1] is a set", Boolean.FALSE); @@ -3638,7 +3638,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkBoolean("multiset['a', 'b', 'a'] is a set", Boolean.FALSE); } - @Test public void testIsNotASetOperator() { + @Test void testIsNotASetOperator() { tester.setFor(SqlStdOperatorTable.IS_NOT_A_SET, VM_EXPAND); tester.checkBoolean("multiset[1] is not a set", Boolean.FALSE); tester.checkBoolean("multiset[1, 1] is not a set", Boolean.TRUE); @@ -3650,7 +3650,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkBoolean("multiset['a', 'b', 'a'] is not a set", Boolean.TRUE); } - @Test public void testIntersectOperator() { + @Test void testIntersectOperator() { tester.setFor(SqlStdOperatorTable.MULTISET_INTERSECT, VM_EXPAND); tester.checkScalar("multiset[1] multiset intersect multiset[1]", "[1]", @@ -3687,7 +3687,7 @@ private void checkNullOperand(SqlTester tester, String op) { "INTEGER MULTISET NOT NULL"); } - @Test public void testExceptOperator() { + @Test void testExceptOperator() { tester.setFor(SqlStdOperatorTable.MULTISET_EXCEPT, VM_EXPAND); tester.checkScalar("multiset[1] multiset except multiset[1]", "[]", @@ -3720,21 +3720,21 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkBoolean("(multiset[1] multiset except multiset[1]) is empty", Boolean.TRUE); } - @Test public void testIsEmptyOperator() { + @Test void testIsEmptyOperator() { tester.setFor(SqlStdOperatorTable.IS_EMPTY, VM_EXPAND); tester.checkBoolean("multiset[1] is empty", Boolean.FALSE); } - @Test public void testIsNotEmptyOperator() { + @Test void testIsNotEmptyOperator() { tester.setFor(SqlStdOperatorTable.IS_NOT_EMPTY, VM_EXPAND); tester.checkBoolean("multiset[1] is not empty", Boolean.TRUE); } - @Test public void testExistsOperator() { + @Test void testExistsOperator() { tester.setFor(SqlStdOperatorTable.EXISTS, VM_EXPAND); } - @Test public void testNotOperator() { + @Test void testNotOperator() { tester.setFor(SqlStdOperatorTable.NOT); tester.checkBoolean("not true", Boolean.FALSE); tester.checkBoolean("not false", Boolean.TRUE); @@ -3742,7 +3742,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("not cast(null as boolean)"); } - @Test public void testPrefixMinusOperator() { + @Test void testPrefixMinusOperator() { tester.setFor(SqlStdOperatorTable.UNARY_MINUS); strictTester.checkFails( "'a' + ^- 'b'^ + 'c'", @@ -3759,7 +3759,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("-cast(null as tinyint)"); } - @Test public void testPrefixMinusOperatorIntervals() { + @Test void testPrefixMinusOperatorIntervals() { tester.checkScalar( "-interval '-6:2:8' hour to second", "+6:02:08.000000", @@ -3776,7 +3776,7 @@ private void checkNullOperand(SqlTester tester, String op) { "-cast(null as interval day to minute)"); } - @Test public void testPrefixPlusOperator() { + @Test void testPrefixPlusOperator() { tester.setFor(SqlStdOperatorTable.UNARY_PLUS, VM_EXPAND); tester.checkScalarExact("+1", "1"); tester.checkScalarExact("+1.23", "DECIMAL(3, 2) NOT NULL", "1.23"); @@ -3785,7 +3785,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("+cast(null as tinyint)"); } - @Test public void testPrefixPlusOperatorIntervals() { + @Test void testPrefixPlusOperatorIntervals() { tester.checkScalar( "+interval '-6:2:8' hour to second", "-6:02:08.000000", @@ -3808,13 +3808,13 @@ private void checkNullOperand(SqlTester tester, String op) { "+cast(null as interval day to minute)"); } - @Test public void testExplicitTableOperator() { + @Test void testExplicitTableOperator() { tester.setFor( SqlStdOperatorTable.EXPLICIT_TABLE, VM_EXPAND); } - @Test public void testValuesOperator() { + @Test void testValuesOperator() { tester.setFor(SqlStdOperatorTable.VALUES, VM_EXPAND); tester.check( "select 'abc' from (values(true))", @@ -3823,7 +3823,7 @@ private void checkNullOperand(SqlTester tester, String op) { 0); } - @Test public void testNotLikeOperator() { + @Test void testNotLikeOperator() { tester.setFor(SqlStdOperatorTable.NOT_LIKE, VM_EXPAND); tester.checkBoolean("'abc' not like '_b_'", Boolean.FALSE); tester.checkBoolean("'ab\ncd' not like 'ab%'", Boolean.FALSE); @@ -3832,7 +3832,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkBoolean("'ab\ncd\nef' not like '%cde%'", Boolean.TRUE); } - @Test public void testLikeEscape() { + @Test void testLikeEscape() { tester.setFor(SqlStdOperatorTable.LIKE); tester.checkBoolean("'a_c' like 'a#_c' escape '#'", Boolean.TRUE); tester.checkBoolean("'axc' like 'a#_c' escape '#'", Boolean.FALSE); @@ -3845,12 +3845,12 @@ private void checkNullOperand(SqlTester tester, String op) { } @Disabled("[CALCITE-525] Exception-handling in built-in functions") - @Test public void testLikeEscape2() { + @Test void testLikeEscape2() { tester.checkBoolean("'x' not like 'x' escape 'x'", Boolean.TRUE); tester.checkBoolean("'xyz' not like 'xyz' escape 'xyz'", Boolean.TRUE); } - @Test public void testLikeOperator() { + @Test void testLikeOperator() { tester.setFor(SqlStdOperatorTable.LIKE); tester.checkBoolean("'' like ''", Boolean.TRUE); tester.checkBoolean("'a' like 'a'", Boolean.TRUE); @@ -3877,13 +3877,13 @@ private void checkNullOperand(SqlTester tester, String op) { /** Test case for * [CALCITE-1898] * LIKE must match '.' (period) literally. */ - @Test public void testLikeDot() { + @Test void testLikeDot() { tester.checkBoolean("'abc' like 'a.c'", Boolean.FALSE); tester.checkBoolean("'abcde' like '%c.e'", Boolean.FALSE); tester.checkBoolean("'abc.e' like '%c.e'", Boolean.TRUE); } - @Test public void testNotSimilarToOperator() { + @Test void testNotSimilarToOperator() { tester.setFor(SqlStdOperatorTable.NOT_SIMILAR_TO, VM_EXPAND); tester.checkBoolean("'ab' not similar to 'a_'", false); tester.checkBoolean("'aabc' not similar to 'ab*c+d'", true); @@ -3897,7 +3897,7 @@ private void checkNullOperand(SqlTester tester, String op) { null); } - @Test public void testSimilarToOperator() { + @Test void testSimilarToOperator() { tester.setFor(SqlStdOperatorTable.SIMILAR_TO); // like LIKE @@ -4184,25 +4184,25 @@ private void checkNullOperand(SqlTester tester, String op) { } } - @Test public void testEscapeOperator() { + @Test void testEscapeOperator() { tester.setFor(SqlStdOperatorTable.ESCAPE, VM_EXPAND); } - @Test public void testConvertFunc() { + @Test void testConvertFunc() { tester.setFor( SqlStdOperatorTable.CONVERT, VM_FENNEL, VM_JAVA); } - @Test public void testTranslateFunc() { + @Test void testTranslateFunc() { tester.setFor( SqlStdOperatorTable.TRANSLATE, VM_FENNEL, VM_JAVA); } - @Test public void testTranslate3Func() { + @Test void testTranslate3Func() { final SqlTester tester1 = oracleTester(); tester1.setFor(SqlLibraryOperators.TRANSLATE3); tester1.checkString( @@ -4233,7 +4233,7 @@ private void checkNullOperand(SqlTester tester, String op) { "translate('aabbcc', 'ab', cast(null as varchar(2)))"); } - @Test public void testOverlayFunc() { + @Test void testOverlayFunc() { tester.setFor(SqlStdOperatorTable.OVERLAY); tester.checkString( "overlay('ABCdef' placing 'abc' from 1)", @@ -4293,7 +4293,7 @@ private void checkNullOperand(SqlTester tester, String op) { "overlay(x'abcd' placing x'abcd' from cast(null as integer))"); } - @Test public void testPositionFunc() { + @Test void testPositionFunc() { tester.setFor(SqlStdOperatorTable.POSITION); tester.checkScalarExact("position('b' in 'abc')", "2"); tester.checkScalarExact("position('' in 'abc')", "1"); @@ -4326,7 +4326,7 @@ private void checkNullOperand(SqlTester tester, String op) { "INTEGER NOT NULL"); } - @Test public void testReplaceFunc() { + @Test void testReplaceFunc() { tester.setFor(SqlStdOperatorTable.REPLACE); tester.checkString("REPLACE('ciao', 'ciao', '')", "", "VARCHAR(4) NOT NULL"); @@ -4337,19 +4337,19 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("REPLACE('ciao', 'bella', cast(null as varchar(3)))"); } - @Test public void testCharLengthFunc() { + @Test void testCharLengthFunc() { tester.setFor(SqlStdOperatorTable.CHAR_LENGTH); tester.checkScalarExact("char_length('abc')", "3"); tester.checkNull("char_length(cast(null as varchar(1)))"); } - @Test public void testCharacterLengthFunc() { + @Test void testCharacterLengthFunc() { tester.setFor(SqlStdOperatorTable.CHARACTER_LENGTH); tester.checkScalarExact("CHARACTER_LENGTH('abc')", "3"); tester.checkNull("CHARACTER_LENGTH(cast(null as varchar(1)))"); } - @Test public void testAsciiFunc() { + @Test void testAsciiFunc() { tester.setFor(SqlStdOperatorTable.ASCII); tester.checkScalarExact("ASCII('')", "0"); tester.checkScalarExact("ASCII('a')", "97"); @@ -4362,7 +4362,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("ASCII(cast(null as varchar(1)))"); } - @Test public void testToBase64() { + @Test void testToBase64() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.TO_BASE64); tester1.checkString("to_base64(x'546869732069732061207465737420537472696e672e')", @@ -4416,7 +4416,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkString("to_base64(x'61')", "YQ==", "VARCHAR NOT NULL"); } - @Test public void testFromBase64() { + @Test void testFromBase64() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.FROM_BASE64); tester1.checkString("from_base64('VGhpcyBpcyBhIHRlc3QgU3RyaW5nLg==')", @@ -4435,7 +4435,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkNull("from_base64('-100')"); } - @Test public void testMd5() { + @Test void testMd5() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.MD5); tester1.checkString("md5(x'')", @@ -4452,7 +4452,7 @@ private void checkNullOperand(SqlTester tester, String op) { "VARCHAR NOT NULL"); } - @Test public void testSha1() { + @Test void testSha1() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.SHA1); tester1.checkString("sha1(x'')", @@ -4469,7 +4469,7 @@ private void checkNullOperand(SqlTester tester, String op) { "VARCHAR NOT NULL"); } - @Test public void testRepeatFunc() { + @Test void testRepeatFunc() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.REPEAT); tester1.checkString("REPEAT('a', -100)", "", "VARCHAR(1) NOT NULL"); @@ -4484,7 +4484,7 @@ private void checkNullOperand(SqlTester tester, String op) { } - @Test public void testSpaceFunc() { + @Test void testSpaceFunc() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.SPACE); tester1.checkString("SPACE(-100)", "", "VARCHAR(2000) NOT NULL"); @@ -4495,7 +4495,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkNull("SPACE(cast(null as integer))"); } - @Test public void testStrcmpFunc() { + @Test void testStrcmpFunc() { final SqlTester tester1 = tester(SqlLibrary.MYSQL); tester1.setFor(SqlLibraryOperators.STRCMP); tester1.checkString("STRCMP('mytesttext', 'mytesttext')", "0", "INTEGER NOT NULL"); @@ -4505,7 +4505,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkNull("STRCMP(cast(null as varchar(1)), 'mytesttext')"); } - @Test public void testSoundexFunc() { + @Test void testSoundexFunc() { final SqlTester tester1 = oracleTester(); tester1.setFor(SqlLibraryOperators.SOUNDEX); tester1.checkString("SOUNDEX('TECH ON THE NET')", "T253", "VARCHAR(4) NOT NULL"); @@ -4520,7 +4520,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkFails("SOUNDEX(_UTF8'\u5B57\u5B57')", "The character is not mapped.*", true); } - @Test public void testDifferenceFunc() { + @Test void testDifferenceFunc() { final SqlTester tester1 = tester(SqlLibrary.POSTGRESQL); tester1.setFor(SqlLibraryOperators.DIFFERENCE); tester1.checkScalarExact("DIFFERENCE('Miller', 'miller')", "4"); @@ -4535,7 +4535,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester1.checkNull("DIFFERENCE(cast(null as varchar(1)), 'muller')"); } - @Test public void testReverseFunc() { + @Test void testReverseFunc() { final SqlTester testerMysql = tester(SqlLibrary.MYSQL); testerMysql.setFor(SqlLibraryOperators.REVERSE); testerMysql.checkString("reverse('')", "", "VARCHAR(0) NOT NULL"); @@ -4549,7 +4549,7 @@ private void checkNullOperand(SqlTester tester, String op) { testerMysql.checkNull("reverse(cast(null as varchar(1)))"); } - @Test public void testUpperFunc() { + @Test void testUpperFunc() { tester.setFor(SqlStdOperatorTable.UPPER); tester.checkString("upper('a')", "A", "CHAR(1) NOT NULL"); tester.checkString("upper('A')", "A", "CHAR(1) NOT NULL"); @@ -4558,7 +4558,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("upper(cast(null as varchar(1)))"); } - @Test public void testLeftFunc() { + @Test void testLeftFunc() { Stream.of(SqlLibrary.MYSQL, SqlLibrary.POSTGRESQL) .map(this::tester) .forEach(t -> { @@ -4581,7 +4581,7 @@ private void checkNullOperand(SqlTester tester, String op) { }); } - @Test public void testRightFunc() { + @Test void testRightFunc() { Stream.of(SqlLibrary.MYSQL, SqlLibrary.POSTGRESQL) .map(this::tester) .forEach(t -> { @@ -4604,7 +4604,7 @@ private void checkNullOperand(SqlTester tester, String op) { }); } - @Test public void testRegexpReplaceFunc() { + @Test void testRegexpReplaceFunc() { Stream.of(SqlLibrary.MYSQL, SqlLibrary.ORACLE) .map(this::tester) .forEach(t -> { @@ -4643,7 +4643,7 @@ private void checkNullOperand(SqlTester tester, String op) { }); } - @Test public void testJsonExists() { + @Test void testJsonExists() { tester.checkBoolean("json_exists('{\"foo\":\"bar\"}', " + "'strict $.foo' false on error)", Boolean.TRUE); tester.checkBoolean("json_exists('{\"foo\":\"bar\"}', " @@ -4689,7 +4689,7 @@ private void checkNullOperand(SqlTester tester, String op) { } - @Test public void testJsonValue() { + @Test void testJsonValue() { // type casting test tester.checkString("json_value('{\"foo\":100}', 'strict $.foo')", "100", "VARCHAR(2000)"); @@ -4768,7 +4768,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_value(cast(null as varchar), 'strict $')"); } - @Test public void testJsonQuery() { + @Test void testJsonQuery() { // lax test tester.checkString("json_query('{\"foo\":100}', 'lax $' null on empty)", "{\"foo\":100}", "VARCHAR(2000)"); @@ -4862,7 +4862,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_query(cast(null as varchar), 'lax $')"); } - @Test public void testJsonPretty() { + @Test void testJsonPretty() { tester.checkString("json_pretty('{\"foo\":100}')", "{\n \"foo\" : 100\n}", "VARCHAR(2000)"); tester.checkString("json_pretty('[1,2,3]')", @@ -4877,7 +4877,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_pretty(cast(null as varchar))"); } - @Test public void testJsonStorageSize() { + @Test void testJsonStorageSize() { tester.checkString("json_storage_size('[100, \"sakila\", [1, 3, 5], 425.05]')", "29", "INTEGER"); tester.checkString("json_storage_size('{\"a\": 1000,\"b\": \"aa\", \"c\": \"[1, 3, 5]\"}')", @@ -4900,7 +4900,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_storage_size(cast(null as varchar))"); } - @Test public void testJsonType() { + @Test void testJsonType() { tester.setFor(SqlLibraryOperators.JSON_TYPE); tester.checkString("json_type('\"1\"')", "STRING", "VARCHAR(20)"); @@ -4929,7 +4929,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_type(cast(null as varchar))"); } - @Test public void testJsonDepth() { + @Test void testJsonDepth() { tester.setFor(SqlLibraryOperators.JSON_DEPTH); tester.checkString("json_depth('1')", "1", "INTEGER"); @@ -4963,7 +4963,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_depth(cast(null as varchar))"); } - @Test public void testJsonLength() { + @Test void testJsonLength() { // no path context tester.checkString("json_length('{}')", "0", "INTEGER"); @@ -5019,7 +5019,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_length(cast(null as varchar))"); } - @Test public void testJsonKeys() { + @Test void testJsonKeys() { // no path context tester.checkString("json_keys('{}')", "[]", "VARCHAR(2000)"); @@ -5075,7 +5075,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_keys(cast(null as varchar))"); } - @Test public void testJsonRemove() { + @Test void testJsonRemove() { tester.checkString("json_remove('{\"foo\":100}', '$.foo')", "{}", "VARCHAR(2000)"); tester.checkString("json_remove('{\"foo\":100, \"foo1\":100}', '$.foo')", @@ -5096,7 +5096,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("json_remove(cast(null as varchar), '$')"); } - @Test public void testJsonObject() { + @Test void testJsonObject() { tester.checkString("json_object()", "{}", "VARCHAR(2000) NOT NULL"); tester.checkString("json_object('foo': 'bar')", "{\"foo\":\"bar\"}", "VARCHAR(2000) NOT NULL"); @@ -5116,7 +5116,7 @@ private void checkNullOperand(SqlTester tester, String op) { "{\"foo\":{\"foo\":\"bar\"}}", "VARCHAR(2000) NOT NULL"); } - @Test public void testJsonObjectAgg() { + @Test void testJsonObjectAgg() { checkAggType(tester, "json_objectagg('foo': 'bar')", "VARCHAR(2000) NOT NULL"); checkAggType(tester, "json_objectagg('foo': null)", "VARCHAR(2000) NOT NULL"); checkAggType(tester, "json_objectagg(100: 'bar')", "VARCHAR(2000) NOT NULL"); @@ -5141,7 +5141,7 @@ private void checkNullOperand(SqlTester tester, String op) { 0.0D); } - @Test public void testJsonValueExpressionOperator() { + @Test void testJsonValueExpressionOperator() { tester.checkScalar("'{}' format json", "{}", "ANY NOT NULL"); tester.checkScalar("'[1, 2, 3]' format json", "[1, 2, 3]", "ANY NOT NULL"); tester.checkNull("cast(null as varchar) format json"); @@ -5149,7 +5149,7 @@ private void checkNullOperand(SqlTester tester, String op) { strictTester.checkFails("^null^ format json", "(?s).*Illegal use of .NULL.*", false); } - @Test public void testJsonArray() { + @Test void testJsonArray() { tester.checkString("json_array()", "[]", "VARCHAR(2000) NOT NULL"); tester.checkString("json_array('foo')", "[\"foo\"]", "VARCHAR(2000) NOT NULL"); @@ -5169,7 +5169,7 @@ private void checkNullOperand(SqlTester tester, String op) { "[[\"foo\"]]", "VARCHAR(2000) NOT NULL"); } - @Test public void testJsonArrayAgg() { + @Test void testJsonArrayAgg() { checkAggType(tester, "json_arrayagg('foo')", "VARCHAR(2000) NOT NULL"); checkAggType(tester, "json_arrayagg(null)", "VARCHAR(2000) NOT NULL"); final String[] values = { @@ -5191,7 +5191,7 @@ private void checkNullOperand(SqlTester tester, String op) { 0.0D); } - @Test public void testJsonPredicate() { + @Test void testJsonPredicate() { tester.checkBoolean("'{}' is json value", true); tester.checkBoolean("'{]' is json value", false); tester.checkBoolean("'{}' is json object", true); @@ -5210,7 +5210,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkBoolean("'[]' is not json scalar", true); } - @Test public void testCompress() { + @Test void testCompress() { SqlTester sqlTester = tester(SqlLibrary.MYSQL); sqlTester.checkNull("COMPRESS(NULL)"); sqlTester.checkString("COMPRESS('')", "", @@ -5227,7 +5227,7 @@ private void checkNullOperand(SqlTester tester, String op) { "07000000789c4bad48cc2dc84905000bc002ed", "VARBINARY NOT NULL"); } - @Test public void testExtractValue() { + @Test void testExtractValue() { SqlTester mySqlTester = tester(SqlLibrary.MYSQL); mySqlTester.checkNull("ExtractValue(NULL, '//b')"); mySqlTester.checkNull("ExtractValue('', NULL)"); @@ -5250,7 +5250,7 @@ private void checkNullOperand(SqlTester tester, String op) { "1", "VARCHAR(2000)"); } - @Test public void testXmlTransform() { + @Test void testXmlTransform() { SqlTester sqlTester = tester(SqlLibrary.ORACLE); sqlTester.checkNull("XMLTRANSFORM('', NULL)"); sqlTester.checkNull("XMLTRANSFORM(NULL,'')"); @@ -5289,7 +5289,7 @@ private void checkNullOperand(SqlTester tester, String op) { "VARCHAR(2000)"); } - @Test public void testExtractXml() { + @Test void testExtractXml() { SqlTester sqlTester = tester(SqlLibrary.ORACLE); sqlTester.checkFails("\"EXTRACT\"('', '<','a')", @@ -5325,7 +5325,7 @@ private void checkNullOperand(SqlTester tester, String op) { "VARCHAR(2000)"); } - @Test public void testExistsNode() { + @Test void testExistsNode() { SqlTester sqlTester = tester(SqlLibrary.ORACLE); sqlTester.checkFails("EXISTSNODE('', '<','a')", @@ -5376,7 +5376,7 @@ private void checkNullOperand(SqlTester tester, String op) { "INTEGER"); } - @Test public void testLowerFunc() { + @Test void testLowerFunc() { tester.setFor(SqlStdOperatorTable.LOWER); // SQL:2003 6.29.8 The type of lower is the type of its argument @@ -5387,7 +5387,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("lower(cast(null as varchar(1)))"); } - @Test public void testInitcapFunc() { + @Test void testInitcapFunc() { // Note: the initcap function is an Oracle defined function and is not // defined in the SQL:2003 standard // todo: implement in fennel @@ -5410,7 +5410,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkType("initcap(cast(null as date))", "VARCHAR"); } - @Test public void testPowerFunc() { + @Test void testPowerFunc() { tester.setFor(SqlStdOperatorTable.POWER); tester.checkScalarApprox( "power(2,-2)", @@ -5427,7 +5427,7 @@ private void checkNullOperand(SqlTester tester, String op) { false); } - @Test public void testSqrtFunc() { + @Test void testSqrtFunc() { tester.setFor( SqlStdOperatorTable.SQRT, SqlTester.VmName.EXPAND); tester.checkType("sqrt(2)", "DOUBLE NOT NULL"); @@ -5453,7 +5453,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("sqrt(cast(null as double))"); } - @Test public void testExpFunc() { + @Test void testExpFunc() { tester.setFor(SqlStdOperatorTable.EXP, VM_FENNEL); tester.checkScalarApprox( "exp(2)", "DOUBLE NOT NULL", 7.389056, 0.000001); @@ -5466,7 +5466,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("exp(cast(null as double))"); } - @Test public void testModFunc() { + @Test void testModFunc() { tester.setFor(SqlStdOperatorTable.MOD); tester.checkScalarExact("mod(4,2)", "0"); tester.checkScalarExact("mod(8,5)", "3"); @@ -5495,7 +5495,7 @@ private void checkNullOperand(SqlTester tester, String op) { "-2"); } - @Test public void testModFuncNull() { + @Test void testModFuncNull() { tester.checkNull("mod(cast(null as integer),2)"); tester.checkNull("mod(4,cast(null as tinyint))"); if (!DECIMAL) { @@ -5504,7 +5504,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("mod(4,cast(null as decimal(12,0)))"); } - @Test public void testModFuncDivByZero() { + @Test void testModFuncDivByZero() { // The extra CASE expression is to fool Janino. It does constant // reduction and will throw the divide by zero exception while // compiling the expression. The test frame work would then issue @@ -5515,7 +5515,7 @@ private void checkNullOperand(SqlTester tester, String op) { "mod(3,case 'a' when 'a' then 0 end)", DIVISION_BY_ZERO_MESSAGE, true); } - @Test public void testLnFunc() { + @Test void testLnFunc() { tester.setFor(SqlStdOperatorTable.LN); tester.checkScalarApprox( "ln(2.71828)", @@ -5530,7 +5530,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("ln(cast(null as tinyint))"); } - @Test public void testLogFunc() { + @Test void testLogFunc() { tester.setFor(SqlStdOperatorTable.LOG10); tester.checkScalarApprox( "log10(10)", @@ -5560,7 +5560,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("log10(cast(null as real))"); } - @Test public void testRandFunc() { + @Test void testRandFunc() { tester.setFor(SqlStdOperatorTable.RAND); tester.checkFails("^rand^", "Column 'RAND' not found in any table", false); for (int i = 0; i < 100; i++) { @@ -5569,13 +5569,13 @@ private void checkNullOperand(SqlTester tester, String op) { } } - @Test public void testRandSeedFunc() { + @Test void testRandSeedFunc() { tester.setFor(SqlStdOperatorTable.RAND); tester.checkScalarApprox("rand(1)", "DOUBLE NOT NULL", 0.6016, 0.0001); tester.checkScalarApprox("rand(2)", "DOUBLE NOT NULL", 0.4728, 0.0001); } - @Test public void testRandIntegerFunc() { + @Test void testRandIntegerFunc() { tester.setFor(SqlStdOperatorTable.RAND_INTEGER); for (int i = 0; i < 100; i++) { // Result must always be between 0 and 10, inclusive. @@ -5584,13 +5584,13 @@ private void checkNullOperand(SqlTester tester, String op) { } } - @Test public void testRandIntegerSeedFunc() { + @Test void testRandIntegerSeedFunc() { tester.setFor(SqlStdOperatorTable.RAND_INTEGER); tester.checkScalar("rand_integer(1, 11)", 4, "INTEGER NOT NULL"); tester.checkScalar("rand_integer(2, 11)", 1, "INTEGER NOT NULL"); } - @Test public void testAbsFunc() { + @Test void testAbsFunc() { tester.setFor(SqlStdOperatorTable.ABS); tester.checkScalarExact("abs(-1)", "1"); tester.checkScalarExact( @@ -5633,7 +5633,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("abs(cast(null as double))"); } - @Test public void testAbsFuncIntervals() { + @Test void testAbsFuncIntervals() { tester.checkScalar( "abs(interval '-2' day)", "+2", @@ -5645,7 +5645,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("abs(cast(null as interval hour))"); } - @Test public void testAcosFunc() { + @Test void testAcosFunc() { tester.setFor( SqlStdOperatorTable.ACOS); tester.checkType("acos(0)", "DOUBLE NOT NULL"); @@ -5671,7 +5671,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("acos(cast(null as double))"); } - @Test public void testAsinFunc() { + @Test void testAsinFunc() { tester.setFor( SqlStdOperatorTable.ASIN); tester.checkType("asin(0)", "DOUBLE NOT NULL"); @@ -5697,7 +5697,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("asin(cast(null as double))"); } - @Test public void testAtanFunc() { + @Test void testAtanFunc() { tester.setFor( SqlStdOperatorTable.ATAN); tester.checkType("atan(2)", "DOUBLE NOT NULL"); @@ -5723,7 +5723,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("atan(cast(null as double))"); } - @Test public void testAtan2Func() { + @Test void testAtan2Func() { tester.setFor( SqlStdOperatorTable.ATAN2); tester.checkType("atan2(2, -2)", "DOUBLE NOT NULL"); @@ -5753,7 +5753,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("atan2(1, cast(null as double))"); } - @Test public void testCbrtFunc() { + @Test void testCbrtFunc() { tester.setFor( SqlStdOperatorTable.CBRT); tester.checkType("cbrt(1)", "DOUBLE NOT NULL"); @@ -5781,7 +5781,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("cbrt(cast(null as double))"); } - @Test public void testCosFunc() { + @Test void testCosFunc() { tester.setFor( SqlStdOperatorTable.COS); tester.checkType("cos(1)", "DOUBLE NOT NULL"); @@ -5807,7 +5807,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("cos(cast(null as double))"); } - @Test public void testCoshFunc() { + @Test void testCoshFunc() { SqlTester tester = tester(SqlLibrary.ORACLE); tester.checkType("cosh(1)", "DOUBLE NOT NULL"); tester.checkType("cosh(cast(1 as float))", "DOUBLE NOT NULL"); @@ -5832,7 +5832,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("cosh(cast(null as double))"); } - @Test public void testCotFunc() { + @Test void testCotFunc() { tester.setFor( SqlStdOperatorTable.COT); tester.checkType("cot(1)", "DOUBLE NOT NULL"); @@ -5858,7 +5858,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("cot(cast(null as double))"); } - @Test public void testDegreesFunc() { + @Test void testDegreesFunc() { tester.setFor( SqlStdOperatorTable.DEGREES); tester.checkType("degrees(1)", "DOUBLE NOT NULL"); @@ -5884,7 +5884,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("degrees(cast(null as double))"); } - @Test public void testPiFunc() { + @Test void testPiFunc() { tester.setFor(SqlStdOperatorTable.PI); tester.checkScalarApprox("PI", "DOUBLE NOT NULL", 3.1415d, 0.0001d); tester.checkFails("^PI()^", @@ -5895,7 +5895,7 @@ private void checkNullOperand(SqlTester tester, String op) { "PI operator should not be identified as dynamic function"); } - @Test public void testRadiansFunc() { + @Test void testRadiansFunc() { tester.setFor( SqlStdOperatorTable.RADIANS); tester.checkType("radians(42)", "DOUBLE NOT NULL"); @@ -5922,7 +5922,7 @@ private void checkNullOperand(SqlTester tester, String op) { } - @Test public void testRoundFunc() { + @Test void testRoundFunc() { tester.setFor( SqlStdOperatorTable.ROUND); tester.checkType("round(42, -1)", "INTEGER NOT NULL"); @@ -5964,7 +5964,7 @@ private void checkNullOperand(SqlTester tester, String op) { "DECIMAL(5, 3) NOT NULL"); } - @Test public void testSignFunc() { + @Test void testSignFunc() { tester.setFor( SqlStdOperatorTable.SIGN); tester.checkType("sign(1)", "INTEGER NOT NULL"); @@ -5992,7 +5992,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("sign(cast(null as double))"); } - @Test public void testSinFunc() { + @Test void testSinFunc() { tester.setFor( SqlStdOperatorTable.SIN); tester.checkType("sin(1)", "DOUBLE NOT NULL"); @@ -6018,7 +6018,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("sin(cast(null as double))"); } - @Test public void testSinhFunc() { + @Test void testSinhFunc() { SqlTester tester = tester(SqlLibrary.ORACLE); tester.checkType("sinh(1)", "DOUBLE NOT NULL"); tester.checkType("sinh(cast(1 as float))", "DOUBLE NOT NULL"); @@ -6043,7 +6043,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("sinh(cast(null as double))"); } - @Test public void testTanFunc() { + @Test void testTanFunc() { tester.setFor( SqlStdOperatorTable.TAN); tester.checkType("tan(1)", "DOUBLE NOT NULL"); @@ -6069,7 +6069,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("tan(cast(null as double))"); } - @Test public void testTanhFunc() { + @Test void testTanhFunc() { SqlTester tester = tester(SqlLibrary.ORACLE); tester.checkType("tanh(1)", "DOUBLE NOT NULL"); tester.checkType("tanh(cast(1 as float))", "DOUBLE NOT NULL"); @@ -6094,7 +6094,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("tanh(cast(null as double))"); } - @Test public void testTruncateFunc() { + @Test void testTruncateFunc() { tester.setFor( SqlStdOperatorTable.TRUNCATE); tester.checkType("truncate(42, -1)", "INTEGER NOT NULL"); @@ -6135,7 +6135,7 @@ private void checkNullOperand(SqlTester tester, String op) { tester.checkNull("truncate(cast(null as double))"); } - @Test public void testNullifFunc() { + @Test void testNullifFunc() { tester.setFor(SqlStdOperatorTable.NULLIF, VM_EXPAND); tester.checkNull("nullif(1,1)"); tester.checkScalarExact( @@ -6188,7 +6188,7 @@ private void checkNullOperand(SqlTester tester, String op) { false); } - @Test public void testNullIfOperatorIntervals() { + @Test void testNullIfOperatorIntervals() { tester.checkScalar( "nullif(interval '2' month, interval '3' year)", "+2", @@ -6201,7 +6201,7 @@ private void checkNullOperand(SqlTester tester, String op) { "nullif(interval '3' day, interval '3' day)"); } - @Test public void testCoalesceFunc() { + @Test void testCoalesceFunc() { tester.setFor(SqlStdOperatorTable.COALESCE, VM_EXPAND); tester.checkString("coalesce('a','b')", "a", "CHAR(1) NOT NULL"); tester.checkScalarExact("coalesce(null,null,3)", "3"); @@ -6213,40 +6213,40 @@ private void checkNullOperand(SqlTester tester, String op) { "INTEGER"); } - @Test public void testUserFunc() { + @Test void testUserFunc() { tester.setFor(SqlStdOperatorTable.USER, VM_FENNEL); tester.checkString("USER", "sa", "VARCHAR(2000) NOT NULL"); } - @Test public void testCurrentUserFunc() { + @Test void testCurrentUserFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_USER, VM_FENNEL); tester.checkString("CURRENT_USER", "sa", "VARCHAR(2000) NOT NULL"); } - @Test public void testSessionUserFunc() { + @Test void testSessionUserFunc() { tester.setFor(SqlStdOperatorTable.SESSION_USER, VM_FENNEL); tester.checkString("SESSION_USER", "sa", "VARCHAR(2000) NOT NULL"); } - @Test public void testSystemUserFunc() { + @Test void testSystemUserFunc() { tester.setFor(SqlStdOperatorTable.SYSTEM_USER, VM_FENNEL); String user = System.getProperty("user.name"); // e.g. "jhyde" tester.checkString("SYSTEM_USER", user, "VARCHAR(2000) NOT NULL"); } - @Test public void testCurrentPathFunc() { + @Test void testCurrentPathFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_PATH, VM_FENNEL); tester.checkString("CURRENT_PATH", "", "VARCHAR(2000) NOT NULL"); } - @Test public void testCurrentRoleFunc() { + @Test void testCurrentRoleFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_ROLE, VM_FENNEL); // By default, the CURRENT_ROLE function returns // the empty string because a role has to be set explicitly. tester.checkString("CURRENT_ROLE", "", "VARCHAR(2000) NOT NULL"); } - @Test public void testCurrentCatalogFunc() { + @Test void testCurrentCatalogFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_CATALOG, VM_FENNEL); // By default, the CURRENT_CATALOG function returns // the empty string because a catalog has to be set explicitly. @@ -6254,11 +6254,11 @@ private void checkNullOperand(SqlTester tester, String op) { } @Tag("slow") - @Test public void testLocalTimeFuncWithCurrentTime() { + @Test void testLocalTimeFuncWithCurrentTime() { testLocalTimeFunc(currentTimeString(LOCAL_TZ)); } - @Test public void testLocalTimeFuncWithFixedTime() { + @Test void testLocalTimeFuncWithFixedTime() { testLocalTimeFunc(fixedTimeString(LOCAL_TZ)); } @@ -6287,11 +6287,11 @@ private void testLocalTimeFunc(Pair pair) { } @Tag("slow") - @Test public void testLocalTimestampFuncWithCurrentTime() { + @Test void testLocalTimestampFuncWithCurrentTime() { testLocalTimestampFunc(currentTimeString(LOCAL_TZ)); } - @Test public void testLocalTimestampFuncWithFixedTime() { + @Test void testLocalTimestampFuncWithFixedTime() { testLocalTimestampFunc(fixedTimeString(LOCAL_TZ)); } @@ -6327,11 +6327,11 @@ private void testLocalTimestampFunc(Pair pair) { } @Tag("slow") - @Test public void testCurrentTimeFuncWithCurrentTime() { + @Test void testCurrentTimeFuncWithCurrentTime() { testCurrentTimeFunc(currentTimeString(CURRENT_TZ)); } - @Test public void testCurrentTimeFuncWithFixedTime() { + @Test void testCurrentTimeFuncWithFixedTime() { testCurrentTimeFunc(fixedTimeString(CURRENT_TZ)); } @@ -6359,11 +6359,11 @@ private void testCurrentTimeFunc(Pair pair) { } @Tag("slow") - @Test public void testCurrentTimestampFuncWithCurrentTime() { + @Test void testCurrentTimestampFuncWithCurrentTime() { testCurrentTimestampFunc(currentTimeString(CURRENT_TZ)); } - @Test public void testCurrentTimestampFuncWithFixedTime() { + @Test void testCurrentTimestampFuncWithFixedTime() { testCurrentTimestampFunc(fixedTimeString(CURRENT_TZ)); } @@ -6424,11 +6424,11 @@ private static String toTimeString(TimeZone tz, Calendar cal) { } @Tag("slow") - @Test public void testCurrentDateFuncWithCurrentTime() { + @Test void testCurrentDateFuncWithCurrentTime() { testCurrentDateFunc(currentTimeString(LOCAL_TZ)); } - @Test public void testCurrentDateFuncWithFixedTime() { + @Test void testCurrentDateFuncWithFixedTime() { testCurrentDateFunc(fixedTimeString(LOCAL_TZ)); } @@ -6485,7 +6485,7 @@ private void testCurrentDateFunc(Pair pair) { } } - @Test public void testLastDayFunc() { + @Test void testLastDayFunc() { tester.setFor(SqlStdOperatorTable.LAST_DAY); tester.checkScalar("last_day(DATE '2019-02-10')", "2019-02-28", "DATE NOT NULL"); @@ -6562,7 +6562,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("last_day(cast(null as timestamp))"); } - @Test public void testSubstringFunction() { + @Test void testSubstringFunction() { tester.setFor(SqlStdOperatorTable.SUBSTRING); tester.checkString( "substring('abc' from 1 for 2)", @@ -6640,7 +6640,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("substring(cast(null as varchar(1)),1,2)"); } - @Test public void testTrimFunc() { + @Test void testTrimFunc() { tester.setFor(SqlStdOperatorTable.TRIM); // SQL:2003 6.29.11 Trimming a CHAR yields a VARCHAR @@ -6686,21 +6686,21 @@ private void testCurrentDateFunc(Pair pair) { "trim('eh' from 'hehe__hehe')", "__", "VARCHAR(10) NOT NULL"); } - @Test public void testRtrimFunc() { + @Test void testRtrimFunc() { tester.setFor(SqlLibraryOperators.RTRIM); final SqlTester tester1 = oracleTester(); tester1.checkString("rtrim(' aAa ')", " aAa", "VARCHAR(6) NOT NULL"); tester1.checkNull("rtrim(CAST(NULL AS VARCHAR(6)))"); } - @Test public void testLtrimFunc() { + @Test void testLtrimFunc() { tester.setFor(SqlLibraryOperators.LTRIM); final SqlTester tester1 = oracleTester(); tester1.checkString("ltrim(' aAa ')", "aAa ", "VARCHAR(6) NOT NULL"); tester1.checkNull("ltrim(CAST(NULL AS VARCHAR(6)))"); } - @Test public void testGreatestFunc() { + @Test void testGreatestFunc() { tester.setFor(SqlLibraryOperators.GREATEST); final SqlTester tester1 = oracleTester(); tester1.checkString("greatest('on', 'earth')", "on ", "CHAR(5) NOT NULL"); @@ -6715,7 +6715,7 @@ private void testCurrentDateFunc(Pair pair) { "VARCHAR(5) NOT NULL"); } - @Test public void testLeastFunc() { + @Test void testLeastFunc() { tester.setFor(SqlLibraryOperators.LEAST); final SqlTester tester1 = oracleTester(); tester1.checkString("least('on', 'earth')", "earth", "CHAR(5) NOT NULL"); @@ -6730,7 +6730,7 @@ private void testCurrentDateFunc(Pair pair) { "VARCHAR(5) NOT NULL"); } - @Test public void testNvlFunc() { + @Test void testNvlFunc() { tester.setFor(SqlLibraryOperators.NVL); final SqlTester tester1 = oracleTester(); tester1.checkScalar("nvl(1, 2)", "1", "INTEGER NOT NULL"); @@ -6758,7 +6758,7 @@ private void testCurrentDateFunc(Pair pair) { "nvl(CAST(NULL AS VARCHAR(6)), cast(NULL AS VARCHAR(4)))"); } - @Test public void testDecodeFunc() { + @Test void testDecodeFunc() { tester.setFor(SqlLibraryOperators.DECODE); final SqlTester tester1 = oracleTester(); tester1.checkScalar("decode(0, 0, 'a', 1, 'b', 2, 'c')", "a", "CHAR(1)"); @@ -6779,7 +6779,7 @@ private void testCurrentDateFunc(Pair pair) { "CHAR(1) NOT NULL"); } - @Test public void testWindow() { + @Test void testWindow() { if (!enable) { return; } @@ -6790,7 +6790,7 @@ private void testCurrentDateFunc(Pair pair) { 0); } - @Test public void testElementFunc() { + @Test void testElementFunc() { tester.setFor( SqlStdOperatorTable.ELEMENT, VM_FENNEL, @@ -6802,7 +6802,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("element(multiset[cast(null as integer)])"); } - @Test public void testCardinalityFunc() { + @Test void testCardinalityFunc() { tester.setFor( SqlStdOperatorTable.CARDINALITY, VM_FENNEL, @@ -6823,7 +6823,7 @@ private void testCurrentDateFunc(Pair pair) { "cardinality(map['foo', 1, 'bar', 2])", "2"); } - @Test public void testMemberOfOperator() { + @Test void testMemberOfOperator() { tester.setFor( SqlStdOperatorTable.MEMBER_OF, VM_FENNEL, @@ -6842,7 +6842,7 @@ private void testCurrentDateFunc(Pair pair) { "1.1 member of multiset[cast(null as double)]", Boolean.FALSE); } - @Test public void testMultisetUnionOperator() { + @Test void testMultisetUnionOperator() { tester.setFor( SqlStdOperatorTable.MULTISET_UNION_DISTINCT, VM_FENNEL, @@ -6891,7 +6891,7 @@ private void testCurrentDateFunc(Pair pair) { "BOOLEAN MULTISET NOT NULL"); } - @Test public void testMultisetUnionAllOperator() { + @Test void testMultisetUnionAllOperator() { tester.setFor( SqlStdOperatorTable.MULTISET_UNION, VM_FENNEL, @@ -6930,7 +6930,7 @@ private void testCurrentDateFunc(Pair pair) { "BOOLEAN MULTISET NOT NULL"); } - @Test public void testSubMultisetOfOperator() { + @Test void testSubMultisetOfOperator() { tester.setFor( SqlStdOperatorTable.SUBMULTISET_OF, VM_FENNEL, @@ -6947,7 +6947,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkBoolean("multiset['q', 'a'] submultiset of multiset['a', 'q']", Boolean.TRUE); } - @Test public void testNotSubMultisetOfOperator() { + @Test void testNotSubMultisetOfOperator() { tester.setFor( SqlStdOperatorTable.NOT_SUBMULTISET_OF, VM_FENNEL, @@ -6965,7 +6965,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkBoolean("multiset['q', 'a'] not submultiset of multiset['a', 'q']", Boolean.FALSE); } - @Test public void testCollectFunc() { + @Test void testCollectFunc() { tester.setFor(SqlStdOperatorTable.COLLECT, VM_FENNEL, VM_JAVA); tester.checkFails("collect(^*^)", "Unknown identifier '\\*'", false); checkAggType(tester, "collect(1)", "INTEGER NOT NULL MULTISET NOT NULL"); @@ -6996,7 +6996,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkAgg("collect(DISTINCT x)", values, 2, (double) 0); } - @Test public void testListAggFunc() { + @Test void testListAggFunc() { tester.setFor(SqlStdOperatorTable.LISTAGG, VM_FENNEL, VM_JAVA); tester.checkFails("listagg(^*^)", "Unknown identifier '\\*'", false); checkAggType(tester, "listagg(12)", "VARCHAR NOT NULL"); @@ -7019,7 +7019,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkAgg("listagg(cast(x as CHAR))", values2, "0,1,2,3", (double) 0); } - @Test public void testFusionFunc() { + @Test void testFusionFunc() { tester.setFor(SqlStdOperatorTable.FUSION, VM_FENNEL, VM_JAVA); tester.checkFails("fusion(^*^)", "Unknown identifier '\\*'", false); checkAggType(tester, "fusion(MULTISET[1,2,3])", "INTEGER NOT NULL MULTISET NOT NULL"); @@ -7031,7 +7031,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkAgg("fusion(x)", values2, "[0, 1, 1, 2]", 0); } - @Test public void testIntersectionFunc() { + @Test void testIntersectionFunc() { tester.setFor(SqlStdOperatorTable.INTERSECTION, VM_FENNEL, VM_JAVA); tester.checkFails("intersection(^*^)", "Unknown identifier '\\*'", false); checkAggType(tester, "intersection(MULTISET[1,2,3])", "INTEGER NOT NULL MULTISET NOT NULL"); @@ -7045,7 +7045,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkAgg("intersection(x)", values3, "[0, 1, 1]", 0); } - @Test public void testYear() { + @Test void testYear() { tester.setFor( SqlStdOperatorTable.YEAR, VM_FENNEL, @@ -7058,7 +7058,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("year(cast(null as date))"); } - @Test public void testQuarter() { + @Test void testQuarter() { tester.setFor( SqlStdOperatorTable.QUARTER, VM_FENNEL, @@ -7115,7 +7115,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("quarter(cast(null as date))"); } - @Test public void testMonth() { + @Test void testMonth() { tester.setFor( SqlStdOperatorTable.MONTH, VM_FENNEL, @@ -7128,7 +7128,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("month(cast(null as date))"); } - @Test public void testWeek() { + @Test void testWeek() { tester.setFor( SqlStdOperatorTable.WEEK, VM_FENNEL, @@ -7146,7 +7146,7 @@ private void testCurrentDateFunc(Pair pair) { } } - @Test public void testDayOfYear() { + @Test void testDayOfYear() { tester.setFor( SqlStdOperatorTable.DAYOFYEAR, VM_FENNEL, @@ -7164,7 +7164,7 @@ private void testCurrentDateFunc(Pair pair) { } } - @Test public void testDayOfMonth() { + @Test void testDayOfMonth() { tester.setFor( SqlStdOperatorTable.DAYOFMONTH, VM_FENNEL, @@ -7176,7 +7176,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("dayofmonth(cast(null as date))"); } - @Test public void testDayOfWeek() { + @Test void testDayOfWeek() { tester.setFor( SqlStdOperatorTable.DAYOFWEEK, VM_FENNEL, @@ -7193,7 +7193,7 @@ private void testCurrentDateFunc(Pair pair) { } } - @Test public void testHour() { + @Test void testHour() { tester.setFor( SqlStdOperatorTable.HOUR, VM_FENNEL, @@ -7206,7 +7206,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("hour(cast(null as timestamp))"); } - @Test public void testMinute() { + @Test void testMinute() { tester.setFor( SqlStdOperatorTable.MINUTE, VM_FENNEL, @@ -7219,7 +7219,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("minute(cast(null as timestamp))"); } - @Test public void testSecond() { + @Test void testSecond() { tester.setFor( SqlStdOperatorTable.SECOND, VM_FENNEL, @@ -7232,7 +7232,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("second(cast(null as timestamp))"); } - @Test public void testExtractIntervalYearMonth() { + @Test void testExtractIntervalYearMonth() { tester.setFor( SqlStdOperatorTable.EXTRACT, VM_FENNEL, @@ -7327,7 +7327,7 @@ private void testCurrentDateFunc(Pair pair) { "BIGINT NOT NULL"); } - @Test public void testExtractIntervalDayTime() { + @Test void testExtractIntervalDayTime() { tester.setFor( SqlStdOperatorTable.EXTRACT, VM_FENNEL, @@ -7427,7 +7427,7 @@ private void testCurrentDateFunc(Pair pair) { false); } - @Test public void testExtractDate() { + @Test void testExtractDate() { tester.setFor( SqlStdOperatorTable.EXTRACT, VM_FENNEL, @@ -7570,7 +7570,7 @@ private void testCurrentDateFunc(Pair pair) { "3", "BIGINT NOT NULL"); } - @Test public void testExtractTimestamp() { + @Test void testExtractTimestamp() { tester.setFor( SqlStdOperatorTable.EXTRACT, VM_FENNEL, @@ -7688,7 +7688,7 @@ private void testCurrentDateFunc(Pair pair) { "BIGINT NOT NULL"); } - @Test public void testExtractFunc() { + @Test void testExtractFunc() { tester.setFor( SqlStdOperatorTable.EXTRACT, VM_FENNEL, @@ -7736,7 +7736,7 @@ private void testCurrentDateFunc(Pair pair) { "extract(month from cast(null as interval year))"); } - @Test public void testExtractFuncFromDateTime() { + @Test void testExtractFuncFromDateTime() { tester.setFor( SqlStdOperatorTable.EXTRACT, VM_FENNEL, @@ -7791,7 +7791,7 @@ private void testCurrentDateFunc(Pair pair) { "extract(nanosecond from cast(null as time))"); } - @Test public void testExtractWithDatesBeforeUnixEpoch() { + @Test void testExtractWithDatesBeforeUnixEpoch() { tester.checkScalar( "extract(millisecond from TIMESTAMP '1969-12-31 21:13:17.357')", @@ -7864,7 +7864,7 @@ private void testCurrentDateFunc(Pair pair) { "BIGINT NOT NULL"); } - @Test public void testArrayValueConstructor() { + @Test void testArrayValueConstructor() { tester.setFor(SqlStdOperatorTable.ARRAY_VALUE_CONSTRUCTOR); tester.checkScalar( "Array['foo', 'bar']", @@ -7877,7 +7877,7 @@ private void testCurrentDateFunc(Pair pair) { "^Array[]^", "Require at least 1 argument", false); } - @Test public void testItemOp() { + @Test void testItemOp() { tester.setFor(SqlStdOperatorTable.ITEM); tester.checkScalar("ARRAY ['foo', 'bar'][1]", "foo", "CHAR(3)"); tester.checkScalar("ARRAY ['foo', 'bar'][0]", null, "CHAR(3)"); @@ -7911,7 +7911,7 @@ private void testCurrentDateFunc(Pair pair) { "ANY"); } - @Test public void testMapValueConstructor() { + @Test void testMapValueConstructor() { tester.setFor(SqlStdOperatorTable.MAP_VALUE_CONSTRUCTOR, VM_JAVA); tester.checkFails( @@ -7938,7 +7938,7 @@ private void testCurrentDateFunc(Pair pair) { "{washington=1, obama=44}"); } - @Test public void testCeilFunc() { + @Test void testCeilFunc() { tester.setFor(SqlStdOperatorTable.CEIL, VM_FENNEL); tester.checkScalarApprox("ceil(10.1e0)", "DOUBLE NOT NULL", 11, 0); tester.checkScalarApprox("ceil(cast(-11.2e0 as real))", "REAL NOT NULL", @@ -7952,7 +7952,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("ceiling(cast(null as double))"); } - @Test public void testCeilFuncInterval() { + @Test void testCeilFuncInterval() { if (!enable) { return; } @@ -7976,7 +7976,7 @@ private void testCurrentDateFunc(Pair pair) { "ceil(cast(null as interval year))"); } - @Test public void testFloorFunc() { + @Test void testFloorFunc() { tester.setFor(SqlStdOperatorTable.FLOOR, VM_FENNEL); tester.checkScalarApprox("floor(2.5e0)", "DOUBLE NOT NULL", 2, 0); tester.checkScalarApprox("floor(cast(-1.2e0 as real))", "REAL NOT NULL", -2, @@ -7990,7 +7990,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("floor(cast(null as real))"); } - @Test public void testFloorFuncDateTime() { + @Test void testFloorFuncDateTime() { strictTester.checkFails("^floor('12:34:56')^", "Cannot apply 'FLOOR' to arguments of type 'FLOOR\\(\\)'\\. Supported form\\(s\\): 'FLOOR\\(\\)'\n" + "'FLOOR\\(\\)'\n" @@ -8027,7 +8027,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("floor(cast(null as date) to month)"); } - @Test public void testCeilFuncDateTime() { + @Test void testCeilFuncDateTime() { strictTester.checkFails("^ceil('12:34:56')^", "Cannot apply 'CEIL' to arguments of type 'CEIL\\(\\)'\\. Supported form\\(s\\): 'CEIL\\(\\)'\n" + "'CEIL\\(\\)'\n" @@ -8075,7 +8075,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkNull("ceiling(cast(null as timestamp) to month)"); } - @Test public void testFloorFuncInterval() { + @Test void testFloorFuncInterval() { if (!enable) { return; } @@ -8131,7 +8131,7 @@ private void testCurrentDateFunc(Pair pair) { "floor(cast(null as interval year))"); } - @Test public void testTimestampAdd() { + @Test void testTimestampAdd() { tester.setFor(SqlStdOperatorTable.TIMESTAMP_ADD); tester.checkScalar( "timestampadd(MICROSECOND, 2000000, timestamp '2016-02-24 12:42:25')", @@ -8232,7 +8232,7 @@ private void testCurrentDateFunc(Pair pair) { "23:59:59", "TIME(0) NOT NULL"); } - @Test public void testTimestampAddFractionalSeconds() { + @Test void testTimestampAddFractionalSeconds() { tester.setFor(SqlStdOperatorTable.TIMESTAMP_ADD); tester.checkType( "timestampadd(SQL_TSI_FRAC_SECOND, 2, timestamp '2016-02-24 12:42:25.000000')", @@ -8249,7 +8249,7 @@ private void testCurrentDateFunc(Pair pair) { "TIMESTAMP(3) NOT NULL"); } - @Test public void testTimestampDiff() { + @Test void testTimestampDiff() { tester.setFor(SqlStdOperatorTable.TIMESTAMP_DIFF); tester.checkScalar("timestampdiff(HOUR, " + "timestamp '2016-02-24 12:42:25', " @@ -8327,37 +8327,37 @@ private void testCurrentDateFunc(Pair pair) { "INTEGER"); } - @Test public void testDenseRankFunc() { + @Test void testDenseRankFunc() { tester.setFor( SqlStdOperatorTable.DENSE_RANK, VM_FENNEL, VM_JAVA); } - @Test public void testPercentRankFunc() { + @Test void testPercentRankFunc() { tester.setFor( SqlStdOperatorTable.PERCENT_RANK, VM_FENNEL, VM_JAVA); } - @Test public void testRankFunc() { + @Test void testRankFunc() { tester.setFor(SqlStdOperatorTable.RANK, VM_FENNEL, VM_JAVA); } - @Test public void testCumeDistFunc() { + @Test void testCumeDistFunc() { tester.setFor( SqlStdOperatorTable.CUME_DIST, VM_FENNEL, VM_JAVA); } - @Test public void testRowNumberFunc() { + @Test void testRowNumberFunc() { tester.setFor( SqlStdOperatorTable.ROW_NUMBER, VM_FENNEL, VM_JAVA); } - @Test public void testCountFunc() { + @Test void testCountFunc() { tester.setFor(SqlStdOperatorTable.COUNT, VM_EXPAND); tester.checkType("count(*)", "BIGINT NOT NULL"); tester.checkType("count('name')", "BIGINT NOT NULL"); @@ -8397,7 +8397,7 @@ private void testCurrentDateFunc(Pair pair) { tester.checkAgg("COUNT(DISTINCT 123)", stringValues, 1, (double) 0); } - @Test public void testApproxCountDistinctFunc() { + @Test void testApproxCountDistinctFunc() { tester.setFor(SqlStdOperatorTable.COUNT, VM_EXPAND); tester.checkFails("approx_count_distinct(^*^)", "Unknown identifier '\\*'", false); @@ -8442,7 +8442,7 @@ private void testCurrentDateFunc(Pair pair) { (double) 0); } - @Test public void testSumFunc() { + @Test void testSumFunc() { tester.setFor(SqlStdOperatorTable.SUM, VM_EXPAND); tester.checkFails( "sum(^*^)", "Unknown identifier '\\*'", false); @@ -8492,7 +8492,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkColumnType(AbstractSqlTester.buildQueryAgg(expr), type); } - @Test public void testAvgFunc() { + @Test void testAvgFunc() { tester.setFor(SqlStdOperatorTable.AVG, VM_EXPAND); tester.checkFails( "avg(^*^)", @@ -8519,7 +8519,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { result, 0d); } - @Test public void testCovarPopFunc() { + @Test void testCovarPopFunc() { tester.setFor(SqlStdOperatorTable.COVAR_POP, VM_EXPAND); tester.checkFails("covar_pop(^*^)", "Unknown identifier '\\*'", false); strictTester.checkFails( @@ -8538,7 +8538,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("covar_pop(x)", new String[]{}, null, 0d); } - @Test public void testCovarSampFunc() { + @Test void testCovarSampFunc() { tester.setFor(SqlStdOperatorTable.COVAR_SAMP, VM_EXPAND); tester.checkFails( "covar_samp(^*^)", @@ -8560,7 +8560,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("covar_samp(x)", new String[]{}, null, 0d); } - @Test public void testRegrSxxFunc() { + @Test void testRegrSxxFunc() { tester.setFor(SqlStdOperatorTable.REGR_SXX, VM_EXPAND); tester.checkFails( "regr_sxx(^*^)", @@ -8582,7 +8582,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("regr_sxx(x)", new String[]{}, null, 0d); } - @Test public void testRegrSyyFunc() { + @Test void testRegrSyyFunc() { tester.setFor(SqlStdOperatorTable.REGR_SYY, VM_EXPAND); tester.checkFails( "regr_syy(^*^)", @@ -8604,7 +8604,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("regr_syy(x)", new String[]{}, null, 0d); } - @Test public void testStddevPopFunc() { + @Test void testStddevPopFunc() { tester.setFor(SqlStdOperatorTable.STDDEV_POP, VM_EXPAND); tester.checkFails("stddev_pop(^*^)", "Unknown identifier '\\*'", false); strictTester.checkFails("^stddev_pop(cast(null as varchar(2)))^", @@ -8629,7 +8629,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("stddev_pop(x)", new String[]{}, null, 0d); } - @Test public void testStddevSampFunc() { + @Test void testStddevSampFunc() { tester.setFor(SqlStdOperatorTable.STDDEV_SAMP, VM_EXPAND); tester.checkFails( "stddev_samp(^*^)", @@ -8670,7 +8670,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testStddevFunc() { + @Test void testStddevFunc() { tester.setFor(SqlStdOperatorTable.STDDEV, VM_EXPAND); tester.checkFails( "stddev(^*^)", @@ -8698,7 +8698,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testVarPopFunc() { + @Test void testVarPopFunc() { tester.setFor(SqlStdOperatorTable.VAR_POP, VM_EXPAND); tester.checkFails( "var_pop(^*^)", @@ -8744,7 +8744,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testVarSampFunc() { + @Test void testVarSampFunc() { tester.setFor(SqlStdOperatorTable.VAR_SAMP, VM_EXPAND); tester.checkFails( "var_samp(^*^)", @@ -8788,7 +8788,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testVarFunc() { + @Test void testVarFunc() { tester.setFor(SqlStdOperatorTable.VARIANCE, VM_EXPAND); tester.checkFails( "variance(^*^)", @@ -8832,7 +8832,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testMinFunc() { + @Test void testMinFunc() { tester.setFor(SqlStdOperatorTable.MIN, VM_EXPAND); tester.checkFails( "min(^*^)", @@ -8875,7 +8875,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testMaxFunc() { + @Test void testMaxFunc() { tester.setFor(SqlStdOperatorTable.MAX, VM_EXPAND); tester.checkFails( "max(^*^)", @@ -8915,7 +8915,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { "max(DISTINCT x)", values, "2", 0d); } - @Test public void testLastValueFunc() { + @Test void testLastValueFunc() { tester.setFor(SqlStdOperatorTable.LAST_VALUE, VM_EXPAND); final String[] values = {"0", "CAST(null AS INTEGER)", "3", "3"}; if (!enable) { @@ -8941,7 +8941,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testFirstValueFunc() { + @Test void testFirstValueFunc() { tester.setFor(SqlStdOperatorTable.FIRST_VALUE, VM_EXPAND); final String[] values = {"0", "CAST(null AS INTEGER)", "3", "3"}; if (!enable) { @@ -8967,7 +8967,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testEveryFunc() { + @Test void testEveryFunc() { tester.setFor(SqlStdOperatorTable.EVERY, VM_EXPAND); tester.checkFails( "every(^*^)", @@ -8995,7 +8995,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testSomeAggFunc() { + @Test void testSomeAggFunc() { tester.setFor(SqlStdOperatorTable.SOME, VM_EXPAND); tester.checkFails( "some(^*^)", @@ -9024,7 +9024,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { } - @Test public void testAnyValueFunc() { + @Test void testAnyValueFunc() { tester.setFor(SqlStdOperatorTable.ANY_VALUE, VM_EXPAND); tester.checkFails( "any_value(^*^)", @@ -9067,7 +9067,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { 0d); } - @Test public void testBitAndFunc() { + @Test void testBitAndFunc() { tester.setFor(SqlStdOperatorTable.BIT_AND, VM_FENNEL, VM_JAVA); tester.checkFails("bit_and(^*^)", "Unknown identifier '\\*'", false); tester.checkType("bit_and(1)", "INTEGER"); @@ -9089,7 +9089,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("bit_and(x)", values, 2, 0); } - @Test public void testBitOrFunc() { + @Test void testBitOrFunc() { tester.setFor(SqlStdOperatorTable.BIT_OR, VM_FENNEL, VM_JAVA); tester.checkFails("bit_or(^*^)", "Unknown identifier '\\*'", false); tester.checkType("bit_or(1)", "INTEGER"); @@ -9111,7 +9111,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { tester.checkAgg("bit_or(x)", values, 3, 0); } - @Test public void testBitXorFunc() { + @Test void testBitXorFunc() { tester.setFor(SqlStdOperatorTable.BIT_XOR, VM_FENNEL, VM_JAVA); tester.checkFails("bit_xor(^*^)", "Unknown identifier '\\*'", false); tester.checkType("bit_xor(1)", "INTEGER"); @@ -9144,7 +9144,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { * precision. * */ - @Test public void testLiteralAtLimit() { + @Test void testLiteralAtLimit() { tester.setFor(SqlStdOperatorTable.CAST); if (!enable) { return; @@ -9197,7 +9197,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { * precision. * */ - @Test public void testLiteralBeyondLimit() { + @Test void testLiteralBeyondLimit() { tester.setFor(SqlStdOperatorTable.CAST); final List types = SqlLimitsTest.getTypes(tester.getValidator().getTypeFactory()); @@ -9241,7 +9241,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { } } - @Test public void testCastTruncates() { + @Test void testCastTruncates() { tester.setFor(SqlStdOperatorTable.CAST); tester.checkScalar("CAST('ABCD' AS CHAR(2))", "AB", "CHAR(2) NOT NULL"); tester.checkScalar("CAST('ABCD' AS VARCHAR(2))", "AB", @@ -9280,7 +9280,7 @@ protected void checkAggType(SqlTester tester, String expr, String type) { * validation stage and fails at runtime. */ @Disabled("Too slow and not really a unit test") @Tag("slow") - @Test public void testArgumentBounds() { + @Test void testArgumentBounds() { final SqlValidatorImpl validator = (SqlValidatorImpl) tester.getValidator(); final SqlValidatorScope scope = validator.getEmptyScope(); final RelDataTypeFactory typeFactory = validator.getTypeFactory(); diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorTest.java index b7adbecd135e..8c0c229f7ac5 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorTest.java +++ b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorTest.java @@ -23,14 +23,14 @@ * Concrete subclass of {@link SqlOperatorBaseTest} which checks against * a {@link SqlValidator}. Tests that involve execution trivially succeed. */ -public class SqlOperatorTest extends SqlOperatorBaseTest { +class SqlOperatorTest extends SqlOperatorBaseTest { private static final SqlTester DEFAULT_TESTER = (SqlTester) new SqlValidatorTestCase().getTester(); /** * Creates a SqlOperatorTest. */ - public SqlOperatorTest() { + SqlOperatorTest() { super(false, DEFAULT_TESTER); } } diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlPrettyWriterTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlPrettyWriterTest.java index f4aff8b05a4c..51b1c04f95d2 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/SqlPrettyWriterTest.java +++ b/core/src/test/java/org/apache/calcite/sql/test/SqlPrettyWriterTest.java @@ -42,7 +42,7 @@ * *

You must provide the system property "source.dir". */ -public class SqlPrettyWriterTest { +class SqlPrettyWriterTest { protected DiffRepository getDiffRepos() { return DiffRepository.lookup(SqlPrettyWriterTest.class); } @@ -177,30 +177,30 @@ private Sql expr(String sql) { // ~ Tests ---------------------------------------------------------------- - @Test public void testDefault() { + @Test void testDefault() { simple().check(); } - @Test public void testIndent8() { + @Test void testIndent8() { simple() .expectingDesc("${desc}") .withWriter(w -> w.withIndentation(8)) .check(); } - @Test public void testClausesNotOnNewLine() { + @Test void testClausesNotOnNewLine() { simple() .withWriter(w -> w.withClauseStartsLine(false)) .check(); } - @Test public void testSelectListItemsOnSeparateLines() { + @Test void testSelectListItemsOnSeparateLines() { simple() .withWriter(w -> w.withSelectListItemsOnSeparateLines(true)) .check(); } - @Test public void testSelectListNoExtraIndentFlag() { + @Test void testSelectListNoExtraIndentFlag() { simple() .withWriter(w -> w.withSelectListItemsOnSeparateLines(true) .withSelectListExtraIndentFlag(false) @@ -208,21 +208,21 @@ private Sql expr(String sql) { .check(); } - @Test public void testFold() { + @Test void testFold() { simple() .withWriter(w -> w.withLineFolding(SqlWriterConfig.LineFolding.FOLD) .withFoldLength(45)) .check(); } - @Test public void testChop() { + @Test void testChop() { simple() .withWriter(w -> w.withLineFolding(SqlWriterConfig.LineFolding.CHOP) .withFoldLength(45)) .check(); } - @Test public void testChopLeadingComma() { + @Test void testChopLeadingComma() { simple() .withWriter(w -> w.withLineFolding(SqlWriterConfig.LineFolding.CHOP) .withFoldLength(45) @@ -230,7 +230,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testLeadingComma() { + @Test void testLeadingComma() { simple() .withWriter(w -> w.withLeadingComma(true) .withSelectListItemsOnSeparateLines(true) @@ -238,7 +238,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testClauseEndsLine() { + @Test void testClauseEndsLine() { simple() .withWriter(w -> w.withClauseEndsLine(true) .withLineFolding(SqlWriterConfig.LineFolding.WIDE) @@ -246,7 +246,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testClauseEndsLineTall() { + @Test void testClauseEndsLineTall() { simple() .withWriter(w -> w.withClauseEndsLine(true) .withLineFolding(SqlWriterConfig.LineFolding.TALL) @@ -254,7 +254,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testClauseEndsLineFold() { + @Test void testClauseEndsLineFold() { simple() .withWriter(w -> w.withClauseEndsLine(true) .withLineFolding(SqlWriterConfig.LineFolding.FOLD) @@ -263,7 +263,7 @@ private Sql expr(String sql) { } /** Tests formatting a query with Looker's preferences. */ - @Test public void testLooker() { + @Test void testLooker() { simple() .withWriter(w -> w.withFoldLength(60) .withLineFolding(SqlWriterConfig.LineFolding.STEP) @@ -275,25 +275,25 @@ private Sql expr(String sql) { .check(); } - @Test public void testKeywordsLowerCase() { + @Test void testKeywordsLowerCase() { simple() .withWriter(w -> w.withKeywordsLowerCase(true)) .check(); } - @Test public void testParenthesizeAllExprs() { + @Test void testParenthesizeAllExprs() { simple() .withWriter(w -> w.withAlwaysUseParentheses(true)) .check(); } - @Test public void testOnlyQuoteIdentifiersWhichNeedIt() { + @Test void testOnlyQuoteIdentifiersWhichNeedIt() { simple() .withWriter(w -> w.withQuoteAllIdentifiers(false)) .check(); } - @Test public void testBlackSubQueryStyle() { + @Test void testBlackSubQueryStyle() { // Note that ( is at the indent, SELECT is on the same line, and ) is // below it. simple() @@ -301,20 +301,20 @@ private Sql expr(String sql) { .check(); } - @Test public void testBlackSubQueryStyleIndent0() { + @Test void testBlackSubQueryStyleIndent0() { simple() .withWriter(w -> w.withSubQueryStyle(SqlWriter.SubQueryStyle.BLACK) .withIndentation(0)) .check(); } - @Test public void testValuesNewline() { + @Test void testValuesNewline() { sql("select * from (values (1, 2), (3, 4)) as t") .withWriter(w -> w.withValuesListNewline(true)) .check(); } - @Test public void testValuesLeadingCommas() { + @Test void testValuesLeadingCommas() { sql("select * from (values (1, 2), (3, 4)) as t") .withWriter(w -> w.withValuesListNewline(true) .withLeadingComma(true)) @@ -322,12 +322,12 @@ private Sql expr(String sql) { } @Disabled("default SQL parser cannot parse DDL") - @Test public void testExplain() { + @Test void testExplain() { sql("explain select * from t") .check(); } - @Test public void testCase() { + @Test void testCase() { // Note that CASE is rewritten to the searched form. Wish it weren't // so, but that's beyond the control of the pretty-printer. // todo: indent should be 4 not 8 @@ -353,7 +353,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testCase2() { + @Test void testCase2() { final String sql = "case 1" + " when 2 + 3 then 4" + " when case a when b then c else d end then 6" @@ -366,7 +366,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testBetween() { + @Test void testBetween() { // todo: remove leading expr("x not between symmetric y and z") .expectingFormatted("`X` NOT BETWEEN SYMMETRIC `Y` AND `Z`") @@ -375,13 +375,13 @@ private Sql expr(String sql) { // space } - @Test public void testCast() { + @Test void testCast() { expr("cast(x + y as decimal(5, 10))") .expectingFormatted("CAST(`X` + `Y` AS DECIMAL(5, 10))") .check(); } - @Test public void testLiteralChain() { + @Test void testLiteralChain() { final String sql = "'x' /* comment */ 'y'\n" + " 'z' "; final String formatted = "'x'\n" @@ -390,14 +390,14 @@ private Sql expr(String sql) { expr(sql).expectingFormatted(formatted).check(); } - @Test public void testOverlaps() { + @Test void testOverlaps() { final String sql = "(x,xx) overlaps (y,yy) or x is not null"; final String formatted = "PERIOD (`X`, `XX`) OVERLAPS PERIOD (`Y`, `YY`)" + " OR `X` IS NOT NULL"; expr(sql).expectingFormatted(formatted).check(); } - @Test public void testUnion() { + @Test void testUnion() { final String sql = "select * from t " + "union select * from (" + " select * from u " @@ -408,12 +408,12 @@ private Sql expr(String sql) { .check(); } - @Test public void testMultiset() { + @Test void testMultiset() { sql("values (multiset (select * from t))") .check(); } - @Test public void testJoinComma() { + @Test void testJoinComma() { final String sql = "select *\n" + "from x, y as y1, z, (select * from a, a2 as a3),\n" + " (select * from b) as b2\n" @@ -422,25 +422,25 @@ private Sql expr(String sql) { sql(sql).check(); } - @Test public void testInnerJoin() { + @Test void testInnerJoin() { sql("select * from x inner join y on x.k=y.k") .check(); } - @Test public void testJoinTall() { + @Test void testJoinTall() { sql("select * from x inner join y on x.k=y.k left join z using (a)") .withWriter(c -> c.withLineFolding(SqlWriterConfig.LineFolding.TALL)) .check(); } - @Test public void testJoinTallClauseEndsLine() { + @Test void testJoinTallClauseEndsLine() { sql("select * from x inner join y on x.k=y.k left join z using (a)") .withWriter(c -> c.withLineFolding(SqlWriterConfig.LineFolding.TALL) .withClauseEndsLine(true)) .check(); } - @Test public void testJoinLateralSubQueryTall() { + @Test void testJoinLateralSubQueryTall() { final String sql = "select *\n" + "from (select a from customers where b < c group by d) as c,\n" + " products,\n" @@ -452,7 +452,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testWhereListItemsOnSeparateLinesOr() { + @Test void testWhereListItemsOnSeparateLinesOr() { final String sql = "select x" + " from y" + " where h is not null and i < j" @@ -465,7 +465,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testWhereListItemsOnSeparateLinesAnd() { + @Test void testWhereListItemsOnSeparateLinesAnd() { final String sql = "select x" + " from y" + " where h is not null and (i < j" @@ -480,7 +480,7 @@ private Sql expr(String sql) { /** As {@link #testWhereListItemsOnSeparateLinesAnd()}, but * with {@link SqlWriterConfig#clauseEndsLine ClauseEndsLine=true}. */ - @Test public void testWhereListItemsOnSeparateLinesAndNewline() { + @Test void testWhereListItemsOnSeparateLinesAndNewline() { final String sql = "select x" + " from y" + " where h is not null and (i < j" @@ -494,7 +494,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testUpdate() { + @Test void testUpdate() { final String sql = "update emp\n" + "set mgr = mgr + 1, deptno = 5\n" + "where deptno = 10 and name = 'Fred'"; @@ -502,7 +502,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testUpdateNoLine() { + @Test void testUpdateNoLine() { final String sql = "update emp\n" + "set mgr = mgr + 1, deptno = 5\n" + "where deptno = 10 and name = 'Fred'"; @@ -511,7 +511,7 @@ private Sql expr(String sql) { .check(); } - @Test public void testUpdateNoLine2() { + @Test void testUpdateNoLine2() { final String sql = "update emp\n" + "set mgr = mgr + 1, deptno = 5\n" + "where deptno = 10 and name = 'Fred'"; diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlRuntimeTester.java b/core/src/test/java/org/apache/calcite/sql/test/SqlRuntimeTester.java index 919a64551561..cd87c79c538e 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/SqlRuntimeTester.java +++ b/core/src/test/java/org/apache/calcite/sql/test/SqlRuntimeTester.java @@ -27,8 +27,8 @@ /** * Tester of {@link SqlValidator} and runtime execution of the input SQL. */ -public class SqlRuntimeTester extends AbstractSqlTester { - public SqlRuntimeTester(SqlTestFactory factory, +class SqlRuntimeTester extends AbstractSqlTester { + SqlRuntimeTester(SqlTestFactory factory, UnaryOperator validatorTransform) { super(factory, validatorTransform); } diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlTypeNameTest.java b/core/src/test/java/org/apache/calcite/sql/test/SqlTypeNameTest.java index efbf76fbb1dc..83e6c78b48ca 100644 --- a/core/src/test/java/org/apache/calcite/sql/test/SqlTypeNameTest.java +++ b/core/src/test/java/org/apache/calcite/sql/test/SqlTypeNameTest.java @@ -48,188 +48,188 @@ /** * Tests types supported by {@link SqlTypeName}. */ -public class SqlTypeNameTest { - @Test public void testBit() { +class SqlTypeNameTest { + @Test void testBit() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.BIT); assertEquals(BOOLEAN, tn, "BIT did not map to BOOLEAN"); } - @Test public void testTinyint() { + @Test void testTinyint() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.TINYINT); assertEquals(TINYINT, tn, "TINYINT did not map to TINYINT"); } - @Test public void testSmallint() { + @Test void testSmallint() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.SMALLINT); assertEquals(SMALLINT, tn, "SMALLINT did not map to SMALLINT"); } - @Test public void testInteger() { + @Test void testInteger() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.INTEGER); assertEquals(INTEGER, tn, "INTEGER did not map to INTEGER"); } - @Test public void testBigint() { + @Test void testBigint() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.BIGINT); assertEquals(BIGINT, tn, "BIGINT did not map to BIGINT"); } - @Test public void testFloat() { + @Test void testFloat() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.FLOAT); assertEquals(FLOAT, tn, "FLOAT did not map to FLOAT"); } - @Test public void testReal() { + @Test void testReal() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.REAL); assertEquals(REAL, tn, "REAL did not map to REAL"); } - @Test public void testDouble() { + @Test void testDouble() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.DOUBLE); assertEquals(DOUBLE, tn, "DOUBLE did not map to DOUBLE"); } - @Test public void testNumeric() { + @Test void testNumeric() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.NUMERIC); assertEquals(DECIMAL, tn, "NUMERIC did not map to DECIMAL"); } - @Test public void testDecimal() { + @Test void testDecimal() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.DECIMAL); assertEquals(DECIMAL, tn, "DECIMAL did not map to DECIMAL"); } - @Test public void testChar() { + @Test void testChar() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.CHAR); assertEquals(CHAR, tn, "CHAR did not map to CHAR"); } - @Test public void testVarchar() { + @Test void testVarchar() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.VARCHAR); assertEquals(VARCHAR, tn, "VARCHAR did not map to VARCHAR"); } - @Test public void testLongvarchar() { + @Test void testLongvarchar() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.LONGVARCHAR); assertEquals(null, tn, "LONGVARCHAR did not map to null"); } - @Test public void testDate() { + @Test void testDate() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.DATE); assertEquals(DATE, tn, "DATE did not map to DATE"); } - @Test public void testTime() { + @Test void testTime() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.TIME); assertEquals(TIME, tn, "TIME did not map to TIME"); } - @Test public void testTimestamp() { + @Test void testTimestamp() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.TIMESTAMP); assertEquals(TIMESTAMP, tn, "TIMESTAMP did not map to TIMESTAMP"); } - @Test public void testBinary() { + @Test void testBinary() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.BINARY); assertEquals(BINARY, tn, "BINARY did not map to BINARY"); } - @Test public void testVarbinary() { + @Test void testVarbinary() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.VARBINARY); assertEquals(VARBINARY, tn, "VARBINARY did not map to VARBINARY"); } - @Test public void testLongvarbinary() { + @Test void testLongvarbinary() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.LONGVARBINARY); assertEquals(null, tn, "LONGVARBINARY did not map to null"); } - @Test public void testNull() { + @Test void testNull() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.NULL); assertEquals(null, tn, "NULL did not map to null"); } - @Test public void testOther() { + @Test void testOther() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.OTHER); assertEquals(null, tn, "OTHER did not map to null"); } - @Test public void testJavaobject() { + @Test void testJavaobject() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.JAVA_OBJECT); assertEquals(null, tn, "JAVA_OBJECT did not map to null"); } - @Test public void testDistinct() { + @Test void testDistinct() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.DISTINCT); assertEquals(DISTINCT, tn, "DISTINCT did not map to DISTINCT"); } - @Test public void testStruct() { + @Test void testStruct() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.STRUCT); assertEquals(STRUCTURED, tn, "STRUCT did not map to null"); } - @Test public void testArray() { + @Test void testArray() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.ARRAY); assertEquals(ARRAY, tn, "ARRAY did not map to ARRAY"); } - @Test public void testBlob() { + @Test void testBlob() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.BLOB); assertEquals(null, tn, "BLOB did not map to null"); } - @Test public void testClob() { + @Test void testClob() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.CLOB); assertEquals(null, tn, "CLOB did not map to null"); } - @Test public void testRef() { + @Test void testRef() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.REF); assertEquals(null, tn, "REF did not map to null"); } - @Test public void testDatalink() { + @Test void testDatalink() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.DATALINK); assertEquals(null, tn, "DATALINK did not map to null"); } - @Test public void testBoolean() { + @Test void testBoolean() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(Types.BOOLEAN); assertEquals(BOOLEAN, tn, "BOOLEAN did not map to BOOLEAN"); } - @Test public void testRowid() { + @Test void testRowid() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(ExtraSqlTypes.ROWID); @@ -237,7 +237,7 @@ public class SqlTypeNameTest { assertEquals(null, tn, "ROWID maps to non-null type"); } - @Test public void testNchar() { + @Test void testNchar() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(ExtraSqlTypes.NCHAR); @@ -245,7 +245,7 @@ public class SqlTypeNameTest { assertEquals(CHAR, tn, "NCHAR did not map to CHAR"); } - @Test public void testNvarchar() { + @Test void testNvarchar() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(ExtraSqlTypes.NVARCHAR); @@ -253,7 +253,7 @@ public class SqlTypeNameTest { assertEquals(VARCHAR, tn, "NVARCHAR did not map to VARCHAR"); } - @Test public void testLongnvarchar() { + @Test void testLongnvarchar() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(ExtraSqlTypes.LONGNVARCHAR); @@ -261,7 +261,7 @@ public class SqlTypeNameTest { assertEquals(null, tn, "LONGNVARCHAR maps to non-null type"); } - @Test public void testNclob() { + @Test void testNclob() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(ExtraSqlTypes.NCLOB); @@ -269,7 +269,7 @@ public class SqlTypeNameTest { assertEquals(null, tn, "NCLOB maps to non-null type"); } - @Test public void testSqlxml() { + @Test void testSqlxml() { SqlTypeName tn = SqlTypeName.getNameForJdbcType(ExtraSqlTypes.SQLXML); diff --git a/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java b/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java index 99c200b598a4..62550f950306 100644 --- a/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java +++ b/core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java @@ -30,7 +30,7 @@ /** * Tests return type inference using {@code RelDataTypeSystem} */ -public class RelDataTypeSystemTest { +class RelDataTypeSystemTest { private static final SqlTypeFixture TYPE_FIXTURE = new SqlTypeFixture(); private static final SqlTypeFactoryImpl TYPE_FACTORY = TYPE_FIXTURE.typeFactory; @@ -120,7 +120,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { private static final SqlTypeFactoryImpl CUSTOM_FACTORY = new SqlTypeFactoryImpl(new CustomTypeSystem()); - @Test public void testDecimalAdditionReturnTypeInference() { + @Test void testDecimalAdditionReturnTypeInference() { RelDataType operand1 = TYPE_FACTORY.createSqlType(SqlTypeName.DECIMAL, 10, 1); RelDataType operand2 = TYPE_FACTORY.createSqlType(SqlTypeName.DECIMAL, 10, 2); @@ -130,7 +130,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { assertEquals(2, dataType.getScale()); } - @Test public void testDecimalModReturnTypeInference() { + @Test void testDecimalModReturnTypeInference() { RelDataType operand1 = TYPE_FACTORY.createSqlType(SqlTypeName.DECIMAL, 10, 1); RelDataType operand2 = TYPE_FACTORY.createSqlType(SqlTypeName.DECIMAL, 19, 2); @@ -140,7 +140,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { assertEquals(2, dataType.getScale()); } - @Test public void testDoubleModReturnTypeInference() { + @Test void testDoubleModReturnTypeInference() { RelDataType operand1 = TYPE_FACTORY.createSqlType(SqlTypeName.DOUBLE); RelDataType operand2 = TYPE_FACTORY.createSqlType(SqlTypeName.DOUBLE); @@ -149,7 +149,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { assertEquals(SqlTypeName.DOUBLE, dataType.getSqlTypeName()); } - @Test public void testCustomDecimalPlusReturnTypeInference() { + @Test void testCustomDecimalPlusReturnTypeInference() { RelDataType operand1 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 38, 10); RelDataType operand2 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 38, 20); @@ -160,7 +160,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { assertEquals(9, dataType.getScale()); } - @Test public void testCustomDecimalMultiplyReturnTypeInference() { + @Test void testCustomDecimalMultiplyReturnTypeInference() { RelDataType operand1 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 2, 4); RelDataType operand2 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 3, 5); @@ -171,7 +171,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { assertEquals(20, dataType.getScale()); } - @Test public void testCustomDecimalDivideReturnTypeInference() { + @Test void testCustomDecimalDivideReturnTypeInference() { RelDataType operand1 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 28, 10); RelDataType operand2 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 38, 20); @@ -182,7 +182,7 @@ private static final class CustomTypeSystem extends RelDataTypeSystemImpl { assertEquals(10, dataType.getScale()); } - @Test public void testCustomDecimalModReturnTypeInference() { + @Test void testCustomDecimalModReturnTypeInference() { RelDataType operand1 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 28, 10); RelDataType operand2 = CUSTOM_FACTORY.createSqlType(SqlTypeName.DECIMAL, 38, 20); diff --git a/core/src/test/java/org/apache/calcite/sql/type/SqlTypeFactoryTest.java b/core/src/test/java/org/apache/calcite/sql/type/SqlTypeFactoryTest.java index ec2f95c2a51f..e5734134f390 100644 --- a/core/src/test/java/org/apache/calcite/sql/type/SqlTypeFactoryTest.java +++ b/core/src/test/java/org/apache/calcite/sql/type/SqlTypeFactoryTest.java @@ -40,23 +40,23 @@ /** * Test for {@link SqlTypeFactoryImpl}. */ -public class SqlTypeFactoryTest { +class SqlTypeFactoryTest { - @Test public void testLeastRestrictiveWithAny() { + @Test void testLeastRestrictiveWithAny() { SqlTypeFixture f = new SqlTypeFixture(); RelDataType leastRestrictive = f.typeFactory.leastRestrictive(Lists.newArrayList(f.sqlBigInt, f.sqlAny)); assertThat(leastRestrictive.getSqlTypeName(), is(SqlTypeName.ANY)); } - @Test public void testLeastRestrictiveWithNumbers() { + @Test void testLeastRestrictiveWithNumbers() { SqlTypeFixture f = new SqlTypeFixture(); RelDataType leastRestrictive = f.typeFactory.leastRestrictive(Lists.newArrayList(f.sqlBigInt, f.sqlInt)); assertThat(leastRestrictive.getSqlTypeName(), is(SqlTypeName.BIGINT)); } - @Test public void testLeastRestrictiveWithNullability() { + @Test void testLeastRestrictiveWithNullability() { SqlTypeFixture f = new SqlTypeFixture(); RelDataType leastRestrictive = f.typeFactory.leastRestrictive(Lists.newArrayList(f.sqlVarcharNullable, f.sqlAny)); @@ -67,7 +67,7 @@ public class SqlTypeFactoryTest { /** Test case for * [CALCITE-2994] * Least restrictive type among structs does not consider nullability. */ - @Test public void testLeastRestrictiveWithNullableStruct() { + @Test void testLeastRestrictiveWithNullableStruct() { SqlTypeFixture f = new SqlTypeFixture(); RelDataType leastRestrictive = f.typeFactory.leastRestrictive(ImmutableList.of(f.structOfIntNullable, f.structOfInt)); @@ -75,7 +75,7 @@ public class SqlTypeFactoryTest { assertThat(leastRestrictive.isNullable(), is(true)); } - @Test public void testLeastRestrictiveWithNull() { + @Test void testLeastRestrictiveWithNull() { SqlTypeFixture f = new SqlTypeFixture(); RelDataType leastRestrictive = f.typeFactory.leastRestrictive(Lists.newArrayList(f.sqlNull, f.sqlNull)); @@ -85,7 +85,7 @@ public class SqlTypeFactoryTest { /** Unit test for {@link SqlTypeUtil#comparePrecision(int, int)} * and {@link SqlTypeUtil#maxPrecision(int, int)}. */ - @Test public void testMaxPrecision() { + @Test void testMaxPrecision() { final int un = RelDataType.PRECISION_NOT_SPECIFIED; checkPrecision(1, 1, 1, 0); checkPrecision(2, 1, 2, 1); @@ -96,7 +96,7 @@ public class SqlTypeFactoryTest { } /** Unit test for {@link ArraySqlType#getPrecedenceList()}. */ - @Test public void testArrayPrecedenceList() { + @Test void testArrayPrecedenceList() { SqlTypeFixture f = new SqlTypeFixture(); assertThat(checkPrecendenceList(f.arrayBigInt, f.arrayBigInt, f.arrayFloat), is(3)); @@ -137,7 +137,7 @@ private void checkPrecision(int p0, int p1, int expectedMax, /** Test case for * [CALCITE-2464] * Allow to set nullability for columns of structured types. */ - @Test public void createStructTypeWithNullability() { + @Test void createStructTypeWithNullability() { SqlTypeFixture f = new SqlTypeFixture(); RelDataTypeFactory typeFactory = f.typeFactory; List fields = new ArrayList<>(); @@ -156,7 +156,7 @@ private void checkPrecision(int p0, int p1, int expectedMax, /** Test case for * [CALCITE-3429] * AssertionError thrown for user-defined table function with map argument. */ - @Test public void testCreateTypeWithJavaMapType() { + @Test void testCreateTypeWithJavaMapType() { SqlTypeFixture f = new SqlTypeFixture(); RelDataType relDataType = f.typeFactory.createJavaType(Map.class); assertThat(relDataType.getSqlTypeName(), is(SqlTypeName.MAP)); diff --git a/core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java b/core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java index 319439c8e401..61658113d2d4 100644 --- a/core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java +++ b/core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java @@ -31,11 +31,11 @@ /** * Test of {@link org.apache.calcite.sql.type.SqlTypeUtil}. */ -public class SqlTypeUtilTest { +class SqlTypeUtilTest { private final SqlTypeFixture f = new SqlTypeFixture(); - @Test public void testTypesIsSameFamilyWithNumberTypes() { + @Test void testTypesIsSameFamilyWithNumberTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlBigInt, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlFloat, f.sqlBigInt)), is(true)); @@ -43,20 +43,20 @@ public class SqlTypeUtilTest { is(true)); } - @Test public void testTypesIsSameFamilyWithCharTypes() { + @Test void testTypesIsSameFamilyWithCharTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlVarchar)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlChar)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlVarcharNullable)), is(true)); } - @Test public void testTypesIsSameFamilyWithInconvertibleTypes() { + @Test void testTypesIsSameFamilyWithInconvertibleTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlBoolean, f.sqlBigInt)), is(false)); assertThat(areSameFamily(ImmutableList.of(f.sqlFloat, f.sqlBoolean)), is(false)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlDate)), is(false)); } - @Test public void testTypesIsSameFamilyWithNumberStructTypes() { + @Test void testTypesIsSameFamilyWithNumberStructTypes() { final RelDataType bigIntAndFloat = struct(f.sqlBigInt, f.sqlFloat); final RelDataType floatAndBigInt = struct(f.sqlFloat, f.sqlBigInt); @@ -70,7 +70,7 @@ public class SqlTypeUtilTest { is(true)); } - @Test public void testTypesIsSameFamilyWithCharStructTypes() { + @Test void testTypesIsSameFamilyWithCharStructTypes() { final RelDataType varCharStruct = struct(f.sqlVarchar); final RelDataType charStruct = struct(f.sqlChar); @@ -80,7 +80,7 @@ public class SqlTypeUtilTest { assertThat(areSameFamily(ImmutableList.of(charStruct, charStruct)), is(true)); } - @Test public void testTypesIsSameFamilyWithInconvertibleStructTypes() { + @Test void testTypesIsSameFamilyWithInconvertibleStructTypes() { final RelDataType dateStruct = struct(f.sqlDate); final RelDataType boolStruct = struct(f.sqlBoolean); assertThat(areSameFamily(ImmutableList.of(dateStruct, boolStruct)), is(false)); @@ -96,7 +96,7 @@ public class SqlTypeUtilTest { is(false)); } - @Test public void testModifyTypeCoercionMappings() { + @Test void testModifyTypeCoercionMappings() { SqlTypeMappingRules.Builder builder = SqlTypeMappingRules.builder(); final SqlTypeCoercionRule defaultRules = SqlTypeCoercionRule.instance(); builder.addAll(defaultRules.getTypeMapping()); diff --git a/core/src/test/java/org/apache/calcite/sql/validate/LexCaseSensitiveTest.java b/core/src/test/java/org/apache/calcite/sql/validate/LexCaseSensitiveTest.java index 9e0518e0d344..0a92a04878e8 100644 --- a/core/src/test/java/org/apache/calcite/sql/validate/LexCaseSensitiveTest.java +++ b/core/src/test/java/org/apache/calcite/sql/validate/LexCaseSensitiveTest.java @@ -49,7 +49,7 @@ /** * Testing {@link SqlValidator} and {@link Lex}. */ -public class LexCaseSensitiveTest { +class LexCaseSensitiveTest { private static Planner getPlanner(List traitDefs, SqlParser.Config parserConfig, Program... programs) { @@ -85,14 +85,14 @@ private static void runProjectQueryWithLex(Lex lex, String sql) } } - @Test public void testCalciteCaseOracle() + @Test void testCalciteCaseOracle() throws SqlParseException, ValidationException, RelConversionException { String sql = "select \"empid\" as EMPID, \"empid\" from\n" + " (select \"empid\" from \"emps\" order by \"emps\".\"deptno\")"; runProjectQueryWithLex(Lex.ORACLE, sql); } - @Test public void testCalciteCaseOracleException() { + @Test void testCalciteCaseOracleException() { assertThrows(ValidationException.class, () -> { // Oracle is case sensitive, so EMPID should not be found. String sql = "select EMPID, \"empid\" from\n" @@ -101,56 +101,56 @@ private static void runProjectQueryWithLex(Lex lex, String sql) }); } - @Test public void testCalciteCaseMySql() + @Test void testCalciteCaseMySql() throws SqlParseException, ValidationException, RelConversionException { String sql = "select empid as EMPID, empid from (\n" + " select empid from emps order by `EMPS`.DEPTNO)"; runProjectQueryWithLex(Lex.MYSQL, sql); } - @Test public void testCalciteCaseMySqlNoException() + @Test void testCalciteCaseMySqlNoException() throws SqlParseException, ValidationException, RelConversionException { String sql = "select EMPID, empid from\n" + " (select empid from emps order by emps.deptno)"; runProjectQueryWithLex(Lex.MYSQL, sql); } - @Test public void testCalciteCaseMySqlAnsi() + @Test void testCalciteCaseMySqlAnsi() throws SqlParseException, ValidationException, RelConversionException { String sql = "select empid as EMPID, empid from (\n" + " select empid from emps order by EMPS.DEPTNO)"; runProjectQueryWithLex(Lex.MYSQL_ANSI, sql); } - @Test public void testCalciteCaseMySqlAnsiNoException() + @Test void testCalciteCaseMySqlAnsiNoException() throws SqlParseException, ValidationException, RelConversionException { String sql = "select EMPID, empid from\n" + " (select empid from emps order by emps.deptno)"; runProjectQueryWithLex(Lex.MYSQL_ANSI, sql); } - @Test public void testCalciteCaseSqlServer() + @Test void testCalciteCaseSqlServer() throws SqlParseException, ValidationException, RelConversionException { String sql = "select empid as EMPID, empid from (\n" + " select empid from emps order by EMPS.DEPTNO)"; runProjectQueryWithLex(Lex.SQL_SERVER, sql); } - @Test public void testCalciteCaseSqlServerNoException() + @Test void testCalciteCaseSqlServerNoException() throws SqlParseException, ValidationException, RelConversionException { String sql = "select EMPID, empid from\n" + " (select empid from emps order by emps.deptno)"; runProjectQueryWithLex(Lex.SQL_SERVER, sql); } - @Test public void testCalciteCaseJava() + @Test void testCalciteCaseJava() throws SqlParseException, ValidationException, RelConversionException { String sql = "select empid as EMPID, empid from (\n" + " select empid from emps order by emps.deptno)"; runProjectQueryWithLex(Lex.JAVA, sql); } - @Test public void testCalciteCaseJavaException() { + @Test void testCalciteCaseJavaException() { assertThrows(ValidationException.class, () -> { // JAVA is case sensitive, so EMPID should not be found. String sql = "select EMPID, empid from\n" @@ -159,7 +159,7 @@ private static void runProjectQueryWithLex(Lex lex, String sql) }); } - @Test public void testCalciteCaseJoinOracle() + @Test void testCalciteCaseJoinOracle() throws SqlParseException, ValidationException, RelConversionException { String sql = "select t.\"empid\" as EMPID, s.\"empid\" from\n" + "(select * from \"emps\" where \"emps\".\"deptno\" > 100) t join\n" @@ -168,7 +168,7 @@ private static void runProjectQueryWithLex(Lex lex, String sql) runProjectQueryWithLex(Lex.ORACLE, sql); } - @Test public void testCalciteCaseJoinMySql() + @Test void testCalciteCaseJoinMySql() throws SqlParseException, ValidationException, RelConversionException { String sql = "select t.empid as EMPID, s.empid from\n" + "(select * from emps where emps.deptno > 100) t join\n" @@ -176,7 +176,7 @@ private static void runProjectQueryWithLex(Lex lex, String sql) runProjectQueryWithLex(Lex.MYSQL, sql); } - @Test public void testCalciteCaseJoinMySqlAnsi() + @Test void testCalciteCaseJoinMySqlAnsi() throws SqlParseException, ValidationException, RelConversionException { String sql = "select t.empid as EMPID, s.empid from\n" + "(select * from emps where emps.deptno > 100) t join\n" @@ -184,7 +184,7 @@ private static void runProjectQueryWithLex(Lex lex, String sql) runProjectQueryWithLex(Lex.MYSQL_ANSI, sql); } - @Test public void testCalciteCaseJoinSqlServer() + @Test void testCalciteCaseJoinSqlServer() throws SqlParseException, ValidationException, RelConversionException { String sql = "select t.empid as EMPID, s.empid from\n" + "(select * from emps where emps.deptno > 100) t join\n" @@ -192,7 +192,7 @@ private static void runProjectQueryWithLex(Lex lex, String sql) runProjectQueryWithLex(Lex.SQL_SERVER, sql); } - @Test public void testCalciteCaseJoinJava() + @Test void testCalciteCaseJoinJava() throws SqlParseException, ValidationException, RelConversionException { String sql = "select t.empid as EMPID, s.empid from\n" + "(select * from emps where emps.deptno > 100) t join\n" diff --git a/core/src/test/java/org/apache/calcite/sql/validate/LexEscapeTest.java b/core/src/test/java/org/apache/calcite/sql/validate/LexEscapeTest.java index ecbf83a2e4b1..6fb397aed12d 100644 --- a/core/src/test/java/org/apache/calcite/sql/validate/LexEscapeTest.java +++ b/core/src/test/java/org/apache/calcite/sql/validate/LexEscapeTest.java @@ -52,7 +52,7 @@ /** * Testing {@link SqlValidator} and {@link Lex} quoting. */ -public class LexEscapeTest { +class LexEscapeTest { private static Planner getPlanner(List traitDefs, Config parserConfig, Program... programs) { @@ -92,33 +92,33 @@ private static void runProjectQueryWithLex(Lex lex, String sql) assertThat(fields.get(3).getType().getSqlTypeName(), is(SqlTypeName.TIMESTAMP)); } - @Test public void testCalciteEscapeOracle() + @Test void testCalciteEscapeOracle() throws SqlParseException, ValidationException, RelConversionException { String sql = "select \"localtime\", localtime, " + "\"current_timestamp\", current_timestamp from TMP"; runProjectQueryWithLex(Lex.ORACLE, sql); } - @Test public void testCalciteEscapeMySql() + @Test void testCalciteEscapeMySql() throws SqlParseException, ValidationException, RelConversionException { String sql = "select `localtime`, localtime, `current_timestamp`, current_timestamp from TMP"; runProjectQueryWithLex(Lex.MYSQL, sql); } - @Test public void testCalciteEscapeMySqlAnsi() + @Test void testCalciteEscapeMySqlAnsi() throws SqlParseException, ValidationException, RelConversionException { String sql = "select \"localtime\", localtime, " + "\"current_timestamp\", current_timestamp from TMP"; runProjectQueryWithLex(Lex.MYSQL_ANSI, sql); } - @Test public void testCalciteEscapeSqlServer() + @Test void testCalciteEscapeSqlServer() throws SqlParseException, ValidationException, RelConversionException { String sql = "select [localtime], localtime, [current_timestamp], current_timestamp from TMP"; runProjectQueryWithLex(Lex.SQL_SERVER, sql); } - @Test public void testCalciteEscapeJava() + @Test void testCalciteEscapeJava() throws SqlParseException, ValidationException, RelConversionException { String sql = "select `localtime`, localtime, `current_timestamp`, current_timestamp from TMP"; runProjectQueryWithLex(Lex.JAVA, sql); diff --git a/core/src/test/java/org/apache/calcite/sql/validate/SqlValidatorUtilTest.java b/core/src/test/java/org/apache/calcite/sql/validate/SqlValidatorUtilTest.java index 2fdbde85d4cd..f3d6fb61bccd 100644 --- a/core/src/test/java/org/apache/calcite/sql/validate/SqlValidatorUtilTest.java +++ b/core/src/test/java/org/apache/calcite/sql/validate/SqlValidatorUtilTest.java @@ -44,7 +44,7 @@ /** * Tests for {@link SqlValidatorUtil}. */ -public class SqlValidatorUtilTest { +class SqlValidatorUtilTest { private static void checkChangedFieldList( List nameList, List resultList, boolean caseSensitive) { @@ -74,14 +74,14 @@ private static void checkChangedFieldList( assertThat(copyResultList.size(), is(0)); } - @Test public void testUniquifyCaseSensitive() { + @Test void testUniquifyCaseSensitive() { List nameList = Lists.newArrayList("col1", "COL1", "col_ABC", "col_abC"); List resultList = SqlValidatorUtil.uniquify( nameList, SqlValidatorUtil.EXPR_SUGGESTER, true); assertThat(nameList, sameInstance(resultList)); } - @Test public void testUniquifyNotCaseSensitive() { + @Test void testUniquifyNotCaseSensitive() { List nameList = Lists.newArrayList("col1", "COL1", "col_ABC", "col_abC"); List resultList = SqlValidatorUtil.uniquify( nameList, SqlValidatorUtil.EXPR_SUGGESTER, false); @@ -89,14 +89,14 @@ private static void checkChangedFieldList( checkChangedFieldList(nameList, resultList, false); } - @Test public void testUniquifyOrderingCaseSensitive() { + @Test void testUniquifyOrderingCaseSensitive() { List nameList = Lists.newArrayList("k68s", "def", "col1", "COL1", "abc", "123"); List resultList = SqlValidatorUtil.uniquify( nameList, SqlValidatorUtil.EXPR_SUGGESTER, true); assertThat(nameList, sameInstance(resultList)); } - @Test public void testUniquifyOrderingRepeatedCaseSensitive() { + @Test void testUniquifyOrderingRepeatedCaseSensitive() { List nameList = Lists.newArrayList("k68s", "def", "col1", "COL1", "def", "123"); List resultList = SqlValidatorUtil.uniquify( nameList, SqlValidatorUtil.EXPR_SUGGESTER, true); @@ -104,7 +104,7 @@ private static void checkChangedFieldList( checkChangedFieldList(nameList, resultList, true); } - @Test public void testUniquifyOrderingNotCaseSensitive() { + @Test void testUniquifyOrderingNotCaseSensitive() { List nameList = Lists.newArrayList("k68s", "def", "col1", "COL1", "abc", "123"); List resultList = SqlValidatorUtil.uniquify( nameList, SqlValidatorUtil.EXPR_SUGGESTER, false); @@ -112,7 +112,7 @@ private static void checkChangedFieldList( checkChangedFieldList(nameList, resultList, false); } - @Test public void testUniquifyOrderingRepeatedNotCaseSensitive() { + @Test void testUniquifyOrderingRepeatedNotCaseSensitive() { List nameList = Lists.newArrayList("k68s", "def", "col1", "COL1", "def", "123"); List resultList = SqlValidatorUtil.uniquify( nameList, SqlValidatorUtil.EXPR_SUGGESTER, false); @@ -121,7 +121,7 @@ private static void checkChangedFieldList( } @SuppressWarnings("resource") - @Test public void testCheckingDuplicatesWithCompoundIdentifiers() { + @Test void testCheckingDuplicatesWithCompoundIdentifiers() { final List newList = new ArrayList<>(2); newList.add(new SqlIdentifier(Arrays.asList("f0", "c0"), SqlParserPos.ZERO)); newList.add(new SqlIdentifier(Arrays.asList("f0", "c0"), SqlParserPos.ZERO)); @@ -141,7 +141,7 @@ private static void checkChangedFieldList( SqlValidatorUtil.checkIdentifierListForDuplicates(newList, null); } - @Test public void testNameMatcher() { + @Test void testNameMatcher() { final ImmutableList beatles = ImmutableList.of("john", "paul", "ringo", "rinGo"); final SqlNameMatcher insensitiveMatcher = diff --git a/core/src/test/java/org/apache/calcite/test/CalciteResourceTest.java b/core/src/test/java/org/apache/calcite/test/CalciteResourceTest.java index 9d55bf69dd64..f520a812f74e 100644 --- a/core/src/test/java/org/apache/calcite/test/CalciteResourceTest.java +++ b/core/src/test/java/org/apache/calcite/test/CalciteResourceTest.java @@ -30,12 +30,12 @@ * {@link org.apache.calcite.runtime.CalciteResource} (mostly a sanity check for * the resource-generation infrastructure). */ -public class CalciteResourceTest { +class CalciteResourceTest { /** * Verifies that resource properties such as SQLSTATE are available at * runtime. */ - @Test public void testSqlstateProperty() { + @Test void testSqlstateProperty() { Map props = RESOURCE.illegalIntervalLiteral("", "").getProperties(); assertThat(props.get("SQLSTATE"), CoreMatchers.equalTo("42000")); diff --git a/core/src/test/java/org/apache/calcite/test/CalciteSqlOperatorTest.java b/core/src/test/java/org/apache/calcite/test/CalciteSqlOperatorTest.java index e6bff8385335..9805b0a361d2 100644 --- a/core/src/test/java/org/apache/calcite/test/CalciteSqlOperatorTest.java +++ b/core/src/test/java/org/apache/calcite/test/CalciteSqlOperatorTest.java @@ -22,8 +22,8 @@ * Embodiment of {@link org.apache.calcite.sql.test.SqlOperatorBaseTest} * that generates SQL statements and executes them using Calcite. */ -public class CalciteSqlOperatorTest extends SqlOperatorBaseTest { - public CalciteSqlOperatorTest() { +class CalciteSqlOperatorTest extends SqlOperatorBaseTest { + CalciteSqlOperatorTest() { super(false, tester()); } } diff --git a/core/src/test/java/org/apache/calcite/test/CollectionTypeTest.java b/core/src/test/java/org/apache/calcite/test/CollectionTypeTest.java index d1f52a8e52cd..b95a69a31b8a 100644 --- a/core/src/test/java/org/apache/calcite/test/CollectionTypeTest.java +++ b/core/src/test/java/org/apache/calcite/test/CollectionTypeTest.java @@ -57,8 +57,8 @@ * [CALCITE-1386] * ITEM operator seems to ignore the value type of collection and assign the value to Object. */ -public class CollectionTypeTest { - @Test public void testAccessNestedMap() throws Exception { +class CollectionTypeTest { + @Test void testAccessNestedMap() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -76,7 +76,7 @@ public class CollectionTypeTest { assertThat(resultStrings.get(0), is(expectedRow)); } - @Test public void testAccessNonExistKeyFromMap() throws Exception { + @Test void testAccessNonExistKeyFromMap() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -91,7 +91,7 @@ public class CollectionTypeTest { assertThat(resultStrings.size(), is(0)); } - @Test public void testAccessNonExistKeyFromNestedMap() throws Exception { + @Test void testAccessNonExistKeyFromNestedMap() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -106,7 +106,7 @@ public class CollectionTypeTest { assertThat(resultStrings.size(), is(0)); } - @Test public void testInvalidAccessUseStringForIndexOnArray() throws Exception { + @Test void testInvalidAccessUseStringForIndexOnArray() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -125,7 +125,7 @@ public class CollectionTypeTest { } } - @Test public void testNestedArrayOutOfBoundAccess() throws Exception { + @Test void testNestedArrayOutOfBoundAccess() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -144,7 +144,7 @@ public class CollectionTypeTest { assertThat(resultStrings.size(), is(0)); } - @Test public void testAccessNestedMapWithAnyType() throws Exception { + @Test void testAccessNestedMapWithAnyType() throws Exception { Connection connection = setupConnectionWithNestedAnyTypeTable(); final Statement statement = connection.createStatement(); @@ -164,7 +164,7 @@ public class CollectionTypeTest { assertThat(resultStrings.get(0), is(expectedRow)); } - @Test public void testAccessNestedMapWithAnyTypeWithoutCast() throws Exception { + @Test void testAccessNestedMapWithAnyTypeWithoutCast() throws Exception { Connection connection = setupConnectionWithNestedAnyTypeTable(); final Statement statement = connection.createStatement(); @@ -186,7 +186,7 @@ public class CollectionTypeTest { } - @Test public void testArithmeticToAnyTypeWithoutCast() throws Exception { + @Test void testArithmeticToAnyTypeWithoutCast() throws Exception { Connection connection = setupConnectionWithNestedAnyTypeTable(); final Statement statement = connection.createStatement(); @@ -217,7 +217,7 @@ public class CollectionTypeTest { assertThat(resultStrings.get(0), is(expectedRow)); } - @Test public void testAccessNonExistKeyFromMapWithAnyType() throws Exception { + @Test void testAccessNonExistKeyFromMapWithAnyType() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -232,7 +232,7 @@ public class CollectionTypeTest { assertThat(resultStrings.size(), is(0)); } - @Test public void testAccessNonExistKeyFromNestedMapWithAnyType() throws Exception { + @Test void testAccessNonExistKeyFromNestedMapWithAnyType() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -247,7 +247,7 @@ public class CollectionTypeTest { assertThat(resultStrings.size(), is(0)); } - @Test public void testInvalidAccessUseStringForIndexOnArrayWithAnyType() throws Exception { + @Test void testInvalidAccessUseStringForIndexOnArrayWithAnyType() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); @@ -266,7 +266,7 @@ public class CollectionTypeTest { } } - @Test public void testNestedArrayOutOfBoundAccessWithAnyType() throws Exception { + @Test void testNestedArrayOutOfBoundAccessWithAnyType() throws Exception { Connection connection = setupConnectionWithNestedTable(); final Statement statement = connection.createStatement(); diff --git a/core/src/test/java/org/apache/calcite/test/CoreQuidemTest.java b/core/src/test/java/org/apache/calcite/test/CoreQuidemTest.java index 9841ac94e74d..1719b8b58d67 100644 --- a/core/src/test/java/org/apache/calcite/test/CoreQuidemTest.java +++ b/core/src/test/java/org/apache/calcite/test/CoreQuidemTest.java @@ -24,7 +24,7 @@ /** * Test that runs every Quidem file in the "core" module as a test. */ -public class CoreQuidemTest extends QuidemTest { +class CoreQuidemTest extends QuidemTest { /** Runs a test from the command line. * *

For example: diff --git a/core/src/test/java/org/apache/calcite/test/ExceptionMessageTest.java b/core/src/test/java/org/apache/calcite/test/ExceptionMessageTest.java index 176371c2620f..22bd6a431313 100644 --- a/core/src/test/java/org/apache/calcite/test/ExceptionMessageTest.java +++ b/core/src/test/java/org/apache/calcite/test/ExceptionMessageTest.java @@ -94,13 +94,13 @@ private void runQuery(String sql) throws SQLException { } } - @Test public void testValidQuery() throws SQLException { + @Test void testValidQuery() throws SQLException { // Just ensure that we're actually dealing with a valid connection // to be sure that the results of the other tests can be trusted runQuery("select * from \"entries\""); } - @Test public void testNonSqlException() throws SQLException { + @Test void testNonSqlException() throws SQLException { try { runQuery("select * from \"badEntries\""); fail("Query badEntries should result in an exception"); @@ -111,7 +111,7 @@ private void runQuery(String sql) throws SQLException { } } - @Test public void testSyntaxError() { + @Test void testSyntaxError() { try { runQuery("invalid sql"); fail("Query should fail"); @@ -122,7 +122,7 @@ private void runQuery(String sql) throws SQLException { } } - @Test public void testSemanticError() { + @Test void testSemanticError() { try { // implicit type coercion. runQuery("select \"name\" - \"id\" from \"entries\""); @@ -132,7 +132,7 @@ private void runQuery(String sql) throws SQLException { } } - @Test public void testNonexistentTable() { + @Test void testNonexistentTable() { try { runQuery("select name from \"nonexistentTable\""); fail("Query should fail"); diff --git a/core/src/test/java/org/apache/calcite/test/FilteratorTest.java b/core/src/test/java/org/apache/calcite/test/FilteratorTest.java index 78379916b430..a3b016996ce2 100644 --- a/core/src/test/java/org/apache/calcite/test/FilteratorTest.java +++ b/core/src/test/java/org/apache/calcite/test/FilteratorTest.java @@ -35,10 +35,10 @@ /** * Unit test for {@link Filterator}. */ -public class FilteratorTest { +class FilteratorTest { //~ Methods ---------------------------------------------------------------- - @Test public void testOne() { + @Test void testOne() { final List tomDickHarry = Arrays.asList("tom", "dick", "harry"); final Filterator filterator = new Filterator(tomDickHarry.iterator(), String.class); @@ -56,7 +56,7 @@ public class FilteratorTest { assertFalse(filterator.hasNext()); } - @Test public void testNulls() { + @Test void testNulls() { // Nulls don't cause an error - but are not emitted, because they // fail the instanceof test. final List tomDickHarry = Arrays.asList("paul", null, "ringo"); @@ -67,7 +67,7 @@ public class FilteratorTest { assertFalse(filterator.hasNext()); } - @Test public void testSubtypes() { + @Test void testSubtypes() { final ArrayList arrayList = new ArrayList(); final HashSet hashSet = new HashSet(); final LinkedList linkedList = new LinkedList(); @@ -92,7 +92,7 @@ public class FilteratorTest { assertFalse(filterator.hasNext()); } - @Test public void testBox() { + @Test void testBox() { final Number[] numbers = {1, 2, 3.14, 4, null, 6E23}; List result = new ArrayList(); for (int i : Util.filter(Arrays.asList(numbers), Integer.class)) { diff --git a/core/src/test/java/org/apache/calcite/test/FoodmartTest.java b/core/src/test/java/org/apache/calcite/test/FoodmartTest.java index ecb0815f962f..a84df257a3b3 100644 --- a/core/src/test/java/org/apache/calcite/test/FoodmartTest.java +++ b/core/src/test/java/org/apache/calcite/test/FoodmartTest.java @@ -38,7 +38,7 @@ * Test case that runs the FoodMart reference queries. */ @Tag("slow") -public class FoodmartTest { +class FoodmartTest { private static CalciteAssert.AssertThat assertFoodmart; private static CalciteAssert.AssertThat assertFoodmartLattice; diff --git a/core/src/test/java/org/apache/calcite/test/HepPlannerTest.java b/core/src/test/java/org/apache/calcite/test/HepPlannerTest.java index e25ab255c8c6..5b5fcc25776e 100644 --- a/core/src/test/java/org/apache/calcite/test/HepPlannerTest.java +++ b/core/src/test/java/org/apache/calcite/test/HepPlannerTest.java @@ -50,7 +50,7 @@ * convenience only, whereas the tests in that class are targeted at exercising * specific rules, and use the planner for convenience only. Hence the split. */ -public class HepPlannerTest extends RelOptTestBase { +class HepPlannerTest extends RelOptTestBase { //~ Static fields/initializers --------------------------------------------- private static final String UNION_TREE = @@ -87,7 +87,7 @@ protected DiffRepository getDiffRepos() { return DiffRepository.lookup(HepPlannerTest.class); } - @Test public void testRuleClass() throws Exception { + @Test void testRuleClass() throws Exception { // Verify that an entire class of rules can be applied. HepProgramBuilder programBuilder = HepProgram.builder(); @@ -109,7 +109,7 @@ protected DiffRepository getDiffRepos() { sql(sql).with(planner).check(); } - @Test public void testRuleDescription() throws Exception { + @Test void testRuleDescription() throws Exception { // Verify that a rule can be applied via its description. HepProgramBuilder programBuilder = HepProgram.builder(); @@ -129,7 +129,7 @@ protected DiffRepository getDiffRepos() { * Ensures {@link org.apache.calcite.rel.AbstractRelNode} digest does not include * full digest tree. */ - @Test public void relDigestLength() { + @Test void relDigestLength() { HepProgramBuilder programBuilder = HepProgram.builder(); HepPlanner planner = new HepPlanner( @@ -168,7 +168,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub + ", actual value is " + digest); } - @Test public void testMatchLimitOneTopDown() throws Exception { + @Test void testMatchLimitOneTopDown() throws Exception { // Verify that only the top union gets rewritten. HepProgramBuilder programBuilder = HepProgram.builder(); @@ -179,7 +179,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub sql(UNION_TREE).with(programBuilder.build()).check(); } - @Test public void testMatchLimitOneBottomUp() throws Exception { + @Test void testMatchLimitOneBottomUp() throws Exception { // Verify that only the bottom union gets rewritten. HepProgramBuilder programBuilder = HepProgram.builder(); @@ -190,7 +190,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub sql(UNION_TREE).with(programBuilder.build()).check(); } - @Test public void testMatchUntilFixpoint() throws Exception { + @Test void testMatchUntilFixpoint() throws Exception { // Verify that both unions get rewritten. HepProgramBuilder programBuilder = HepProgram.builder(); @@ -200,7 +200,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub sql(UNION_TREE).with(programBuilder.build()).check(); } - @Test public void testReplaceCommonSubexpression() throws Exception { + @Test void testReplaceCommonSubexpression() throws Exception { // Note that here it may look like the rule is firing // twice, but actually it's only firing once on the // common sub-expression. The purpose of this test @@ -215,7 +215,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub /** Tests that if two relational expressions are equivalent, the planner * notices, and only applies the rule once. */ - @Test public void testCommonSubExpression() { + @Test void testCommonSubExpression() { // In the following, // (select 1 from dept where abs(-1)=20) // occurs twice, but it's a common sub-expression, so the rule should only @@ -237,7 +237,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub assertThat(listener.getApplyTimes() == 1, is(true)); } - @Test public void testSubprogram() throws Exception { + @Test void testSubprogram() throws Exception { // Verify that subprogram gets re-executed until fixpoint. // In this case, the first time through we limit it to generate // only one calc; the second time through it will generate @@ -257,7 +257,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub sql(sql).with(programBuilder.build()).check(); } - @Test public void testGroup() throws Exception { + @Test void testGroup() throws Exception { // Verify simultaneous application of a group of rules. // Intentionally add them in the wrong order to make sure // that order doesn't matter within the group. @@ -272,7 +272,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub sql(sql).with(programBuilder.build()).check(); } - @Test public void testGC() throws Exception { + @Test void testGC() throws Exception { HepProgramBuilder programBuilder = HepProgram.builder(); programBuilder.addMatchOrder(HepMatchOrder.TOP_DOWN); programBuilder.addRuleInstance(CalcMergeRule.INSTANCE); @@ -289,7 +289,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub planner.findBestExp(); } - @Test public void testRelNodeCacheWithDigest() { + @Test void testRelNodeCacheWithDigest() { HepProgramBuilder programBuilder = HepProgram.builder(); HepPlanner planner = new HepPlanner( @@ -303,7 +303,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub .checkUnchanged(); } - @Test public void testRuleApplyCount() { + @Test void testRuleApplyCount() { final long applyTimes1 = checkRuleApplyCount(HepMatchOrder.ARBITRARY); assertThat(applyTimes1, is(316L)); @@ -311,7 +311,7 @@ private void assertIncludesExactlyOnce(String message, String digest, String sub assertThat(applyTimes2, is(87L)); } - @Test public void testMaterialization() throws Exception { + @Test void testMaterialization() throws Exception { HepPlanner planner = new HepPlanner(HepProgram.builder().build()); RelNode tableRel = tester.convertSqlToRel("select * from dept").rel; RelNode queryRel = tableRel; diff --git a/core/src/test/java/org/apache/calcite/test/InduceGroupingTypeTest.java b/core/src/test/java/org/apache/calcite/test/InduceGroupingTypeTest.java index be2ff51ebaad..716fe677808d 100644 --- a/core/src/test/java/org/apache/calcite/test/InduceGroupingTypeTest.java +++ b/core/src/test/java/org/apache/calcite/test/InduceGroupingTypeTest.java @@ -33,8 +33,8 @@ * Unit test for * {@link org.apache.calcite.rel.core.Aggregate.Group#induce(ImmutableBitSet, List)}. */ -public class InduceGroupingTypeTest { - @Test public void testInduceGroupingType() { +class InduceGroupingTypeTest { + @Test void testInduceGroupingType() { final ImmutableBitSet groupSet = ImmutableBitSet.of(1, 2, 4, 5); // SIMPLE @@ -155,7 +155,7 @@ public class InduceGroupingTypeTest { /** Tests a singleton grouping set {2}, whose power set has only two elements, * { {2}, {} }. */ - @Test public void testInduceGroupingType1() { + @Test void testInduceGroupingType1() { final ImmutableBitSet groupSet = ImmutableBitSet.of(2); // Could be ROLLUP but we prefer CUBE @@ -180,7 +180,7 @@ public class InduceGroupingTypeTest { Aggregate.Group.induce(groupSet, groupSets)); } - @Test public void testInduceGroupingType0() { + @Test void testInduceGroupingType0() { final ImmutableBitSet groupSet = ImmutableBitSet.of(); // Could be CUBE or ROLLUP but we choose SIMPLE diff --git a/core/src/test/java/org/apache/calcite/test/InterpreterTest.java b/core/src/test/java/org/apache/calcite/test/InterpreterTest.java index afa3a240a4d6..b33ee5d17231 100644 --- a/core/src/test/java/org/apache/calcite/test/InterpreterTest.java +++ b/core/src/test/java/org/apache/calcite/test/InterpreterTest.java @@ -48,7 +48,7 @@ /** * Unit tests for {@link org.apache.calcite.interpreter.Interpreter}. */ -public class InterpreterTest { +class InterpreterTest { private SchemaPlus rootSchema; private Planner planner; private MyDataContext dataContext; @@ -151,7 +151,7 @@ private void reset() { } /** Tests executing a simple plan using an interpreter. */ - @Test public void testInterpretProjectFilterValues() throws Exception { + @Test void testInterpretProjectFilterValues() throws Exception { final String sql = "select y, x\n" + "from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)\n" + "where x > 1"; @@ -159,14 +159,14 @@ private void reset() { } /** Tests a plan where the sort field is projected away. */ - @Test public void testInterpretOrder() throws Exception { + @Test void testInterpretOrder() throws Exception { final String sql = "select y\n" + "from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)\n" + "order by -x"; sql(sql).withProject(true).returnsRows("[c]", "[b]", "[a]"); } - @Test public void testInterpretMultiset() throws Exception { + @Test void testInterpretMultiset() throws Exception { final String sql = "select multiset['a', 'b', 'c']"; sql(sql).withProject(true).returnsRows("[[a, b, c]]"); } @@ -186,7 +186,7 @@ private static void assertRows(Interpreter interpreter, } /** Tests executing a simple plan using an interpreter. */ - @Test public void testInterpretTable() throws Exception { + @Test void testInterpretTable() throws Exception { sql("select * from \"hr\".\"emps\" order by \"empid\"") .returnsRows("[100, 10, Bill, 10000.0, 1000]", "[110, 10, Theodore, 11500.0, 250]", @@ -196,38 +196,38 @@ private static void assertRows(Interpreter interpreter, /** Tests executing a plan on a * {@link org.apache.calcite.schema.ScannableTable} using an interpreter. */ - @Test public void testInterpretScannableTable() throws Exception { + @Test void testInterpretScannableTable() throws Exception { rootSchema.add("beatles", new ScannableTableTest.BeatlesTable()); sql("select * from \"beatles\" order by \"i\"") .returnsRows("[4, John]", "[4, Paul]", "[5, Ringo]", "[6, George]"); } - @Test public void testAggregateCount() throws Exception { + @Test void testAggregateCount() throws Exception { rootSchema.add("beatles", new ScannableTableTest.BeatlesTable()); sql("select count(*) from \"beatles\"") .returnsRows("[4]"); } - @Test public void testAggregateMax() throws Exception { + @Test void testAggregateMax() throws Exception { rootSchema.add("beatles", new ScannableTableTest.BeatlesTable()); sql("select max(\"i\") from \"beatles\"") .returnsRows("[6]"); } - @Test public void testAggregateMin() throws Exception { + @Test void testAggregateMin() throws Exception { rootSchema.add("beatles", new ScannableTableTest.BeatlesTable()); sql("select min(\"i\") from \"beatles\"") .returnsRows("[4]"); } - @Test public void testAggregateGroup() throws Exception { + @Test void testAggregateGroup() throws Exception { rootSchema.add("beatles", new ScannableTableTest.BeatlesTable()); sql("select \"j\", count(*) from \"beatles\" group by \"j\"") .returnsRowsUnordered("[George, 1]", "[Paul, 1]", "[John, 1]", "[Ringo, 1]"); } - @Test public void testAggregateGroupFilter() throws Exception { + @Test void testAggregateGroupFilter() throws Exception { rootSchema.add("beatles", new ScannableTableTest.BeatlesTable()); final String sql = "select \"j\",\n" + " count(*) filter (where char_length(\"j\") > 4)\n" @@ -241,14 +241,14 @@ private static void assertRows(Interpreter interpreter, /** Tests executing a plan on a single-column * {@link org.apache.calcite.schema.ScannableTable} using an interpreter. */ - @Test public void testInterpretSimpleScannableTable() throws Exception { + @Test void testInterpretSimpleScannableTable() throws Exception { rootSchema.add("simple", new ScannableTableTest.SimpleTable()); sql("select * from \"simple\" limit 2") .returnsRows("[0]", "[10]"); } /** Tests executing a UNION ALL query using an interpreter. */ - @Test public void testInterpretUnionAll() throws Exception { + @Test void testInterpretUnionAll() throws Exception { rootSchema.add("simple", new ScannableTableTest.SimpleTable()); final String sql = "select * from \"simple\"\n" + "union all\n" @@ -258,7 +258,7 @@ private static void assertRows(Interpreter interpreter, } /** Tests executing a UNION query using an interpreter. */ - @Test public void testInterpretUnion() throws Exception { + @Test void testInterpretUnion() throws Exception { rootSchema.add("simple", new ScannableTableTest.SimpleTable()); final String sql = "select * from \"simple\"\n" + "union\n" @@ -266,7 +266,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRowsUnordered("[0]", "[10]", "[20]", "[30]"); } - @Test public void testInterpretUnionWithNullValue() throws Exception { + @Test void testInterpretUnionWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + "(cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" @@ -275,7 +275,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[null, null]"); } - @Test public void testInterpretUnionAllWithNullValue() throws Exception { + @Test void testInterpretUnionAllWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + "(cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" @@ -284,7 +284,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[null, null]", "[null, null]", "[null, null]"); } - @Test public void testInterpretIntersect() throws Exception { + @Test void testInterpretIntersect() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y))\n" + "intersect\n" @@ -292,7 +292,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[1, a]"); } - @Test public void testInterpretIntersectAll() throws Exception { + @Test void testInterpretIntersectAll() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y))\n" + "intersect all\n" @@ -300,7 +300,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[1, a]"); } - @Test public void testInterpretIntersectWithNullValue() throws Exception { + @Test void testInterpretIntersectWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + " (cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" @@ -309,7 +309,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[null, null]"); } - @Test public void testInterpretIntersectAllWithNullValue() throws Exception { + @Test void testInterpretIntersectAllWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + " (cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" @@ -318,7 +318,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[null, null]"); } - @Test public void testInterpretMinus() throws Exception { + @Test void testInterpretMinus() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (2, 'b'), (2, 'b'), (3, 'c')) as t(x, y))\n" + "except\n" @@ -326,7 +326,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[2, b]", "[3, c]"); } - @Test public void testDuplicateRowInterpretMinus() throws Exception { + @Test void testDuplicateRowInterpretMinus() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (2, 'b'), (2, 'b')) as t(x, y))\n" + "except\n" @@ -334,7 +334,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows(); } - @Test public void testInterpretMinusAll() throws Exception { + @Test void testInterpretMinusAll() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (2, 'b'), (2, 'b'), (3, 'c')) as t(x, y))\n" + "except all\n" @@ -342,7 +342,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[2, b]", "[2, b]", "[3, c]"); } - @Test public void testDuplicateRowInterpretMinusAll() throws Exception { + @Test void testDuplicateRowInterpretMinusAll() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (2, 'b'), (2, 'b')) as t(x, y))\n" + "except all\n" @@ -350,7 +350,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[2, b]"); } - @Test public void testInterpretMinusAllWithNullValue() throws Exception { + @Test void testInterpretMinusAllWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + " (cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" @@ -359,7 +359,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[null, null]"); } - @Test public void testInterpretMinusWithNullValue() throws Exception { + @Test void testInterpretMinusWithNullValue() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (cast(NULL as int), cast(NULL as varchar(1))),\n" + "(cast(NULL as int), cast(NULL as varchar(1)))) as t(x, y))\n" @@ -368,7 +368,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows(); } - @Test public void testInterpretInnerJoin() throws Exception { + @Test void testInterpretInnerJoin() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)) t\n" + "join\n" @@ -377,7 +377,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[1, a, 1, d]", "[2, b, 2, c]"); } - @Test public void testInterpretLeftOutJoin() throws Exception { + @Test void testInterpretLeftOutJoin() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)) t\n" + "left join\n" @@ -386,7 +386,7 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[1, a, 1, d]", "[2, b, null, null]", "[3, c, null, null]"); } - @Test public void testInterpretRightOutJoin() throws Exception { + @Test void testInterpretRightOutJoin() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'd')) as t2(x, y)) t2\n" + "right join\n" @@ -395,14 +395,14 @@ private static void assertRows(Interpreter interpreter, sql(sql).returnsRows("[1, d, 1, a]", "[null, null, 2, b]", "[null, null, 3, c]"); } - @Test public void testInterpretSemanticSemiJoin() throws Exception { + @Test void testInterpretSemanticSemiJoin() throws Exception { final String sql = "select x, y from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)\n" + "where x in\n" + "(select x from (values (1, 'd'), (3, 'g')) as t2(x, y))"; sql(sql).returnsRows("[1, a]", "[3, c]"); } - @Test public void testInterpretSemiJoin() throws Exception { + @Test void testInterpretSemiJoin() throws Exception { final String sql = "select x, y from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)\n" + "where x in\n" + "(select x from (values (1, 'd'), (3, 'g')) as t2(x, y))"; @@ -418,14 +418,14 @@ private static void assertRows(Interpreter interpreter, assertRows(interpreter, true, "[1, a]", "[3, c]"); } - @Test public void testInterpretAntiJoin() throws Exception { + @Test void testInterpretAntiJoin() throws Exception { final String sql = "select x, y from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)\n" + "where x not in\n" + "(select x from (values (1, 'd')) as t2(x, y))"; sql(sql).returnsRows("[2, b]", "[3, c]"); } - @Test public void testInterpretFullJoin() throws Exception { + @Test void testInterpretFullJoin() throws Exception { final String sql = "select * from\n" + "(select x, y from (values (1, 'a'), (2, 'b'), (3, 'c')) as t(x, y)) t\n" + "full join\n" @@ -438,14 +438,14 @@ private static void assertRows(Interpreter interpreter, "[null, null, 4, x]"); } - @Test public void testInterpretDecimalAggregate() throws Exception { + @Test void testInterpretDecimalAggregate() throws Exception { final String sql = "select x, min(y), max(y), sum(y), avg(y)\n" + "from (values ('a', -1.2), ('a', 2.3), ('a', 15)) as t(x, y)\n" + "group by x"; sql(sql).returnsRows("[a, -1.2, 15.0, 16.1, 5.366666666666667]"); } - @Test public void testInterpretUnnest() throws Exception { + @Test void testInterpretUnnest() throws Exception { sql("select * from unnest(array[1, 2])").returnsRows("[1]", "[2]"); reset(); diff --git a/core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java b/core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java index 82d00e3999e9..93d9225e2479 100644 --- a/core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java +++ b/core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java @@ -41,14 +41,14 @@ /** * Tests for the {@code org.apache.calcite.adapter.jdbc} package. */ -public class JdbcAdapterTest { +class JdbcAdapterTest { /** Ensures that tests that are modifying data (doing DML) do not run at the * same time. */ private static final ReentrantLock LOCK = new ReentrantLock(); /** VALUES is not pushed down, currently. */ - @Test public void testValuesPlan() { + @Test void testValuesPlan() { final String sql = "select * from \"days\", (values 1, 2) as t(c)"; final String explain = "PLAN=" + "EnumerableNestedLoopJoin(condition=[true], joinType=[inner])\n" @@ -66,7 +66,7 @@ public class JdbcAdapterTest { .planHasSql(jdbcSql); } - @Test public void testUnionPlan() { + @Test void testUnionPlan() { CalciteAssert.model(JdbcTest.FOODMART_MODEL) .query("select * from \"sales_fact_1997\"\n" + "union all\n" @@ -89,7 +89,7 @@ public class JdbcAdapterTest { * [CALCITE-3115] * Cannot add JdbcRules which have different JdbcConvention * to same VolcanoPlanner's RuleSet.*/ - @Test public void testUnionPlan2() { + @Test void testUnionPlan2() { CalciteAssert.model(JdbcTest.FOODMART_SCOTT_MODEL) .query("select \"store_name\" from \"foodmart\".\"store\" where \"store_id\" < 10\n" + "union all\n" @@ -113,7 +113,7 @@ public class JdbcAdapterTest { + "WHERE \"EMPNO\" > 10"); } - @Test public void testFilterUnionPlan() { + @Test void testFilterUnionPlan() { CalciteAssert.model(JdbcTest.FOODMART_MODEL) .query("select * from (\n" + " select * from \"sales_fact_1997\"\n" @@ -131,7 +131,7 @@ public class JdbcAdapterTest { + "WHERE \"product_id\" = 1"); } - @Test public void testInPlan() { + @Test void testInPlan() { CalciteAssert.model(JdbcTest.FOODMART_MODEL) .query("select \"store_id\", \"store_name\" from \"store\"\n" + "where \"store_name\" in ('Store 1', 'Store 10', 'Store 11', 'Store 15', 'Store 16', 'Store 24', 'Store 3', 'Store 7')") @@ -154,7 +154,7 @@ public class JdbcAdapterTest { + "store_id=24; store_name=Store 24\n"); } - @Test public void testEquiJoinPlan() { + @Test void testEquiJoinPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, e.deptno, dname\n" + "from scott.emp e inner join scott.dept d\n" @@ -177,7 +177,7 @@ public class JdbcAdapterTest { + "ON \"t\".\"DEPTNO\" = \"t0\".\"DEPTNO\""); } - @Test public void testPushDownSort() { + @Test void testPushDownSort() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select ename\n" + "from scott.emp\n" @@ -196,7 +196,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-3751] * JDBC adapter wrongly pushes ORDER BY into sub-query. */ - @Test public void testOrderByPlan() { + @Test void testOrderByPlan() { final String sql = "select deptno, job, sum(sal)\n" + "from \"EMP\"\n" + "group by deptno, job\n" @@ -221,7 +221,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-631] * Push theta joins down to JDBC adapter. */ - @Test public void testNonEquiJoinPlan() { + @Test void testNonEquiJoinPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, grade\n" + "from scott.emp e inner join scott.salgrade s\n" @@ -242,7 +242,7 @@ public class JdbcAdapterTest { + "AND \"t\".\"SAL\" < \"SALGRADE\".\"HISAL\""); } - @Test public void testNonEquiJoinReverseConditionPlan() { + @Test void testNonEquiJoinReverseConditionPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, grade\n" + "from scott.emp e inner join scott.salgrade s\n" @@ -262,7 +262,7 @@ public class JdbcAdapterTest { + "AND \"t\".\"SAL\" <= \"SALGRADE\".\"HISAL\""); } - @Test public void testMixedJoinPlan() { + @Test void testMixedJoinPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select e.empno, e.ename, e.empno, e.ename\n" + "from scott.emp e inner join scott.emp m on\n" @@ -285,7 +285,7 @@ public class JdbcAdapterTest { + "ON \"t\".\"MGR\" = \"t0\".\"EMPNO\" AND \"t\".\"SAL\" > \"t0\".\"SAL\""); } - @Test public void testMixedJoinWithOrPlan() { + @Test void testMixedJoinWithOrPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select e.empno, e.ename, e.empno, e.ename\n" + "from scott.emp e inner join scott.emp m on\n" @@ -309,7 +309,7 @@ public class JdbcAdapterTest { + "AND (\"t\".\"SAL\" > \"t0\".\"SAL\" OR \"t\".\"HIREDATE\" < \"t0\".\"HIREDATE\")"); } - @Test public void testJoin3TablesPlan() { + @Test void testJoin3TablesPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, dname, grade\n" + "from scott.emp e inner join scott.dept d\n" @@ -338,7 +338,7 @@ public class JdbcAdapterTest { + "AND \"t\".\"SAL\" < \"SALGRADE\".\"HISAL\""); } - @Test public void testCrossJoinWithJoinKeyPlan() { + @Test void testCrossJoinWithJoinKeyPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, d.deptno, dname\n" + "from scott.emp e,scott.dept d\n" @@ -360,7 +360,7 @@ public class JdbcAdapterTest { } // JdbcJoin not used for this - @Test public void testCartesianJoinWithoutKeyPlan() { + @Test void testCartesianJoinWithoutKeyPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, d.deptno, dname\n" + "from scott.emp e,scott.dept d") @@ -376,7 +376,7 @@ public class JdbcAdapterTest { .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB); } - @Test public void testCrossJoinWithJoinKeyAndFilterPlan() { + @Test void testCrossJoinWithJoinKeyAndFilterPlan() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("select empno, ename, d.deptno, dname\n" + "from scott.emp e,scott.dept d\n" @@ -404,7 +404,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-893] * Theta join in JdbcAdapter. */ - @Test public void testJoinPlan() { + @Test void testJoinPlan() { final String sql = "SELECT T1.\"brand_name\"\n" + "FROM \"foodmart\".\"product\" AS T1\n" + " INNER JOIN \"foodmart\".\"product_class\" AS T2\n" @@ -420,7 +420,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-1372] * JDBC adapter generates SQL with wrong field names. */ - @Test public void testJoinPlan2() { + @Test void testJoinPlan2() { final String sql = "SELECT v1.deptno, v2.deptno\n" + "FROM Scott.dept v1 LEFT JOIN Scott.emp v2 ON v1.deptno = v2.deptno\n" + "WHERE v2.job LIKE 'PRESIDENT'"; @@ -430,13 +430,13 @@ public class JdbcAdapterTest { .returnsCount(1); } - @Test public void testJoinCartesian() { + @Test void testJoinCartesian() { final String sql = "SELECT *\n" + "FROM Scott.dept, Scott.emp"; CalciteAssert.model(JdbcTest.SCOTT_MODEL).query(sql).returnsCount(56); } - @Test public void testJoinCartesianCount() { + @Test void testJoinCartesianCount() { final String sql = "SELECT count(*) as c\n" + "FROM Scott.dept, Scott.emp"; CalciteAssert.model(JdbcTest.SCOTT_MODEL).query(sql).returns("C=56\n"); @@ -445,7 +445,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-657] * NullPointerException when executing JdbcAggregate implement method. */ - @Test public void testJdbcAggregate() throws Exception { + @Test void testJdbcAggregate() throws Exception { final String url = MultiJdbcSchemaJoinTest.TempDb.INSTANCE.getUrl(); Connection baseConnection = DriverManager.getConnection(url); Statement baseStmt = baseConnection.createStatement(); @@ -491,7 +491,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-2206] * JDBC adapter incorrectly pushes windowed aggregates down to HSQLDB. */ - @Test public void testOverNonSupportedDialect() { + @Test void testOverNonSupportedDialect() { final String sql = "select \"store_id\", \"account_id\", \"exp_date\",\n" + " \"time_id\", \"category_id\", \"currency_id\", \"amount\",\n" + " last_value(\"time_id\") over () as \"last_version\"\n" @@ -510,7 +510,7 @@ public class JdbcAdapterTest { + "FROM \"foodmart\".\"expense_fact\""); } - @Test public void testTablesNoCatalogSchema() { + @Test void testTablesNoCatalogSchema() { final String model = JdbcTest.FOODMART_MODEL .replace("jdbcCatalog: 'foodmart'", "jdbcCatalog: null") @@ -544,7 +544,7 @@ public class JdbcAdapterTest { * *

Test runs only on Postgres; the default database, Hsqldb, does not * support OVER. */ - @Test public void testOverDefault() { + @Test void testOverDefault() { CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.POSTGRESQL) @@ -570,7 +570,7 @@ public class JdbcAdapterTest { * [CALCITE-2305] * JDBC adapter generates invalid casts on PostgreSQL, because PostgreSQL does * not have TINYINT and DOUBLE types. */ - @Test public void testCast() { + @Test void testCast() { CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.POSTGRESQL) @@ -583,7 +583,7 @@ public class JdbcAdapterTest { + "FROM \"foodmart\".\"expense_fact\""); } - @Test public void testOverRowsBetweenBoundFollowingAndFollowing() { + @Test void testOverRowsBetweenBoundFollowingAndFollowing() { CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.POSTGRESQL) @@ -607,7 +607,7 @@ public class JdbcAdapterTest { + "FROM \"foodmart\".\"expense_fact\""); } - @Test public void testOverRowsBetweenBoundPrecedingAndCurrent() { + @Test void testOverRowsBetweenBoundPrecedingAndCurrent() { CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.POSTGRESQL) @@ -631,7 +631,7 @@ public class JdbcAdapterTest { + "FROM \"foodmart\".\"expense_fact\""); } - @Test public void testOverDisallowPartial() { + @Test void testOverDisallowPartial() { CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.POSTGRESQL) @@ -661,7 +661,7 @@ public class JdbcAdapterTest { + "FROM \"foodmart\".\"expense_fact\""); } - @Test public void testLastValueOver() { + @Test void testLastValueOver() { CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.POSTGRESQL) @@ -689,7 +689,7 @@ public class JdbcAdapterTest { * [CALCITE-259] * Using sub-queries in CASE statement against JDBC tables generates invalid * Oracle SQL. */ - @Test public void testSubQueryWithSingleValue() { + @Test void testSubQueryWithSingleValue() { final String expected; switch (CalciteAssert.DB) { case MYSQL: @@ -711,7 +711,7 @@ public class JdbcAdapterTest { * Unknown table type causes NullPointerException in JdbcSchema. The issue * occurred because of the "SYSTEM_INDEX" table type when run against * PostgreSQL. */ - @Test public void testMetadataTables() throws Exception { + @Test void testMetadataTables() throws Exception { // The troublesome tables occur in PostgreSQL's system schema. final String model = JdbcTest.FOODMART_MODEL.replace("jdbcSchema: 'foodmart'", @@ -732,7 +732,7 @@ public class JdbcAdapterTest { /** Test case for * [CALCITE-666] * Anti-semi-joins against JDBC adapter give wrong results. */ - @Test public void testScalarSubQuery() { + @Test void testScalarSubQuery() { CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query("SELECT COUNT(empno) AS cEmpNo FROM \"SCOTT\".\"EMP\" " + "WHERE DEPTNO <> (SELECT * FROM (VALUES 1))") @@ -795,7 +795,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { /** Test case for * [CALCITE-1527] * Support DML in the JDBC adapter. */ - @Test public void testTableModifyInsert() throws Exception { + @Test void testTableModifyInsert() throws Exception { final String sql = "INSERT INTO \"foodmart\".\"expense_fact\"(\n" + " \"store_id\", \"account_id\", \"exp_date\", \"time_id\"," + " \"category_id\", \"currency_id\", \"amount\")\n" @@ -828,7 +828,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { }); } - @Test public void testTableModifyInsertMultiValues() throws Exception { + @Test void testTableModifyInsertMultiValues() throws Exception { final String sql = "INSERT INTO \"foodmart\".\"expense_fact\"(\n" + " \"store_id\", \"account_id\", \"exp_date\", \"time_id\"," + " \"category_id\", \"currency_id\", \"amount\")\n" @@ -867,7 +867,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { }); } - @Test public void testTableModifyInsertWithSubQuery() throws Exception { + @Test void testTableModifyInsertWithSubQuery() throws Exception { final AssertThat that = CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == DatabaseInstance.HSQLDB); @@ -904,7 +904,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { }); } - @Test public void testTableModifyUpdate() throws Exception { + @Test void testTableModifyUpdate() throws Exception { final AssertThat that = CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == DatabaseInstance.HSQLDB); @@ -932,7 +932,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { }); } - @Test public void testTableModifyDelete() throws Exception { + @Test void testTableModifyDelete() throws Exception { final AssertThat that = CalciteAssert .model(JdbcTest.FOODMART_MODEL) .enable(CalciteAssert.DB == DatabaseInstance.HSQLDB); @@ -959,7 +959,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { /** Test case for * [CALCITE-1572] * JdbcSchema throws exception when detecting nullable columns. */ - @Test public void testColumnNullability() throws Exception { + @Test void testColumnNullability() throws Exception { final String sql = "select \"employee_id\", \"position_id\"\n" + "from \"foodmart\".\"employee\" limit 10"; CalciteAssert.model(JdbcTest.FOODMART_MODEL) @@ -969,7 +969,7 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException { .typeIs("[employee_id INTEGER NOT NULL, position_id INTEGER]"); } - @Test public void pushBindParameters() throws Exception { + @Test void pushBindParameters() throws Exception { final String sql = "select empno, ename from emp where empno = ?"; CalciteAssert.model(JdbcTest.SCOTT_MODEL) .query(sql) diff --git a/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackLinqMiddleTest.java b/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackLinqMiddleTest.java index fd58c5ae235c..48293f65152b 100644 --- a/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackLinqMiddleTest.java +++ b/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackLinqMiddleTest.java @@ -28,9 +28,9 @@ * pushed down to JDBC (as in {@link JdbcFrontJdbcBackTest}) but is executed * in a pipeline of linq4j operators. */ -public class JdbcFrontJdbcBackLinqMiddleTest { +class JdbcFrontJdbcBackLinqMiddleTest { - @Test public void testTable() { + @Test void testTable() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select * from \"foodmart\".\"days\"") @@ -43,7 +43,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + "day=7; week_day=Saturday\n"); } - @Test public void testWhere() { + @Test void testWhere() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select * from \"foodmart\".\"days\" where \"day\" < 3") @@ -51,7 +51,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + "day=2; week_day=Monday\n"); } - @Test public void testWhere2() { + @Test void testWhere2() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select * from \"foodmart\".\"days\"\n" @@ -64,7 +64,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + "day=7; week_day=Saturday\n"); } - @Test public void testCase() { + @Test void testCase() { that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"day\",\n" @@ -83,7 +83,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + "day=7; week_day=Saturday; D=Saturday\n"); } - @Test public void testGroup() { + @Test void testGroup() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select s, count(*) as c, min(\"week_day\") as mw from (\n" @@ -99,7 +99,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { "S=M; C=1; MW=Monday"); } - @Test public void testGroupEmpty() { + @Test void testGroupEmpty() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select count(*) as c\n" @@ -114,7 +114,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { * cartesian product).

*/ @Disabled("non-deterministic on JDK 1.7 vs 1.8") - @Test public void testJoinTheta() { + @Test void testJoinTheta() { that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select count(*) from (\n" @@ -133,7 +133,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + " JdbcTableScan(table=[[foodmart, customer]])"); } - @Test public void testJoinGroupByEmpty() { + @Test void testJoinGroupByEmpty() { if (CalciteAssert.DB == CalciteAssert.DatabaseInstance.MYSQL && !Bug.CALCITE_673_FIXED) { return; @@ -148,7 +148,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { .returns("EXPR$0=86837\n"); } - @Test public void testJoinGroupByOrderBy() { + @Test void testJoinGroupByOrderBy() { if (CalciteAssert.DB == CalciteAssert.DatabaseInstance.MYSQL && !Bug.CALCITE_673_FIXED) { return; @@ -167,7 +167,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + "EXPR$0=40784; state_province=WA; S=124366\n"); } - @Test public void testCompositeGroupBy() { + @Test void testCompositeGroupBy() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select count(*) as c, c.\"state_province\"\n" @@ -190,7 +190,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { } @Disabled - @Test public void testDistinctCount() { + @Test void testDistinctCount() { // Complicating factors: // Composite GROUP BY key // Order by select item, referenced by ordinal @@ -218,7 +218,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { } @Disabled - @Test public void testPlan() { + @Test void testPlan() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select c.\"state_province\"\n" @@ -236,7 +236,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { } @Disabled - @Test public void testPlan2() { + @Test void testPlan2() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .withDefaultSchema("foodmart") @@ -259,7 +259,7 @@ public class JdbcFrontJdbcBackLinqMiddleTest { + " }\n"); } - @Test public void testPlan3() { + @Test void testPlan3() { // Plan should contain 'join'. If it doesn't, maybe int-vs-Integer // data type incompatibility has caused it to use a cartesian product // instead, and that would be wrong. diff --git a/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackTest.java b/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackTest.java index d1feda56d63a..3edb668637ff 100644 --- a/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackTest.java +++ b/core/src/test/java/org/apache/calcite/test/JdbcFrontJdbcBackTest.java @@ -41,8 +41,8 @@ * * @see JdbcFrontJdbcBackLinqMiddleTest */ -public class JdbcFrontJdbcBackTest { - @Test public void testWhere2() { +class JdbcFrontJdbcBackTest { + @Test void testWhere2() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select * from \"foodmart\".\"days\" where \"day\" < 3") @@ -51,7 +51,7 @@ public class JdbcFrontJdbcBackTest { } @Disabled - @Test public void testTables() throws Exception { + @Test void testTables() throws Exception { that() .with(CalciteAssert.Config.JDBC_FOODMART) .doWithConnection(connection -> { @@ -72,7 +72,7 @@ public class JdbcFrontJdbcBackTest { }); } - @Test public void testTablesByType() throws Exception { + @Test void testTablesByType() throws Exception { // check with the form recommended by JDBC checkTablesByType("SYSTEM TABLE", is("COLUMNS;TABLES;")); // the form we used until 1.14 no longer generates results @@ -97,7 +97,7 @@ private void checkTablesByType(final String tableType, }); } - @Test public void testColumns() throws Exception { + @Test void testColumns() throws Exception { that() .with(CalciteAssert.Config.JDBC_FOODMART) .doWithConnection(connection -> { @@ -121,7 +121,7 @@ private void checkTablesByType(final String tableType, /** Tests a JDBC method known to be not implemented (as it happens, * {@link java.sql.DatabaseMetaData#getPrimaryKeys}) that therefore uses * empty result set. */ - @Test public void testEmpty() throws Exception { + @Test void testEmpty() throws Exception { that() .with(CalciteAssert.Config.JDBC_FOODMART) .doWithConnection(connection -> { @@ -136,7 +136,7 @@ private void checkTablesByType(final String tableType, }); } - @Test public void testCase() { + @Test void testCase() { that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select\n" diff --git a/core/src/test/java/org/apache/calcite/test/JdbcFrontLinqBackTest.java b/core/src/test/java/org/apache/calcite/test/JdbcFrontLinqBackTest.java index 07747c4ad6ce..ff8dce33b6de 100644 --- a/core/src/test/java/org/apache/calcite/test/JdbcFrontLinqBackTest.java +++ b/core/src/test/java/org/apache/calcite/test/JdbcFrontLinqBackTest.java @@ -62,7 +62,7 @@ public class JdbcFrontLinqBackTest { /** * Runs a simple query that reads from a table in an in-memory schema. */ - @Test public void testSelect() { + @Test void testSelect() { hr() .query("select *\n" + "from \"foodmart\".\"sales_fact_1997\" as s\n" @@ -73,7 +73,7 @@ public class JdbcFrontLinqBackTest { /** * Runs a simple query that joins between two in-memory schemas. */ - @Test public void testJoin() { + @Test void testJoin() { hr() .query("select *\n" + "from \"foodmart\".\"sales_fact_1997\" as s\n" @@ -87,7 +87,7 @@ public class JdbcFrontLinqBackTest { /** * Simple GROUP BY. */ - @Test public void testGroupBy() { + @Test void testGroupBy() { hr() .query("select \"deptno\", sum(\"empid\") as s, count(*) as c\n" + "from \"hr\".\"emps\" as e\n" @@ -99,7 +99,7 @@ public class JdbcFrontLinqBackTest { /** * Simple ORDER BY. */ - @Test public void testOrderBy() { + @Test void testOrderBy() { hr() .query("select upper(\"name\") as un, \"deptno\"\n" + "from \"hr\".\"emps\" as e\n" @@ -120,7 +120,7 @@ public class JdbcFrontLinqBackTest { *

Also tests a query that returns a single column. We optimize this case * internally, using non-array representations for rows.

*/ - @Test public void testUnionAllOrderBy() { + @Test void testUnionAllOrderBy() { hr() .query("select \"name\"\n" + "from \"hr\".\"emps\" as e\n" @@ -140,7 +140,7 @@ public class JdbcFrontLinqBackTest { /** * Tests UNION. */ - @Test public void testUnion() { + @Test void testUnion() { hr() .query("select substring(\"name\" from 1 for 1) as x\n" + "from \"hr\".\"emps\" as e\n" @@ -159,7 +159,7 @@ public class JdbcFrontLinqBackTest { /** * Tests INTERSECT. */ - @Test public void testIntersect() { + @Test void testIntersect() { hr() .query("select substring(\"name\" from 1 for 1) as x\n" + "from \"hr\".\"emps\" as e\n" @@ -173,7 +173,7 @@ public class JdbcFrontLinqBackTest { * Tests EXCEPT. */ @Disabled - @Test public void testExcept() { + @Test void testExcept() { hr() .query("select substring(\"name\" from 1 for 1) as x\n" + "from \"hr\".\"emps\" as e\n" @@ -186,7 +186,7 @@ public class JdbcFrontLinqBackTest { "X=B"); } - @Test public void testWhereBad() { + @Test void testWhereBad() { hr() .query("select *\n" + "from \"foodmart\".\"sales_fact_1997\" as s\n" @@ -197,7 +197,7 @@ public class JdbcFrontLinqBackTest { /** Test case for * [CALCITE-9] * RexToLixTranslator not incrementing local variable name counter. */ - @Test public void testWhereOr() { + @Test void testWhereOr() { hr() .query("select * from \"hr\".\"emps\"\n" + "where (\"empid\" = 100 or \"empid\" = 200)\n" @@ -206,7 +206,7 @@ public class JdbcFrontLinqBackTest { "empid=100; deptno=10; name=Bill; salary=10000.0; commission=1000\n"); } - @Test public void testWhereLike() { + @Test void testWhereLike() { hr() .query("select *\n" + "from \"hr\".\"emps\" as e\n" @@ -217,7 +217,7 @@ public class JdbcFrontLinqBackTest { + "empid=110; deptno=10; name=Theodore; salary=11500.0; commission=250\n"); } - @Test public void testInsert() { + @Test void testInsert() { final List employees = new ArrayList<>(); CalciteAssert.AssertThat with = mutable(employees); with.query("select * from \"foo\".\"bar\"") @@ -240,7 +240,7 @@ public class JdbcFrontLinqBackTest { "name=Sebastian; C=2"); } - @Test public void testInsertBind() throws Exception { + @Test void testInsertBind() throws Exception { final List employees = new ArrayList<>(); CalciteAssert.AssertThat with = mutable(employees); with.query("select count(*) as c from \"foo\".\"bar\"") @@ -266,7 +266,7 @@ public class JdbcFrontLinqBackTest { "empid=1; deptno=0; name=foo; salary=10.0; commission=null"); } - @Test public void testDelete() { + @Test void testDelete() { final List employees = new ArrayList<>(); CalciteAssert.AssertThat with = mutable(employees); with.query("select * from \"foo\".\"bar\"") @@ -378,7 +378,7 @@ public Collection getModifiableCollection() { }; } - @Test public void testInsert2() { + @Test void testInsert2() { final List employees = new ArrayList<>(); CalciteAssert.AssertThat with = mutable(employees); with.query("insert into \"foo\".\"bar\" values (1, 1, 'second', 2, 2)") @@ -397,7 +397,7 @@ public Collection getModifiableCollection() { /** * Local Statement insert */ - @Test public void testInsert3() throws Exception { + @Test void testInsert3() throws Exception { Connection connection = makeConnection(new ArrayList()); String sql = "insert into \"foo\".\"bar\" values (1, 1, 'second', 2, 2)"; @@ -413,7 +413,7 @@ public Collection getModifiableCollection() { /** * Local PreparedStatement insert WITHOUT bind variables */ - @Test public void testPreparedStatementInsert() throws Exception { + @Test void testPreparedStatementInsert() throws Exception { Connection connection = makeConnection(new ArrayList()); assertFalse(connection.isClosed()); @@ -432,11 +432,11 @@ public Collection getModifiableCollection() { /** * Local PreparedStatement insert WITH bind variables */ - @Test public void testPreparedStatementInsert2() throws Exception { + @Test void testPreparedStatementInsert2() throws Exception { } /** Some of the rows have the wrong number of columns. */ - @Test public void testInsertMultipleRowMismatch() { + @Test void testInsertMultipleRowMismatch() { final List employees = new ArrayList<>(); CalciteAssert.AssertThat with = mutable(employees); with.query("insert into \"foo\".\"bar\" values\n" diff --git a/core/src/test/java/org/apache/calcite/test/JdbcTest.java b/core/src/test/java/org/apache/calcite/test/JdbcTest.java index d8799ad1e8ff..720b7f58f444 100644 --- a/core/src/test/java/org/apache/calcite/test/JdbcTest.java +++ b/core/src/test/java/org/apache/calcite/test/JdbcTest.java @@ -257,7 +257,7 @@ public static List> getFoodmartQueries() { } /** Tests a modifiable view. */ - @Test public void testModelWithModifiableView() throws Exception { + @Test void testModelWithModifiableView() throws Exception { final List employees = new ArrayList<>(); employees.add(new Employee(135, 10, "Simon", 56.7f, null)); try (TryThreadLocal.Memo ignore = @@ -329,7 +329,7 @@ public static List> getFoodmartQueries() { } /** Tests a few cases where modifiable views are invalid. */ - @Test public void testModelWithInvalidModifiableView() throws Exception { + @Test void testModelWithInvalidModifiableView() throws Exception { final List employees = new ArrayList<>(); employees.add(new Employee(135, 10, "Simon", 56.7f, null)); try (TryThreadLocal.Memo ignore = @@ -430,7 +430,7 @@ private void addTableMacro(Connection connection, Method method) throws SQLExcep * {@link Table} and the actual returned value implements * {@link org.apache.calcite.schema.TranslatableTable}. */ - @Test public void testTableMacro() + @Test void testTableMacro() throws SQLException, ClassNotFoundException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); @@ -451,7 +451,7 @@ private void addTableMacro(Connection connection, Method method) throws SQLExcep *

Test case for * [CALCITE-588] * Allow TableMacro to consume Maps and Collections. */ - @Test public void testTableMacroMap() + @Test void testTableMacroMap() throws SQLException, ClassNotFoundException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); @@ -470,7 +470,7 @@ private void addTableMacro(Connection connection, Method method) throws SQLExcep *

Test case for * [CALCITE-3423] * Support using CAST operation and BOOLEAN type value in table macro. */ - @Test public void testTableMacroWithCastOrBoolean() throws SQLException { + @Test void testTableMacroWithCastOrBoolean() throws SQLException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); addTableMacro(connection, Smalls.STR_METHOD); @@ -513,7 +513,7 @@ private void addTableMacro(Connection connection, Method method) throws SQLExcep } /** Tests a table macro with named and optional parameters. */ - @Test public void testTableMacroWithNamedParameters() throws Exception { + @Test void testTableMacroWithNamedParameters() throws Exception { // View(String r optional, String s, int t optional) final CalciteAssert.AssertThat with = assertWithMacro(Smalls.TableMacroFunctionWithNamedParameters.class); @@ -546,25 +546,25 @@ private void addTableMacro(Connection connection, Method method) throws SQLExcep /** Tests a JDBC connection that provides a model that contains a table * macro. */ - @Test public void testTableMacroInModel() throws Exception { + @Test void testTableMacroInModel() throws Exception { checkTableMacroInModel(Smalls.TableMacroFunction.class); } /** Tests a JDBC connection that provides a model that contains a table * macro defined as a static method. */ - @Test public void testStaticTableMacroInModel() throws Exception { + @Test void testStaticTableMacroInModel() throws Exception { checkTableMacroInModel(Smalls.StaticTableMacroFunction.class); } /** Tests a JDBC connection that provides a model that contains a table * function. */ - @Test public void testTableFunctionInModel() throws Exception { + @Test void testTableFunctionInModel() throws Exception { checkTableFunctionInModel(Smalls.MyTableFunction.class); } /** Tests a JDBC connection that provides a model that contains a table * function defined as a static method. */ - @Test public void testStaticTableFunctionInModel() throws Exception { + @Test void testStaticTableFunctionInModel() throws Exception { checkTableFunctionInModel(Smalls.TestStaticTableFunction.class); } @@ -617,7 +617,7 @@ private void checkTableFunctionInModel(Class clazz) { /** Tests {@link org.apache.calcite.avatica.Handler#onConnectionClose} * and {@link org.apache.calcite.avatica.Handler#onStatementClose}. */ - @Test public void testOnConnectionClose() throws Exception { + @Test void testOnConnectionClose() throws Exception { final int[] closeCount = {0}; final int[] statementCloseCount = {0}; final HandlerImpl h = new HandlerImpl() { @@ -683,7 +683,7 @@ private void checkTableFunctionInModel(Class clazz) { } /** Tests {@link java.sql.Statement}.{@code closeOnCompletion()}. */ - @Test public void testStatementCloseOnCompletion() throws Exception { + @Test void testStatementCloseOnCompletion() throws Exception { String javaVersion = System.getProperty("java.version"); if (javaVersion.compareTo("1.7") < 0) { // Statement.closeOnCompletion was introduced in JDK 1.7. @@ -722,7 +722,7 @@ private void checkTableFunctionInModel(Class clazz) { * [CALCITE-2071] * Query with IN and OR in WHERE clause returns wrong result. * More cases in sub-query.iq. */ - @Test public void testWhereInOr() { + @Test void testWhereInOr() { final String sql = "select \"empid\"\n" + "from \"hr\".\"emps\" t\n" + "where (\"empid\" in (select \"empid\" from \"hr\".\"emps\")\n" @@ -738,7 +738,7 @@ private void checkTableFunctionInModel(Class clazz) { /** Tests that a driver can be extended with its own parser and can execute * its own flavor of DDL. */ - @Test public void testMockDdl() throws Exception { + @Test void testMockDdl() throws Exception { final MockDdlDriver driver = new MockDdlDriver(); try (Connection connection = driver.connect("jdbc:calcite:", new Properties()); @@ -752,7 +752,7 @@ private void checkTableFunctionInModel(Class clazz) { /** * The example in the README. */ - @Test public void testReadme() throws ClassNotFoundException, SQLException { + @Test void testReadme() throws ClassNotFoundException, SQLException { Properties info = new Properties(); info.setProperty("lex", "JAVA"); Connection connection = DriverManager.getConnection("jdbc:calcite:", info); @@ -776,7 +776,7 @@ private void checkTableFunctionInModel(Class clazz) { } /** Test for {@link Driver#getPropertyInfo(String, Properties)}. */ - @Test public void testConnectionProperties() throws ClassNotFoundException, + @Test void testConnectionProperties() throws ClassNotFoundException, SQLException { java.sql.Driver driver = DriverManager.getDriver("jdbc:calcite:"); final DriverPropertyInfo[] propertyInfo = @@ -793,7 +793,7 @@ private void checkTableFunctionInModel(Class clazz) { /** * Make sure that the properties look sane. */ - @Test public void testVersion() throws ClassNotFoundException, SQLException { + @Test void testVersion() throws ClassNotFoundException, SQLException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); @@ -846,7 +846,7 @@ private String mm(int majorVersion, int minorVersion) { } /** Tests driver's implementation of {@link DatabaseMetaData#getColumns}. */ - @Test public void testMetaDataColumns() + @Test void testMetaDataColumns() throws ClassNotFoundException, SQLException { Connection connection = CalciteAssert .that(CalciteAssert.Config.REGULAR).connect(); @@ -867,7 +867,7 @@ private String mm(int majorVersion, int minorVersion) { /** Tests driver's implementation of {@link DatabaseMetaData#getPrimaryKeys}. * It is empty but it should still have column definitions. */ - @Test public void testMetaDataPrimaryKeys() + @Test void testMetaDataPrimaryKeys() throws ClassNotFoundException, SQLException { Connection connection = CalciteAssert .that(CalciteAssert.Config.REGULAR).connect(); @@ -885,7 +885,7 @@ private String mm(int majorVersion, int minorVersion) { /** Unit test for * {@link org.apache.calcite.jdbc.CalciteMetaImpl#likeToRegex(org.apache.calcite.avatica.Meta.Pat)}. */ - @Test public void testLikeToRegex() { + @Test void testLikeToRegex() { checkLikeToRegex(true, "%", "abc"); checkLikeToRegex(true, "abc", "abc"); checkLikeToRegex(false, "abc", "abcd"); // trailing char fails match @@ -918,7 +918,7 @@ private void checkLikeToRegex(boolean b, String pattern, String abc) { * [CALCITE-1222] * DatabaseMetaData.getColumnLabel returns null when query has ORDER * BY, */ - @Test public void testResultSetMetaData() + @Test void testResultSetMetaData() throws ClassNotFoundException, SQLException { try (Connection connection = CalciteAssert.that(CalciteAssert.Config.REGULAR).connect()) { @@ -953,7 +953,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Tests some queries that have expedited processing because connection pools * like to use them to check whether the connection is alive. */ - @Test public void testSimple() { + @Test void testSimple() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("SELECT 1") @@ -961,7 +961,7 @@ private void checkResultSetMetaData(Connection connection, String sql) } /** Tests accessing columns by name. */ - @Test public void testGetByName() throws Exception { + @Test void testGetByName() throws Exception { // JDBC 3.0 specification: "Column names supplied to getter methods are case // insensitive. If a select list contains the same column more than once, // the first instance of the column will be returned." @@ -1018,7 +1018,7 @@ private void checkResultSetMetaData(Connection connection, String sql) }); } - @Test public void testCloneSchema() + @Test void testCloneSchema() throws ClassNotFoundException, SQLException { final Connection connection = CalciteAssert.that(CalciteAssert.Config.JDBC_FOODMART).connect(); @@ -1037,7 +1037,7 @@ private void checkResultSetMetaData(Connection connection, String sql) connection.close(); } - @Test public void testCloneGroupBy() { + @Test void testCloneGroupBy() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"the_year\", count(*) as c, min(\"the_month\") as m\n" @@ -1050,7 +1050,7 @@ private void checkResultSetMetaData(Connection connection, String sql) } @Disabled("The test returns expected results. Not sure why it is disabled") - @Test public void testCloneGroupBy2() { + @Test void testCloneGroupBy2() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query( @@ -1072,7 +1072,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Tests plan for a query with 4 tables, 3 joins. */ @Disabled("The actual and expected plan differ") - @Test public void testCloneGroupBy2Plan() { + @Test void testCloneGroupBy2Plan() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query( @@ -1090,7 +1090,7 @@ private void checkResultSetMetaData(Connection connection, String sql) + "\n"); } - @Test public void testOrderByCase() { + @Test void testOrderByCase() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query( @@ -1100,7 +1100,7 @@ private void checkResultSetMetaData(Connection connection, String sql) } /** Just short of bushy. */ - @Test public void testAlmostBushy() { + @Test void testAlmostBushy() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select *\n" @@ -1127,7 +1127,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * in parallel join product to product_class; * then join the results. */ @Disabled("extremely slow - a bit better if you disable ProjectMergeRule") - @Test public void testBushy() { + @Test void testBushy() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select *\n" @@ -1447,7 +1447,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * running queries against the JDBC adapter. The bug is not present with * janino-3.0.9 so the workaround in EnumerableRelImplementor was removed. */ - @Test public void testJanino169() { + @Test void testJanino169() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query( @@ -1462,7 +1462,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * EnumerableCalcRel can't support 3+ AND conditions, the last condition * is ignored and rows with deptno=10 are wrongly returned.

*/ - @Test public void testAnd3() { + @Test void testAnd3() { CalciteAssert.hr() .query("select \"deptno\" from \"hr\".\"emps\"\n" + "where \"emps\".\"empid\" < 240\n" @@ -1472,7 +1472,7 @@ private void checkResultSetMetaData(Connection connection, String sql) } /** Tests a date literal against a JDBC data source. */ - @Test public void testJdbcDate() { + @Test void testJdbcDate() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select count(*) as c from (\n" @@ -1485,7 +1485,7 @@ private void checkResultSetMetaData(Connection connection, String sql) } /** Tests a timestamp literal against JDBC data source. */ - @Test public void testJdbcTimestamp() { + @Test void testJdbcTimestamp() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select count(*) as c from (\n" @@ -1498,7 +1498,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Test case for * [CALCITE-281] * SQL type of EXTRACT is BIGINT but it is implemented as int. */ - @Test public void testExtract() { + @Test void testExtract() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("values extract(year from date '2008-2-23')") @@ -1526,7 +1526,7 @@ private void checkResultSetMetaData(Connection connection, String sql) }); } - @Test public void testExtractMonthFromTimestamp() { + @Test void testExtractMonthFromTimestamp() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select extract(month from \"birth_date\") as c\n" @@ -1534,7 +1534,7 @@ private void checkResultSetMetaData(Connection connection, String sql) .returns("C=8\n"); } - @Test public void testExtractYearFromTimestamp() { + @Test void testExtractYearFromTimestamp() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select extract(year from \"birth_date\") as c\n" @@ -1542,7 +1542,7 @@ private void checkResultSetMetaData(Connection connection, String sql) .returns("C=1961\n"); } - @Test public void testExtractFromInterval() { + @Test void testExtractFromInterval() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select extract(month from interval '2-3' year to month) as c\n" @@ -1558,7 +1558,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * NullPointerException when EXTRACT is applied to NULL date field. * The problem occurs when EXTRACT appears in both SELECT and WHERE ... IN * clauses, the latter with at least two values. */ - @Test public void testExtractOnNullDateField() { + @Test void testExtractOnNullDateField() { final String sql = "select\n" + " extract(year from \"end_date\"), \"hire_date\", \"birth_date\"\n" + "from \"foodmart\".\"employee\"\n" @@ -1577,7 +1577,7 @@ private void checkResultSetMetaData(Connection connection, String sql) with.query(sql3).returns(""); } - @Test public void testFloorDate() { + @Test void testFloorDate() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select floor(timestamp '2011-9-14 19:27:23' to month) as c\n" @@ -1592,7 +1592,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Test case for * [CALCITE-3435] * Enable decimal modulus operation to allow numeric with non-zero scale. */ - @Test public void testModOperation() { + @Test void testModOperation() { CalciteAssert.that() .query("select mod(33.5, 7) as c0, floor(mod(33.5, 7)) as c1, " + "mod(11, 3.2) as c2, floor(mod(11, 3.2)) as c3," @@ -1605,7 +1605,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Test case for * [CALCITE-387] * CompileException when cast TRUE to nullable boolean. */ - @Test public void testTrue() { + @Test void testTrue() { final CalciteAssert.AssertThat that = CalciteAssert.that(); that.query("select case when deptno = 10 then null else true end as x\n" + "from (values (10), (20)) as t(deptno)") @@ -1620,7 +1620,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Unit test for self-join. Left and right children of the join are the same * relational expression. */ - @Test public void testSelfJoin() { + @Test void testSelfJoin() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select count(*) as c from (\n" @@ -1631,7 +1631,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Self-join on different columns, select a different column, and sort and * limit on yet another column. */ - @Test public void testSelfJoinDifferentColumns() { + @Test void testSelfJoinDifferentColumns() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select e1.\"full_name\"\n" @@ -1649,7 +1649,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * [CALCITE-2029] * Query with "is distinct from" condition in where or join clause fails * with AssertionError: Cast for just nullability not allowed. */ - @Test public void testIsNotDistinctInFilter() { + @Test void testIsNotDistinctInFilter() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select *\n" @@ -1662,7 +1662,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * [CALCITE-2029] * Query with "is distinct from" condition in where or join clause fails * with AssertionError: Cast for just nullability not allowed. */ - @Test public void testMixedEqualAndIsNotDistinctJoin() { + @Test void testMixedEqualAndIsNotDistinctJoin() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select *\n" @@ -1678,7 +1678,7 @@ private void checkResultSetMetaData(Connection connection, String sql) *

Test case for * [CALCITE-371] * Cannot implement JOIN whose ON clause contains mixed equi and theta. */ - @Test public void testEquiThetaJoin() { + @Test void testEquiThetaJoin() { CalciteAssert.hr() .query("select e.\"empid\", d.\"name\", e.\"name\"\n" + "from \"hr\".\"emps\" as e\n" @@ -1693,7 +1693,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Test case for * [CALCITE-451] * Implement theta join, inner and outer, in enumerable convention. */ - @Test public void testThetaJoin() { + @Test void testThetaJoin() { CalciteAssert.hr() .query( "select e.\"empid\", d.\"name\", e.\"name\"\n" @@ -1714,7 +1714,7 @@ private void checkResultSetMetaData(Connection connection, String sql) * [CALCITE-35] * Support parenthesized sub-clause in JOIN. */ @Disabled - @Test public void testJoinJoin() { + @Test void testJoinJoin() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select\n" @@ -1760,7 +1760,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Four-way join. Used to take 80 seconds. */ @Disabled - @Test public void testJoinFiveWay() { + @Test void testJoinFiveWay() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"store\".\"store_country\" as \"c0\",\n" @@ -1809,7 +1809,7 @@ private void checkResultSetMetaData(Connection connection, String sql) /** Tests a simple (primary key to primary key) N-way join, with arbitrary * N. */ - @Test public void testJoinManyWay() { + @Test void testJoinManyWay() { // Timings without LoptOptimizeJoinRule // N Time // == ===== @@ -1860,7 +1860,7 @@ private static List> querify(String[] queries1) { /** A selection of queries generated by Mondrian. */ @Disabled - @Test public void testCloneQueries() { + @Test void testCloneQueries() { CalciteAssert.AssertThat with = CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE); @@ -1890,7 +1890,7 @@ private static List> querify(String[] queries1) { } /** Tests accessing a column in a JDBC source whose type is ARRAY. */ - @Test public void testArray() throws Exception { + @Test void testArray() throws Exception { final String url = MultiJdbcSchemaJoinTest.TempDb.INSTANCE.getUrl(); Connection baseConnection = DriverManager.getConnection(url); Statement baseStmt = baseConnection.createStatement(); @@ -1963,7 +1963,7 @@ private static List> querify(String[] queries1) { } /** Tests the {@code CARDINALITY} function applied to an array column. */ - @Test public void testArray2() { + @Test void testArray2() { CalciteAssert.hr() .query("select \"deptno\", cardinality(\"employees\") as c\n" + "from \"hr\".\"depts\"") @@ -1973,7 +1973,7 @@ private static List> querify(String[] queries1) { } /** Tests JDBC support for nested arrays. */ - @Test public void testNestedArray() throws Exception { + @Test void testNestedArray() throws Exception { CalciteAssert.hr() .doWithConnection(connection -> { try { @@ -2025,19 +2025,19 @@ private static List> querify(String[] queries1) { }); } - @Test public void testArrayConstructor() { + @Test void testArrayConstructor() { CalciteAssert.that() .query("select array[1,2] as a from (values (1))") .returnsUnordered("A=[1, 2]"); } - @Test public void testMultisetConstructor() { + @Test void testMultisetConstructor() { CalciteAssert.that() .query("select multiset[1,2] as a from (values (1))") .returnsUnordered("A=[1, 2]"); } - @Test public void testMultisetQuery() { + @Test void testMultisetQuery() { CalciteAssert.hr() .query("select multiset(\n" + " select \"deptno\", \"empid\" from \"hr\".\"emps\") as a\n" @@ -2045,7 +2045,7 @@ private static List> querify(String[] queries1) { .returnsUnordered("A=[{10, 100}, {20, 200}, {10, 150}, {10, 110}]"); } - @Test public void testMultisetQueryWithSingleColumn() { + @Test void testMultisetQueryWithSingleColumn() { CalciteAssert.hr() .query("select multiset(\n" + " select \"deptno\" from \"hr\".\"emps\") as a\n" @@ -2053,21 +2053,21 @@ private static List> querify(String[] queries1) { .returnsUnordered("A=[{10}, {20}, {10}, {10}]"); } - @Test public void testUnnestArray() { + @Test void testUnnestArray() { CalciteAssert.that() .query("select*from unnest(array[1,2])") .returnsUnordered("EXPR$0=1", "EXPR$0=2"); } - @Test public void testUnnestArrayWithOrdinality() { + @Test void testUnnestArrayWithOrdinality() { CalciteAssert.that() .query("select*from unnest(array[10,20]) with ordinality as t(i, o)") .returnsUnordered("I=10; O=1", "I=20; O=2"); } - @Test public void testUnnestRecordType() { + @Test void testUnnestRecordType() { // unnest(RecordType(Array)) CalciteAssert.that() .query("select * from unnest\n" @@ -2094,14 +2094,14 @@ private static List> querify(String[] queries1) { "A=c; B=40; O=1"); } - @Test public void testUnnestMultiset() { + @Test void testUnnestMultiset() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select*from unnest(multiset[1,2]) as t(c)") .returnsUnordered("C=1", "C=2"); } - @Test public void testUnnestMultiset2() { + @Test void testUnnestMultiset2() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select*from unnest(\n" @@ -2116,14 +2116,14 @@ private static List> querify(String[] queries1) { * [CALCITE-2391] * Aggregate query with UNNEST or LATERAL fails with * ClassCastException. */ - @Test public void testAggUnnestColumn() { + @Test void testAggUnnestColumn() { final String sql = "select count(d.\"name\") as c\n" + "from \"hr\".\"depts\" as d,\n" + " UNNEST(d.\"employees\") as e"; CalciteAssert.hr().query(sql).returnsUnordered("C=3"); } - @Test public void testArrayElement() { + @Test void testArrayElement() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select element(\"employees\") from \"hr\".\"depts\"\n" @@ -2132,7 +2132,7 @@ private static List> querify(String[] queries1) { "EXPR$0=null"); } - @Test public void testLateral() { + @Test void testLateral() { CalciteAssert.hr() .query("select * from \"hr\".\"emps\",\n" + " LATERAL (select * from \"hr\".\"depts\" where \"emps\".\"deptno\" = \"depts\".\"deptno\")") @@ -2145,7 +2145,7 @@ private static List> querify(String[] queries1) { /** Test case for * [CALCITE-531] * Window function does not work in LATERAL. */ - @Test public void testLateralWithOver() { + @Test void testLateralWithOver() { final String sql = "select \"emps\".\"name\", d.\"deptno\", d.m\n" + "from \"hr\".\"emps\",\n" + " LATERAL (\n" @@ -2172,7 +2172,7 @@ private static List> querify(String[] queries1) { } /** Per SQL std, UNNEST is implicitly LATERAL. */ - @Test public void testUnnestArrayColumn() { + @Test void testUnnestArrayColumn() { CalciteAssert.hr() .query("select d.\"name\", e.*\n" + "from \"hr\".\"depts\" as d,\n" @@ -2183,7 +2183,7 @@ private static List> querify(String[] queries1) { "name=Sales; empid=150; deptno=10; name0=Sebastian; salary=7000.0; commission=null"); } - @Test public void testUnnestArrayScalarArray() { + @Test void testUnnestArrayScalarArray() { CalciteAssert.hr() .query("select d.\"name\", e.*\n" + "from \"hr\".\"depts\" as d,\n" @@ -2197,7 +2197,7 @@ private static List> querify(String[] queries1) { "name=Sales; empid=150; deptno=10; name0=Sebastian; salary=7000.0; commission=null; EXPR$1=2"); } - @Test public void testUnnestArrayScalarArrayAliased() { + @Test void testUnnestArrayScalarArrayAliased() { CalciteAssert.hr() .query("select d.\"name\", e.*\n" + "from \"hr\".\"depts\" as d,\n" @@ -2209,7 +2209,7 @@ private static List> querify(String[] queries1) { "name=Sales; EI=150; D=10; N=Sebastian; S=7000.0; C=null; I=2"); } - @Test public void testUnnestArrayScalarArrayWithOrdinal() { + @Test void testUnnestArrayScalarArrayWithOrdinal() { CalciteAssert.hr() .query("select d.\"name\", e.*\n" + "from \"hr\".\"depts\" as d,\n" @@ -2224,7 +2224,7 @@ private static List> querify(String[] queries1) { /** Test case for * [CALCITE-3498] * Unnest operation's ordinality should be deterministic. */ - @Test public void testUnnestArrayWithDeterministicOrdinality() { + @Test void testUnnestArrayWithDeterministicOrdinality() { CalciteAssert.that() .query("select v, o\n" + "from unnest(array[100, 200]) with ordinality as t1(v, o)\n" @@ -2246,7 +2246,7 @@ private static List> querify(String[] queries1) { /** Test case for * [CALCITE-1250] * UNNEST applied to MAP data type. */ - @Test public void testUnnestItemsInMap() throws SQLException { + @Test void testUnnestItemsInMap() throws SQLException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); final String sql = "select * from unnest(MAP['a', 1, 'b', 2]) as um(k, v)"; ResultSet resultSet = connection.createStatement().executeQuery(sql); @@ -2256,7 +2256,7 @@ private static List> querify(String[] queries1) { connection.close(); } - @Test public void testUnnestItemsInMapWithOrdinality() throws SQLException { + @Test void testUnnestItemsInMapWithOrdinality() throws SQLException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); final String sql = "select *\n" + "from unnest(MAP['a', 1, 'b', 2]) with ordinality as um(k, v, i)"; @@ -2267,7 +2267,7 @@ private static List> querify(String[] queries1) { connection.close(); } - @Test public void testUnnestItemsInMapWithNoAliasAndAdditionalArgument() + @Test void testUnnestItemsInMapWithNoAliasAndAdditionalArgument() throws SQLException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); final String sql = @@ -2306,7 +2306,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) * Project should be optimized away, not converted to EnumerableCalcRel. */ @Disabled - @Test public void testNoCalcBetweenJoins() throws IOException { + @Test void testNoCalcBetweenJoins() throws IOException { final FoodMartQuerySet set = FoodMartQuerySet.instance(); CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) @@ -2333,7 +2333,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) * {@link org.apache.calcite.rel.rules.JoinPushThroughJoinRule} makes this * possible. */ @Disabled - @Test public void testExplainJoin() { + @Test void testExplainJoin() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query(FOODMART_QUERIES.get(48).left) @@ -2354,7 +2354,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) * rows, then time_by_day, then store). This makes for efficient * hash-joins. */ @Disabled - @Test public void testExplainJoin2() throws IOException { + @Test void testExplainJoin2() throws IOException { withFoodMartQuery(2482) .explainContains("" + "EnumerableSortRel(sort0=[$0], sort1=[$1], dir0=[Ascending-nulls-last], dir1=[Ascending-nulls-last])\n" @@ -2374,7 +2374,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) /** One of the most expensive foodmart queries. */ @Disabled // OOME on Travis; works on most other machines - @Test public void testExplainJoin3() throws IOException { + @Test void testExplainJoin3() throws IOException { withFoodMartQuery(8) .explainContains("" + "EnumerableSortRel(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], dir0=[Ascending-nulls-last], dir1=[Ascending-nulls-last], dir2=[Ascending-nulls-last], dir3=[Ascending-nulls-last])\n" @@ -2394,7 +2394,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) /** Tests that a relatively complex query on the foodmart schema creates * an in-memory aggregate table and then uses it. */ @Disabled // DO NOT CHECK IN - @Test public void testFoodmartLattice() throws IOException { + @Test void testFoodmartLattice() throws IOException { // 8: select ... from customer, sales, time ... group by ... final FoodMartQuerySet set = FoodMartQuerySet.instance(); final FoodMartQuerySet.FoodmartQuery query = set.queries.get(8); @@ -2417,7 +2417,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) * [CALCITE-99] * Recognize semi-join that has high selectivity and push it down. */ @Disabled - @Test public void testExplainJoin4() throws IOException { + @Test void testExplainJoin4() throws IOException { withFoodMartQuery(5217) .explainContains("" + "EnumerableAggregateRel(group=[{0, 1, 2, 3}], m0=[COUNT($4)])\n" @@ -2445,7 +2445,7 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) /** Condition involving OR makes this more complex than * {@link #testExplainJoin()}. */ @Disabled - @Test public void testExplainJoinOrderingWithOr() { + @Test void testExplainJoinOrderingWithOr() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query(FOODMART_QUERIES.get(47).left) @@ -2454,12 +2454,12 @@ private CalciteAssert.AssertQuery withFoodMartQuery(int id) /** There was a bug representing a nullable timestamp using a {@link Long} * internally. */ - @Test public void testNullableTimestamp() { + @Test void testNullableTimestamp() { checkNullableTimestamp(CalciteAssert.Config.FOODMART_CLONE); } /** Similar to {@link #testNullableTimestamp} but directly off JDBC. */ - @Test public void testNullableTimestamp2() { + @Test void testNullableTimestamp2() { checkNullableTimestamp(CalciteAssert.Config.JDBC_FOODMART); } @@ -2474,7 +2474,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { "hire_date=1994-12-01; end_date=null; birth_date=1961-08-26\n"); } - @Test public void testReuseExpressionWhenNullChecking() { + @Test void testReuseExpressionWhenNullChecking() { CalciteAssert.hr() .query( "select upper((case when \"empid\">\"deptno\"*10 then 'y' else null end)) T from \"hr\".\"emps\"") @@ -2490,7 +2490,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { + "T=Y\n"); } - @Test public void testReuseExpressionWhenNullChecking2() { + @Test void testReuseExpressionWhenNullChecking2() { CalciteAssert.hr() .query( "select upper((case when \"empid\">\"deptno\"*10 then \"name\" end)) T from \"hr\".\"emps\"") @@ -2506,7 +2506,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { + "T=THEODORE\n"); } - @Test public void testReuseExpressionWhenNullChecking3() { + @Test void testReuseExpressionWhenNullChecking3() { CalciteAssert.hr() .query( "select substring(\"name\", \"deptno\"+case when CURRENT_PATH <> '' then 1 end) from \"hr\".\"emps\"") @@ -2524,7 +2524,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { + "Integer.valueOf(current.deptno + 1).intValue());"); } - @Test public void testReuseExpressionWhenNullChecking4() { + @Test void testReuseExpressionWhenNullChecking4() { CalciteAssert.hr() .query("select substring(trim(\n" + "substring(\"name\",\n" @@ -2559,7 +2559,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { + "T=heodore\n"); } - @Test public void testReuseExpressionWhenNullChecking5() { + @Test void testReuseExpressionWhenNullChecking5() { CalciteAssert.hr() .query("select substring(trim(\n" + "substring(\"name\",\n" @@ -2600,21 +2600,21 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { + "T=eodore\n"); } - @Test public void testValues() { + @Test void testValues() { CalciteAssert.that() .query("values (1), (2)") .returns("EXPR$0=1\n" + "EXPR$0=2\n"); } - @Test public void testValuesAlias() { + @Test void testValuesAlias() { CalciteAssert.that() .query( "select \"desc\" from (VALUES ROW(1, 'SameName')) AS \"t\" (\"id\", \"desc\")") .returns("desc=SameName\n"); } - @Test public void testValuesMinus() { + @Test void testValuesMinus() { CalciteAssert.that() .query("values (-2-1)") .returns("EXPR$0=-3\n"); @@ -2623,7 +2623,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { /** Test case for * [CALCITE-1120] * Support SELECT without FROM. */ - @Test public void testSelectWithoutFrom() { + @Test void testSelectWithoutFrom() { CalciteAssert.that() .query("select 2+2") .returns("EXPR$0=4\n"); @@ -2638,7 +2638,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { * CHAR(1) to CHAR(3) that appends trailing spaces does not occur. See * "contextually typed value specification" in the SQL spec.

*/ - @Test public void testValuesComposite() { + @Test void testValuesComposite() { CalciteAssert.that() .query("values (1, 'a'), (2, 'abc')") .returns("EXPR$0=1; EXPR$1=a \n" @@ -2649,7 +2649,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { * Tests that even though trivial "rename columns" projection is removed, * the query still returns proper column names. */ - @Test public void testValuesCompositeRenamed() { + @Test void testValuesCompositeRenamed() { CalciteAssert.that() .query("select EXPR$0 q, EXPR$1 w from (values (1, 'a'), (2, 'abc'))") .explainContains( @@ -2662,7 +2662,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { * Tests that even though trivial "rename columns" projection is removed, * the query still returns proper column names. */ - @Test public void testValuesCompositeRenamedSameNames() { + @Test void testValuesCompositeRenamedSameNames() { CalciteAssert.that() .query("select EXPR$0 q, EXPR$1 q from (values (1, 'a'), (2, 'abc'))") .explainContains( @@ -2676,7 +2676,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { * Tests that even though trivial "rename columns" projection is removed, * the query still returns proper column names. */ - @Test public void testUnionWithSameColumnNames() { + @Test void testUnionWithSameColumnNames() { CalciteAssert.hr() .query( "select \"deptno\", \"deptno\" from \"hr\".\"depts\" union select \"deptno\", \"empid\" from \"hr\".\"emps\"") @@ -2697,7 +2697,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests inner join to an inline table ({@code VALUES} clause). */ - @Test public void testInnerJoinValues() { + @Test void testInnerJoinValues() { CalciteAssert.that() .with(CalciteAssert.Config.LINGUAL) .query("select empno, desc from sales.emps,\n" @@ -2712,7 +2712,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests a merge-join. */ - @Test public void testMergeJoin() { + @Test void testMergeJoin() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select \"emps\".\"empid\",\n" @@ -2732,7 +2732,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests a cartesian product aka cross join. */ - @Test public void testCartesianJoin() { + @Test void testCartesianJoin() { CalciteAssert.hr() .query( "select * from \"hr\".\"emps\", \"hr\".\"depts\" where \"emps\".\"empid\" < 140 and \"depts\".\"deptno\" > 20") @@ -2743,7 +2743,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { "empid=110; deptno=10; name=Theodore; salary=11500.0; commission=250; deptno0=40; name0=HR; employees=[{200, 20, Eric, 8000.0, 500}]; location=null"); } - @Test public void testDistinctCountSimple() { + @Test void testDistinctCountSimple() { final String s = "select count(distinct \"sales_fact_1997\".\"unit_sales\") as \"m0\"\n" + "from \"sales_fact_1997\" as \"sales_fact_1997\""; @@ -2756,7 +2756,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { .returns("m0=6\n"); } - @Test public void testDistinctCount2() { + @Test void testDistinctCount2() { final String s = "select cast(\"unit_sales\" as integer) as \"u\",\n" + " count(distinct \"sales_fact_1997\".\"customer_id\") as \"m0\"\n" + "from \"sales_fact_1997\" as \"sales_fact_1997\"\n" @@ -2778,7 +2778,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { "u=2; m0=4735"); } - @Test public void testDistinctCount() { + @Test void testDistinctCount() { final String s = "select \"time_by_day\".\"the_year\" as \"c0\",\n" + " count(distinct \"sales_fact_1997\".\"unit_sales\") as \"m0\"\n" + "from \"time_by_day\" as \"time_by_day\",\n" @@ -2801,7 +2801,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { .returns("c0=1997; m0=6\n"); } - @Test public void testDistinctCountComposite() { + @Test void testDistinctCountComposite() { final String s = "select \"time_by_day\".\"the_year\" as \"c0\",\n" + " count(distinct \"sales_fact_1997\".\"product_id\",\n" + " \"sales_fact_1997\".\"customer_id\") as \"m0\"\n" @@ -2816,7 +2816,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { .returns("c0=1997; m0=85452\n"); } - @Test public void testAggregateFilter() { + @Test void testAggregateFilter() { final String s = "select \"the_month\",\n" + " count(*) as \"c\",\n" + " count(*) filter (where \"day_of_month\" > 20) as \"c2\"\n" @@ -2842,7 +2842,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests a simple IN query implemented as a semi-join. */ - @Test public void testSimpleIn() { + @Test void testSimpleIn() { CalciteAssert.hr() .query("select * from \"hr\".\"depts\" where \"deptno\" in (\n" + " select \"deptno\" from \"hr\".\"emps\"\n" @@ -2867,7 +2867,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { /** A difficult query: an IN list so large that the planner promotes it * to a semi-join against a VALUES relation. */ @Disabled - @Test public void testIn() { + @Test void testIn() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"time_by_day\".\"the_year\" as \"c0\",\n" @@ -2899,7 +2899,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Query that uses parenthesized JOIN. */ - @Test public void testSql92JoinParenthesized() { + @Test void testSql92JoinParenthesized() { if (!Bug.TODO_FIXED) { return; } @@ -2950,7 +2950,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { * * @see org.apache.calcite.avatica.AvaticaDatabaseMetaData#nullsAreSortedAtEnd() */ - @Test public void testOrderBy() { + @Test void testOrderBy() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"store_id\", \"grocery_sqft\" from \"store\"\n" @@ -2961,7 +2961,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests ORDER BY ... DESC. Nulls come first (they come last for ASC). */ - @Test public void testOrderByDesc() { + @Test void testOrderByDesc() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"store_id\", \"grocery_sqft\" from \"store\"\n" @@ -2972,7 +2972,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests sorting by an expression not in the select clause. */ - @Test public void testOrderByExpr() { + @Test void testOrderByExpr() { CalciteAssert.hr() .query("select \"name\", \"empid\" from \"hr\".\"emps\"\n" + "order by - \"empid\"") @@ -2985,7 +2985,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { /** Tests sorting by an expression not in the '*' select clause. Test case for * [CALCITE-176] * ORDER BY expression doesn't work with SELECT *. */ - @Test public void testOrderStarByExpr() { + @Test void testOrderStarByExpr() { CalciteAssert.hr() .query("select * from \"hr\".\"emps\"\n" + "order by - \"empid\"") @@ -2999,7 +2999,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { + "empid=100; deptno=10; name=Bill; salary=10000.0; commission=1000\n"); } - @Test public void testOrderUnionStarByExpr() { + @Test void testOrderUnionStarByExpr() { CalciteAssert.hr() .query("select * from \"hr\".\"emps\" where \"empid\" < 150\n" + "union all\n" @@ -3012,7 +3012,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { } /** Tests sorting by a CAST expression not in the select clause. */ - @Test public void testOrderByCast() { + @Test void testOrderByCast() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"customer_id\", \"postal_code\" from \"customer\"\n" @@ -3027,7 +3027,7 @@ private void checkNullableTimestamp(CalciteAssert.Config config) { /** Tests ORDER BY with all combinations of ASC, DESC, NULLS FIRST, * NULLS LAST. */ - @Test public void testOrderByNulls() { + @Test void testOrderByNulls() { checkOrderByNulls(CalciteAssert.Config.FOODMART_CLONE); checkOrderByNulls(CalciteAssert.Config.JDBC_FOODMART); } @@ -3089,7 +3089,7 @@ private void checkOrderByNullsLast(CalciteAssert.Config config) { /** Tests ORDER BY ... with various values of * {@link CalciteConnectionConfig#defaultNullCollation()}. */ - @Test public void testOrderByVarious() { + @Test void testOrderByVarious() { final boolean[] booleans = {false, true}; for (NullCollation nullCollation : NullCollation.values()) { for (boolean asc : booleans) { @@ -3133,7 +3133,7 @@ public void checkOrderBy(final boolean desc, } /** Tests ORDER BY ... FETCH. */ - @Test public void testOrderByFetch() { + @Test void testOrderByFetch() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"store_id\", \"grocery_sqft\" from \"store\"\n" @@ -3152,7 +3152,7 @@ public void checkOrderBy(final boolean desc, } /** Tests ORDER BY ... OFFSET ... FETCH. */ - @Test public void testOrderByOffsetFetch() { + @Test void testOrderByOffsetFetch() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"store_id\", \"grocery_sqft\" from \"store\"\n" @@ -3166,7 +3166,7 @@ public void checkOrderBy(final boolean desc, } /** Tests FETCH with no ORDER BY. */ - @Test public void testFetch() { + @Test void testFetch() { CalciteAssert.hr() .query("select \"empid\" from \"hr\".\"emps\"\n" + "fetch first 2 rows only") @@ -3174,7 +3174,7 @@ public void checkOrderBy(final boolean desc, + "empid=200\n"); } - @Test public void testFetchStar() { + @Test void testFetchStar() { CalciteAssert.hr() .query("select * from \"hr\".\"emps\"\n" + "fetch first 2 rows only") @@ -3185,7 +3185,7 @@ public void checkOrderBy(final boolean desc, /** "SELECT ... LIMIT 0" is executed differently. A planner rule converts the * whole query to an empty rel. */ - @Test public void testLimitZero() { + @Test void testLimitZero() { CalciteAssert.hr() .query("select * from \"hr\".\"emps\"\n" + "limit 0") @@ -3195,7 +3195,7 @@ public void checkOrderBy(final boolean desc, } /** Alternative formulation for {@link #testFetchStar()}. */ - @Test public void testLimitStar() { + @Test void testLimitStar() { CalciteAssert.hr() .query("select * from \"hr\".\"emps\"\n" + "limit 2") @@ -3208,7 +3208,7 @@ public void checkOrderBy(final boolean desc, * [CALCITE-96] * LIMIT against a table in a clone schema causes * UnsupportedOperationException. */ - @Test public void testLimitOnQueryableTable() { + @Test void testLimitOnQueryableTable() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select * from \"days\"\n" @@ -3220,7 +3220,7 @@ public void checkOrderBy(final boolean desc, /** Limit implemented using {@link Queryable#take}. Test case for * [CALCITE-70] * Joins seem to be very expensive in memory. */ - @Test public void testSelfJoinCount() { + @Test void testSelfJoinCount() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query( @@ -3236,7 +3236,7 @@ public void checkOrderBy(final boolean desc, } /** Tests composite GROUP BY where one of the columns has NULL values. */ - @Test public void testGroupByNull() { + @Test void testGroupByNull() { CalciteAssert.hr() .query("select \"deptno\", \"commission\", sum(\"salary\") s\n" + "from \"hr\".\"emps\"\n" @@ -3248,7 +3248,7 @@ public void checkOrderBy(final boolean desc, "deptno=10; commission=250; S=11500.0"); } - @Test public void testGroupingSets() { + @Test void testGroupingSets() { CalciteAssert.hr() .query("select \"deptno\", count(*) as c, sum(\"salary\") as s\n" + "from \"hr\".\"emps\"\n" @@ -3259,7 +3259,7 @@ public void checkOrderBy(final boolean desc, "deptno=20; C=1; S=8000.0"); } - @Test public void testRollup() { + @Test void testRollup() { CalciteAssert.hr() .query("select \"deptno\", count(*) as c, sum(\"salary\") as s\n" + "from \"hr\".\"emps\"\n" @@ -3270,7 +3270,7 @@ public void checkOrderBy(final boolean desc, "deptno=20; C=1; S=8000.0"); } - @Test public void testCaseWhenOnNullableField() { + @Test void testCaseWhenOnNullableField() { CalciteAssert.hr() .query("select case when \"commission\" is not null " + "then \"commission\" else 100 end\n" @@ -3285,7 +3285,7 @@ public void checkOrderBy(final boolean desc, + "EXPR$0=250\n"); } - @Test public void testSelectDistinct() { + @Test void testSelectDistinct() { CalciteAssert.hr() .query("select distinct \"deptno\"\n" + "from \"hr\".\"emps\"\n") @@ -3298,7 +3298,7 @@ public void checkOrderBy(final boolean desc, * [CALCITE-397] * "SELECT DISTINCT *" on reflective schema gives ClassCastException at * runtime. */ - @Test public void testSelectDistinctStar() { + @Test void testSelectDistinctStar() { CalciteAssert.hr() .query("select distinct *\n" + "from \"hr\".\"emps\"\n") @@ -3308,7 +3308,7 @@ public void checkOrderBy(final boolean desc, /** Select distinct on composite key, one column of which is boolean to * boot. */ - @Test public void testSelectDistinctComposite() { + @Test void testSelectDistinctComposite() { CalciteAssert.hr() .query("select distinct \"empid\" > 140 as c, \"deptno\"\n" + "from \"hr\".\"emps\"\n") @@ -3320,7 +3320,7 @@ public void checkOrderBy(final boolean desc, } /** Same result (and plan) as {@link #testSelectDistinct}. */ - @Test public void testGroupByNoAggregates() { + @Test void testGroupByNoAggregates() { CalciteAssert.hr() .query("select \"deptno\"\n" + "from \"hr\".\"emps\"\n" @@ -3331,7 +3331,7 @@ public void checkOrderBy(final boolean desc, } /** Same result (and plan) as {@link #testSelectDistinct}. */ - @Test public void testGroupByNoAggregatesAllColumns() { + @Test void testGroupByNoAggregatesAllColumns() { CalciteAssert.hr() .query("select \"deptno\"\n" + "from \"hr\".\"emps\"\n" @@ -3341,7 +3341,7 @@ public void checkOrderBy(final boolean desc, } /** Same result (and plan) as {@link #testSelectDistinct}. */ - @Test public void testGroupByMax1IsNull() { + @Test void testGroupByMax1IsNull() { CalciteAssert.hr() .query("select * from (\n" + "select max(1) max_id\n" @@ -3352,7 +3352,7 @@ public void checkOrderBy(final boolean desc, } /** Same result (and plan) as {@link #testSelectDistinct}. */ - @Test public void testGroupBy1Max1() { + @Test void testGroupBy1Max1() { CalciteAssert.hr() .query("select * from (\n" + "select max(u) max_id\n" @@ -3367,12 +3367,12 @@ public void checkOrderBy(final boolean desc, * [CALCITE-403] * Enumerable gives NullPointerException with NOT on nullable * expression. */ - @Test public void testHavingNot() throws IOException { + @Test void testHavingNot() throws IOException { withFoodMartQuery(6597).runs(); } /** Minimal case of {@link #testHavingNot()}. */ - @Test public void testHavingNot2() throws IOException { + @Test void testHavingNot2() throws IOException { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select 1\n" @@ -3383,7 +3383,7 @@ public void checkOrderBy(final boolean desc, } /** ORDER BY on a sort-key does not require a sort. */ - @Test public void testOrderOnSortedTable() throws IOException { + @Test void testOrderOnSortedTable() throws IOException { // The ArrayTable "store" is sorted by "store_id". CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) @@ -3400,7 +3400,7 @@ public void checkOrderBy(final boolean desc, } /** ORDER BY on a sort-key does not require a sort. */ - @Test public void testOrderSorted() throws IOException { + @Test void testOrderSorted() throws IOException { // The ArrayTable "store" is sorted by "store_id". CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) @@ -3412,7 +3412,7 @@ public void checkOrderBy(final boolean desc, + "store_id=2\n"); } - @Test public void testWhereNot() throws IOException { + @Test void testWhereNot() throws IOException { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select 1\n" @@ -3423,7 +3423,7 @@ public void checkOrderBy(final boolean desc, } /** Query that reads no columns from either underlying table. */ - @Test public void testCountStar() { + @Test void testCountStar() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { CalciteAssert.hr() .query("select count(*) c from \"hr\".\"emps\", \"hr\".\"depts\"") @@ -3437,7 +3437,7 @@ public void checkOrderBy(final boolean desc, } /** Same result (and plan) as {@link #testSelectDistinct}. */ - @Test public void testCountUnionAll() { + @Test void testCountUnionAll() { CalciteAssert.hr() .query("select count(*) c from (\n" + "select * from \"hr\".\"emps\" where 1=2\n" @@ -3448,7 +3448,7 @@ public void checkOrderBy(final boolean desc, "C=0"); } - @Test public void testUnionAll() { + @Test void testUnionAll() { CalciteAssert.hr() .query("select \"empid\", \"name\" from \"hr\".\"emps\" where \"deptno\"=10\n" + "union all\n" @@ -3462,7 +3462,7 @@ public void checkOrderBy(final boolean desc, "empid=200; name=Eric"); } - @Test public void testUnion() { + @Test void testUnion() { final String sql = "" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"deptno\"=10\n" + "union\n" @@ -3477,7 +3477,7 @@ public void checkOrderBy(final boolean desc, "empid=200; name=Eric"); } - @Test public void testIntersect() { + @Test void testIntersect() { final String sql = "" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"deptno\"=10\n" + "intersect\n" @@ -3491,7 +3491,7 @@ public void checkOrderBy(final boolean desc, .returnsUnordered("empid=150; name=Sebastian"); } - @Test public void testExcept() { + @Test void testExcept() { final String sql = "" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"deptno\"=10\n" + "except\n" @@ -3505,7 +3505,7 @@ public void checkOrderBy(final boolean desc, } /** Tests that SUM and AVG over empty set return null. COUNT returns 0. */ - @Test public void testAggregateEmpty() { + @Test void testAggregateEmpty() { CalciteAssert.hr() .query("select\n" + " count(*) as cs,\n" @@ -3523,7 +3523,7 @@ public void checkOrderBy(final boolean desc, } /** Tests that count(deptno) is reduced to count(). */ - @Test public void testReduceCountNotNullable() { + @Test void testReduceCountNotNullable() { CalciteAssert.hr() .query("select\n" + " count(\"deptno\") as cs,\n" @@ -3540,7 +3540,7 @@ public void checkOrderBy(final boolean desc, /** Tests that {@code count(deptno, commission, commission + 1)} is reduced to * {@code count(commission, commission + 1)}, because deptno is NOT NULL. */ - @Test public void testReduceCompositeCountNotNullable() { + @Test void testReduceCompositeCountNotNullable() { CalciteAssert.hr() .query("select\n" + " count(\"deptno\", \"commission\", \"commission\" + 1) as cs\n" @@ -3553,7 +3553,7 @@ public void checkOrderBy(final boolean desc, } /** Tests sorting by a column that is already sorted. */ - @Test public void testOrderByOnSortedTable() { + @Test void testOrderByOnSortedTable() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select * from \"time_by_day\"\n" @@ -3563,7 +3563,7 @@ public void checkOrderBy(final boolean desc, } /** Tests sorting by a column that is already sorted. */ - @Test public void testOrderByOnSortedTable2() { + @Test void testOrderByOnSortedTable2() { CalciteAssert.that() .with(CalciteAssert.Config.FOODMART_CLONE) .query("select \"time_id\", \"the_date\" from \"time_by_day\"\n" @@ -3577,7 +3577,7 @@ public void checkOrderBy(final boolean desc, + " EnumerableTableScan(table=[[foodmart2, time_by_day]])\n\n"); } - @Test public void testWithInsideWhereExists() { + @Test void testWithInsideWhereExists() { CalciteAssert.hr() .query("select \"deptno\" from \"hr\".\"emps\"\n" + "where exists (\n" @@ -3588,7 +3588,7 @@ public void checkOrderBy(final boolean desc, "deptno=10"); } - @Test public void testWithOrderBy() { + @Test void testWithOrderBy() { CalciteAssert.hr() .query("with emp2 as (select * from \"hr\".\"emps\")\n" + "select * from emp2\n" @@ -3601,7 +3601,7 @@ public void checkOrderBy(final boolean desc, } /** Tests windowed aggregation. */ - @Test public void testWinAgg() { + @Test void testWinAgg() { CalciteAssert.hr() .query("select" + " \"deptno\",\n" @@ -3656,7 +3656,7 @@ public void checkOrderBy(final boolean desc, /** Tests windowed aggregation with multiple windows. * One window straddles the current row. * Some windows have no PARTITION BY clause. */ - @Test public void testWinAgg2() { + @Test void testWinAgg2() { CalciteAssert.hr() .query("select" + " \"deptno\",\n" @@ -3690,7 +3690,7 @@ public void checkOrderBy(final boolean desc, * Window aggregates use temporary buffers, thus need to check if * primitives are properly boxed and un-boxed. */ - @Test public void testWinAggScalarNonNullPhysType() { + @Test void testWinAggScalarNonNullPhysType() { String planLine = "a0s0w0 = org.apache.calcite.runtime.SqlFunctions.lesser(a0s0w0, org.apache.calcite.runtime.SqlFunctions.toFloat(_rows[j]));"; if (CalciteSystemProperty.DEBUG.value()) { @@ -3715,7 +3715,7 @@ public void checkOrderBy(final boolean desc, * implemented properly when input is * {@link org.apache.calcite.rel.logical.LogicalWindow} and literal. */ - @Test public void testWinAggScalarNonNullPhysTypePlusOne() { + @Test void testWinAggScalarNonNullPhysTypePlusOne() { String planLine = "a0s0w0 = org.apache.calcite.runtime.SqlFunctions.lesser(a0s0w0, org.apache.calcite.runtime.SqlFunctions.toFloat(_rows[j]));"; if (CalciteSystemProperty.DEBUG.value()) { @@ -3736,7 +3736,7 @@ public void checkOrderBy(final boolean desc, } /** Tests for RANK and ORDER BY ... DESCENDING, NULLS FIRST, NULLS LAST. */ - @Test public void testWinAggRank() { + @Test void testWinAggRank() { CalciteAssert.hr() .query("select \"deptno\",\n" + " \"empid\",\n" @@ -3756,7 +3756,7 @@ public void checkOrderBy(final boolean desc, } /** Tests for RANK with same values */ - @Test public void testWinAggRankValues() { + @Test void testWinAggRankValues() { CalciteAssert.hr() .query("select \"deptno\",\n" + " rank() over (order by \"deptno\") as r\n" @@ -3771,7 +3771,7 @@ public void checkOrderBy(final boolean desc, } /** Tests for RANK with same values */ - @Test public void testWinAggRankValuesDesc() { + @Test void testWinAggRankValuesDesc() { CalciteAssert.hr() .query("select \"deptno\",\n" + " rank() over (order by \"deptno\" desc) as r\n" @@ -3786,7 +3786,7 @@ public void checkOrderBy(final boolean desc, } /** Tests for DENSE_RANK with same values */ - @Test public void testWinAggDenseRankValues() { + @Test void testWinAggDenseRankValues() { CalciteAssert.hr() .query("select \"deptno\",\n" + " dense_rank() over (order by \"deptno\") as r\n" @@ -3801,7 +3801,7 @@ public void checkOrderBy(final boolean desc, } /** Tests for DENSE_RANK with same values */ - @Test public void testWinAggDenseRankValuesDesc() { + @Test void testWinAggDenseRankValuesDesc() { CalciteAssert.hr() .query("select \"deptno\",\n" + " dense_rank() over (order by \"deptno\" desc) as r\n" @@ -3816,7 +3816,7 @@ public void checkOrderBy(final boolean desc, } /** Tests for DATE +- INTERVAL window frame */ - @Test public void testWinIntervalFrame() { + @Test void testWinIntervalFrame() { CalciteAssert.hr() .query("select \"deptno\",\n" + " \"empid\",\n" @@ -3834,7 +3834,7 @@ public void checkOrderBy(final boolean desc, "deptno=20; empid=200; hire_date=2014-06-12; R=1"); } - @Test public void testNestedWin() { + @Test void testNestedWin() { CalciteAssert.hr() .query("select\n" + " lag(a2, 1, 0) over (partition by \"deptno\" order by a1) as lagx\n" @@ -3935,7 +3935,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step1, implemented as last_value. * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLastValueStep1() { + @Test void testStartOfGroupLastValueStep1() { startOfGroupStep1( "val = last_value(val) over (order by rn rows between 1 preceding and 1 preceding)"); } @@ -3945,7 +3945,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step2, that gets the final group numbers * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLastValueStep2() { + @Test void testStartOfGroupLastValueStep2() { startOfGroupStep2( "val = last_value(val) over (order by rn rows between 1 preceding and 1 preceding)"); } @@ -3955,7 +3955,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step3, that aggregates the computed groups * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLastValueStep3() { + @Test void testStartOfGroupLastValueStep3() { startOfGroupStep3( "val = last_value(val) over (order by rn rows between 1 preceding and 1 preceding)"); } @@ -3965,7 +3965,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step1, implemented as last_value. * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLagStep1() { + @Test void testStartOfGroupLagStep1() { startOfGroupStep1("val = lag(val) over (order by rn)"); } @@ -3974,7 +3974,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step2, that gets the final group numbers * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLagValueStep2() { + @Test void testStartOfGroupLagValueStep2() { startOfGroupStep2("val = lag(val) over (order by rn)"); } @@ -3983,7 +3983,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step3, that aggregates the computed groups * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLagStep3() { + @Test void testStartOfGroupLagStep3() { startOfGroupStep3("val = lag(val) over (order by rn)"); } @@ -3992,7 +3992,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step1, implemented as last_value. * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLeadStep1() { + @Test void testStartOfGroupLeadStep1() { startOfGroupStep1("val = lead(val, -1) over (order by rn)"); } @@ -4001,7 +4001,7 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step2, that gets the final group numbers * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLeadValueStep2() { + @Test void testStartOfGroupLeadValueStep2() { startOfGroupStep2("val = lead(val, -1) over (order by rn)"); } @@ -4010,14 +4010,14 @@ private void startOfGroupStep3(String startOfGroup) { * This is a step3, that aggregates the computed groups * http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/ */ - @Test public void testStartOfGroupLeadStep3() { + @Test void testStartOfGroupLeadStep3() { startOfGroupStep3("val = lead(val, -1) over (order by rn)"); } /** * Tests default value of LAG function. */ - @Test public void testLagDefaultValue() { + @Test void testLagDefaultValue() { CalciteAssert.that() .query("select t.*, lag(rn+expected,1,42) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4037,7 +4037,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests default value of LEAD function. */ - @Test public void testLeadDefaultValue() { + @Test void testLeadDefaultValue() { CalciteAssert.that() .query("select t.*, lead(rn+expected,1,42) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4057,7 +4057,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests expression in offset value of LAG function. */ - @Test public void testLagExpressionOffset() { + @Test void testLagExpressionOffset() { CalciteAssert.that() .query("select t.*, lag(rn, expected, 42) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4077,7 +4077,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests DATE as offset argument of LAG function. */ - @Test public void testLagInvalidOffsetArgument() { + @Test void testLagInvalidOffsetArgument() { CalciteAssert.that() .query("select t.*,\n" + " lag(rn, DATE '2014-06-20', 42) over (order by rn) l\n" @@ -4089,7 +4089,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests LAG function with IGNORE NULLS. */ - @Test public void testLagIgnoreNulls() { + @Test void testLagIgnoreNulls() { final String sql = "select\n" + " lag(rn, expected, 42) ignore nulls over (w) l,\n" + " lead(rn, expected) over (w),\n" @@ -4113,7 +4113,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests NTILE(2). */ - @Test public void testNtile1() { + @Test void testNtile1() { CalciteAssert.that() .query("select rn, ntile(1) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4133,7 +4133,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests NTILE(2). */ - @Test public void testNtile2() { + @Test void testNtile2() { CalciteAssert.that() .query("select rn, ntile(2) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4154,7 +4154,7 @@ private void startOfGroupStep3(String startOfGroup) { * Tests expression in offset value of LAG function. */ @Disabled("Have no idea how to validate that expression is constant") - @Test public void testNtileConstantArgs() { + @Test void testNtileConstantArgs() { CalciteAssert.that() .query("select rn, ntile(1+1) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4174,7 +4174,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests expression in offset value of LAG function. */ - @Test public void testNtileNegativeArg() { + @Test void testNtileNegativeArg() { CalciteAssert.that() .query("select rn, ntile(-1) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4185,7 +4185,7 @@ private void startOfGroupStep3(String startOfGroup) { /** * Tests expression in offset value of LAG function. */ - @Test public void testNtileDecimalArg() { + @Test void testNtileDecimalArg() { CalciteAssert.that() .query("select rn, ntile(3.141592653) over (order by rn) l\n" + " from " + START_OF_GROUP_DATA) @@ -4194,7 +4194,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests for FIRST_VALUE */ - @Test public void testWinAggFirstValue() { + @Test void testWinAggFirstValue() { CalciteAssert.hr() .query("select \"deptno\",\n" + " \"empid\",\n" @@ -4211,7 +4211,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests for FIRST_VALUE desc */ - @Test public void testWinAggFirstValueDesc() { + @Test void testWinAggFirstValueDesc() { CalciteAssert.hr() .query("select \"deptno\",\n" + " \"empid\",\n" @@ -4228,7 +4228,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests for FIRST_VALUE empty window */ - @Test public void testWinAggFirstValueEmptyWindow() { + @Test void testWinAggFirstValueEmptyWindow() { CalciteAssert.hr() .query("select \"deptno\",\n" + " \"empid\",\n" @@ -4245,7 +4245,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests for ROW_NUMBER */ - @Test public void testWinRowNumber() { + @Test void testWinRowNumber() { CalciteAssert.hr() .query("select \"deptno\",\n" + " \"empid\",\n" @@ -4266,7 +4266,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests UNBOUNDED PRECEDING clause. */ - @Test public void testOverUnboundedPreceding() { + @Test void testOverUnboundedPreceding() { CalciteAssert.hr() .query("select \"empid\",\n" + " \"commission\",\n" @@ -4287,7 +4287,7 @@ private void startOfGroupStep3(String startOfGroup) { * [CALCITE-3563] * When resolving method call in calcite runtime, add type check and match * mechanism for input arguments. */ - @Test public void testMethodParameterTypeMatch() { + @Test void testMethodParameterTypeMatch() { CalciteAssert.that() .query("SELECT mod(12.5, cast(3 as bigint))") .planContains("final java.math.BigDecimal v = " @@ -4298,7 +4298,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests UNBOUNDED PRECEDING clause. */ - @Test public void testSumOverUnboundedPreceding() { + @Test void testSumOverUnboundedPreceding() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select \"empid\",\n" @@ -4317,7 +4317,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests that sum over possibly empty window is nullable. */ - @Test public void testSumOverPossiblyEmptyWindow() { + @Test void testSumOverPossiblyEmptyWindow() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select \"empid\",\n" @@ -4351,7 +4351,7 @@ private void startOfGroupStep3(String startOfGroup) { * table. * */ - @Test public void testOverNoOrder() { + @Test void testOverNoOrder() { // If no range is specified, default is "RANGE BETWEEN UNBOUNDED PRECEDING // AND CURRENT ROW". // The aggregate function is within the current partition; @@ -4377,7 +4377,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests that field-trimming creates a project near the table scan. */ - @Test public void testTrimFields() throws Exception { + @Test void testTrimFields() throws Exception { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { CalciteAssert.hr() .query("select \"name\", count(\"commission\") + 1\n" @@ -4392,7 +4392,7 @@ private void startOfGroupStep3(String startOfGroup) { /** Tests that field-trimming creates a project near the table scan, in a * query with windowed-aggregation. */ - @Test public void testTrimFieldsOver() throws Exception { + @Test void testTrimFieldsOver() throws Exception { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { // The correct plan has a project on a filter on a project on a scan. CalciteAssert.hr() @@ -4409,7 +4409,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests window aggregate whose argument is a constant. */ - @Test public void testWinAggConstant() { + @Test void testWinAggConstant() { CalciteAssert.hr() .query("select max(1) over (partition by \"deptno\"\n" + " order by \"empid\") as m\n" @@ -4424,7 +4424,7 @@ private void startOfGroupStep3(String startOfGroup) { /** Tests multiple window aggregates over constants. * This tests that EnumerableWindowRel is able to reference the right slot * when accessing constant for aggregation argument. */ - @Test public void testWinAggConstantMultipleConstants() { + @Test void testWinAggConstantMultipleConstants() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select \"deptno\", sum(1) over (partition by \"deptno\"\n" @@ -4440,7 +4440,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests window aggregate PARTITION BY constant. */ - @Test public void testWinAggPartitionByConstant() { + @Test void testWinAggPartitionByConstant() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("" @@ -4460,7 +4460,7 @@ private void startOfGroupStep3(String startOfGroup) { /** Tests window aggregate ORDER BY constant. Unlike in SELECT ... ORDER BY, * the constant does not mean a column. It means a constant, therefore the * order of the rows is not changed. */ - @Test public void testWinAggOrderByConstant() { + @Test void testWinAggOrderByConstant() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("" @@ -4478,7 +4478,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests WHERE comparing a nullable integer with an integer literal. */ - @Test public void testWhereNullable() { + @Test void testWhereNullable() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select * from \"hr\".\"emps\"\n" @@ -4506,7 +4506,7 @@ private void startOfGroupStep3(String startOfGroup) { * from scott.emp group by grouping sets(deptno) * } */ - @Test public void testGroupId() { + @Test void testGroupId() { CalciteAssert.that() .with(CalciteAssert.Config.SCOTT) .query("select deptno, group_id() + 1 as g, count(*) as c\n" @@ -4535,7 +4535,7 @@ private void startOfGroupStep3(String startOfGroup) { } /** Tests CALCITE-980: Not (C='a' or C='b') causes NPE */ - @Test public void testWhereOrAndNullable() { + @Test void testWhereOrAndNullable() { /* Generates the following code: public boolean moveNext() { while (inputEnumerator.moveNext()) { @@ -4568,7 +4568,7 @@ public boolean moveNext() { * @see QuidemTest sql/conditions.iq */ @Disabled("Fails with org.codehaus.commons.compiler.CompileException: Line 16, Column 112:" + " Cannot compare types \"int\" and \"java.lang.String\"\n") - @Test public void testComparingIntAndString() throws Exception { + @Test void testComparingIntAndString() throws Exception { // if (((...test.ReflectiveSchemaTest.IntAndString) inputEnumerator.current()).id == "T") CalciteAssert.that() @@ -4587,7 +4587,7 @@ public boolean moveNext() { /** Test case for * [CALCITE-1015] * OFFSET 0 causes AssertionError. */ - @Test public void testTrivialSort() { + @Test void testTrivialSort() { final String sql = "select a.\"value\", b.\"value\"\n" + " from \"bools\" a\n" + " , \"bools\" b\n" @@ -4609,7 +4609,7 @@ public boolean moveNext() { } /** Tests the LIKE operator. */ - @Test public void testLike() { + @Test void testLike() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query("select * from \"hr\".\"emps\"\n" @@ -4620,7 +4620,7 @@ public boolean moveNext() { } /** Tests array index. */ - @Test public void testArrayIndexing() { + @Test void testArrayIndexing() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR) .query( @@ -4630,7 +4630,7 @@ public boolean moveNext() { "deptno=40; E={200, 20, Eric, 8000.0, 500}"); } - @Test public void testVarcharEquals() { + @Test void testVarcharEquals() { CalciteAssert.model(FOODMART_MODEL) .query("select \"lname\" from \"customer\" where \"lname\" = 'Nowmer'") .returns("lname=Nowmer\n"); @@ -4654,7 +4654,7 @@ public boolean moveNext() { /** Test case for * [CALCITE-1153] * Invalid CAST when push JOIN down to Oracle. */ - @Test public void testJoinMismatchedVarchar() { + @Test void testJoinMismatchedVarchar() { final String sql = "select count(*) as c\n" + "from \"customer\" as c\n" + "join \"product\" as p on c.\"lname\" = p.\"brand_name\""; @@ -4663,7 +4663,7 @@ public boolean moveNext() { .returns("C=607\n"); } - @Test public void testIntersectMismatchedVarchar() { + @Test void testIntersectMismatchedVarchar() { final String sql = "select count(*) as c from (\n" + " select \"lname\" from \"customer\" as c\n" + " intersect\n" @@ -4675,7 +4675,7 @@ public boolean moveNext() { /** Tests the NOT IN operator. Problems arose in code-generation because * the column allows nulls. */ - @Test public void testNotIn() { + @Test void testNotIn() { predicate("\"name\" not in ('a', 'b') or \"name\" is null") .returns("" + "empid=100; deptno=10; name=Bill; salary=10000.0; commission=1000\n" @@ -4692,7 +4692,7 @@ public boolean moveNext() { predicate("\"name\" not in ('a', 'b', null) and \"name\" is not null"); } - @Test public void testNotInEmptyQuery() { + @Test void testNotInEmptyQuery() { // RHS is empty, therefore returns all rows from emp, including the one // with deptno = NULL. final String sql = "select deptno from emp where deptno not in (\n" @@ -4714,7 +4714,7 @@ public boolean moveNext() { "DEPTNO=60"); } - @Test public void testNotInQuery() { + @Test void testNotInQuery() { // None of the rows from RHS is NULL. final String sql = "select deptno from emp where deptno not in (\n" + "select deptno from dept)"; @@ -4724,7 +4724,7 @@ public boolean moveNext() { "DEPTNO=60"); } - @Test public void testNotInQueryWithNull() { + @Test void testNotInQueryWithNull() { // There is a NULL on the RHS, and '10 not in (20, null)' yields unknown // (similarly for every other value of deptno), so no rows are returned. final String sql = "select deptno from emp where deptno not in (\n" @@ -4733,7 +4733,7 @@ public boolean moveNext() { .returnsCount(0); } - @Test public void testTrim() { + @Test void testTrim() { CalciteAssert.model(FOODMART_MODEL) .query("select trim(\"lname\") as \"lname\" " + "from \"customer\" where \"lname\" = 'Nowmer'") @@ -4753,7 +4753,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { .runs(); } - @Test public void testExistsCorrelated() { + @Test void testExistsCorrelated() { final String sql = "select*from \"hr\".\"emps\" where exists (\n" + " select 1 from \"hr\".\"depts\"\n" + " where \"emps\".\"deptno\"=\"depts\".\"deptno\")"; @@ -4771,7 +4771,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { "empid=110; deptno=10; name=Theodore; salary=11500.0; commission=250"); } - @Test public void testNotExistsCorrelated() { + @Test void testNotExistsCorrelated() { final String plan = "PLAN=" + "EnumerableCalc(expr#0..5=[{inputs}], expr#6=[IS NULL($t5)], proj#0..4=[{exprs}], $condition=[$t6])\n" + " EnumerableCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n" @@ -4791,7 +4791,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { } /** Manual expansion of EXISTS in {@link #testNotExistsCorrelated()}. */ - @Test public void testNotExistsCorrelated2() { + @Test void testNotExistsCorrelated2() { final String sql = "select * from \"hr\".\"emps\" as e left join lateral (\n" + " select distinct true as i\n" + " from \"hr\".\"depts\"\n" @@ -4816,7 +4816,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { /** Test case for * [CALCITE-313] * Query decorrelation fails. */ - @Test public void testJoinInCorrelatedSubQuery() { + @Test void testJoinInCorrelatedSubQuery() { CalciteAssert.hr() .query("select *\n" + "from \"hr\".\"depts\" as d\n" @@ -4836,7 +4836,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { * *

Note that there should be an extra row "empid=200; deptno=20; * DNAME=null" but left join doesn't work.

*/ - @Test public void testScalarSubQuery() { + @Test void testScalarSubQuery() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_EXPAND.push(true)) { CalciteAssert.hr() .query("select \"empid\", \"deptno\",\n" @@ -4853,7 +4853,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { /** Test case for * [CALCITE-559] * Correlated scalar sub-query in WHERE gives error. */ - @Test public void testJoinCorrelatedScalarSubQuery() throws SQLException { + @Test void testJoinCorrelatedScalarSubQuery() throws SQLException { final String sql = "select e.employee_id, d.department_id " + " from employee e, department d " + " where e.department_id = d.department_id " @@ -4871,7 +4871,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { * [CALCITE-685] * Correlated scalar sub-query in SELECT clause throws. */ @Disabled("[CALCITE-685]") - @Test public void testCorrelatedScalarSubQuery() throws SQLException { + @Test void testCorrelatedScalarSubQuery() throws SQLException { final String sql = "select e.department_id, sum(e.employee_id),\n" + " ( select sum(e2.employee_id)\n" + " from employee e2\n" @@ -4893,7 +4893,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { .returnsCount(0); } - @Test public void testLeftJoin() { + @Test void testLeftJoin() { CalciteAssert.hr() .query("select e.\"deptno\", d.\"deptno\"\n" + "from \"hr\".\"emps\" as e\n" @@ -4905,7 +4905,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { "deptno=20; deptno=null"); } - @Test public void testFullJoin() { + @Test void testFullJoin() { CalciteAssert.hr() .query("select e.\"deptno\", d.\"deptno\"\n" + "from \"hr\".\"emps\" as e\n" @@ -4919,7 +4919,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { "deptno=null; deptno=40"); } - @Test public void testRightJoin() { + @Test void testRightJoin() { CalciteAssert.hr() .query("select e.\"deptno\", d.\"deptno\"\n" + "from \"hr\".\"emps\" as e\n" @@ -4935,7 +4935,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { /** Test case for * [CALCITE-2464] * Allow to set nullability for columns of structured types. */ - @Test public void testLeftJoinWhereStructIsNotNull() { + @Test void testLeftJoinWhereStructIsNotNull() { CalciteAssert.hr() .query("select e.\"deptno\", d.\"deptno\"\n" + "from \"hr\".\"emps\" as e\n" @@ -4950,7 +4950,7 @@ private CalciteAssert.AssertQuery predicate(String foo) { /** Various queries against EMP and DEPT, in particular involving composite * join conditions in various flavors of outer join. Results are verified * against MySQL (except full join, which MySQL does not support). */ - @Test public void testVariousOuter() { + @Test void testVariousOuter() { final String sql = "select * from emp join dept on emp.deptno = dept.deptno"; withEmpDept(sql).returnsUnordered( @@ -5001,7 +5001,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { + sql); } - @Test public void testScalarSubQueryUncorrelated() { + @Test void testScalarSubQueryUncorrelated() { CalciteAssert.hr() .query("select \"empid\", \"deptno\",\n" + " (select \"name\" from \"hr\".\"depts\"\n" @@ -5013,7 +5013,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { "empid=200; deptno=20; DNAME=Marketing"); } - @Test public void testScalarSubQueryInCase() { + @Test void testScalarSubQueryInCase() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_EXPAND.push(true)) { CalciteAssert.hr() .query("select e.\"name\",\n" @@ -5031,7 +5031,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { } } - @Test public void testScalarSubQueryInCase2() { + @Test void testScalarSubQueryInCase2() { CalciteAssert.hr() .query("select e.\"name\",\n" + " (CASE WHEN e.\"deptno\" = (\n" @@ -5047,7 +5047,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { } /** Tests the TABLES table in the information schema. */ - @Test public void testMetaTables() { + @Test void testMetaTables() { CalciteAssert.that() .with(CalciteAssert.Config.REGULAR_PLUS_METADATA) .query("select * from \"metadata\".TABLES") @@ -5063,7 +5063,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { } /** Tests that {@link java.sql.Statement#setMaxRows(int)} is honored. */ - @Test public void testSetMaxRows() throws Exception { + @Test void testSetMaxRows() throws Exception { CalciteAssert.hr() .doWithConnection(connection -> { try { @@ -5090,7 +5090,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { } /** Tests a {@link PreparedStatement} with parameters. */ - @Test public void testPreparedStatement() throws Exception { + @Test void testPreparedStatement() throws Exception { CalciteAssert.hr() .doWithConnection(connection -> { try { @@ -5159,7 +5159,7 @@ private CalciteAssert.AssertQuery withEmpDept(String sql) { /** Test case for * [CALCITE-2061] * Dynamic parameters in offset/fetch. */ - @Test public void testPreparedOffsetFetch() throws Exception { + @Test void testPreparedOffsetFetch() throws Exception { checkPreparedOffsetFetch(0, 0, Matchers.returnsUnordered()); checkPreparedOffsetFetch(100, 4, Matchers.returnsUnordered()); checkPreparedOffsetFetch(3, 4, @@ -5192,7 +5192,7 @@ private void checkPreparedOffsetFetch(final int offset, final int fetch, /** Tests a JDBC connection that provides a model (a single schema based on * a JDBC database). */ - @Test public void testModel() { + @Test void testModel() { CalciteAssert.model(FOODMART_MODEL) .query("select count(*) as c from \"foodmart\".\"time_by_day\"") .returns("C=730\n"); @@ -5204,7 +5204,7 @@ private void checkPreparedOffsetFetch(final int offset, final int fetch, *

Test case for * [CALCITE-160] * Allow comments in schema definitions. */ - @Test public void testModelWithComment() { + @Test void testModelWithComment() { final String model = FOODMART_MODEL.replace("schemas:", "/* comment */ schemas:"); assertThat(model, not(equalTo(FOODMART_MODEL))); @@ -5217,7 +5217,7 @@ private void checkPreparedOffsetFetch(final int offset, final int fetch, * it, and that the query produces the same result with and without it. There * are more comprehensive tests in {@link MaterializationTest}. */ @Disabled("until JdbcSchema can define materialized views") - @Test public void testModelWithMaterializedView() { + @Test void testModelWithMaterializedView() { CalciteAssert.model(FOODMART_MODEL) .enable(false) .query( @@ -5238,7 +5238,7 @@ private void checkPreparedOffsetFetch(final int offset, final int fetch, /** Tests a JDBC connection that provides a model that contains custom * tables. */ - @Test public void testModelCustomTable() { + @Test void testModelCustomTable() { CalciteAssert.model("{\n" + " version: '1.0',\n" + " schemas: [\n" @@ -5265,19 +5265,19 @@ private void checkPreparedOffsetFetch(final int offset, final int fetch, /** Tests a JDBC connection that provides a model that contains custom * tables. */ - @Test public void testModelCustomTable2() { + @Test void testModelCustomTable2() { testRangeTable("object"); } /** Tests a JDBC connection that provides a model that contains custom * tables. */ - @Test public void testModelCustomTableArrayRowSingleColumn() { + @Test void testModelCustomTableArrayRowSingleColumn() { testRangeTable("array"); } /** Tests a JDBC connection that provides a model that contains custom * tables. */ - @Test public void testModelCustomTableIntegerRowSingleColumn() { + @Test void testModelCustomTableIntegerRowSingleColumn() { testRangeTable("integer"); } @@ -5309,7 +5309,7 @@ private void testRangeTable(String elementType) { /** Tests a JDBC connection that provides a model that contains a custom * schema. */ - @Test public void testModelCustomSchema() throws Exception { + @Test void testModelCustomSchema() throws Exception { final CalciteAssert.AssertThat that = CalciteAssert.model("{\n" + " version: '1.0',\n" @@ -5348,7 +5348,7 @@ private void testRangeTable(String elementType) { /** Test case for * [CALCITE-1360] * Custom schema in file in current directory. */ - @Test public void testCustomSchemaInFileInPwd() throws SQLException { + @Test void testCustomSchemaInFileInPwd() throws SQLException { checkCustomSchemaInFileInPwd("custom-schema-model.json"); switch (File.pathSeparatorChar) { case '/': @@ -5401,7 +5401,7 @@ private void checkCustomSchemaInFileInPwd(String fileName) *

Test case for * [CALCITE-1259] * Allow connecting to a single schema without writing a model. */ - @Test public void testCustomSchemaDirectConnection() throws Exception { + @Test void testCustomSchemaDirectConnection() throws Exception { final String url = "jdbc:calcite:" + "schemaFactory=" + MySchemaFactory.class.getName() + "; schema.tableName=ELVIS"; @@ -5430,7 +5430,7 @@ private void checkCustomSchema(String url, String schemaName) throws SQLExceptio } /** Connects to a JDBC schema without writing a model. */ - @Test public void testJdbcSchemaDirectConnection() throws Exception { + @Test void testJdbcSchemaDirectConnection() throws Exception { checkJdbcSchemaDirectConnection( "schemaFactory=org.apache.calcite.adapter.jdbc.JdbcSchema$Factory"); checkJdbcSchemaDirectConnection("schemaType=JDBC"); @@ -5463,7 +5463,7 @@ private void pv(StringBuilder b, String p, String v) { } /** Connects to a map schema without writing a model. */ - @Test public void testMapSchemaDirectConnection() throws Exception { + @Test void testMapSchemaDirectConnection() throws Exception { checkMapSchemaDirectConnection("schemaType=MAP"); checkMapSchemaDirectConnection( "schemaFactory=org.apache.calcite.schema.impl.AbstractSchema$Factory"); @@ -5482,7 +5482,7 @@ private void checkMapSchemaDirectConnection(String s) throws SQLException { } /** Tests that an immutable schema in a model cannot contain a view. */ - @Test public void testModelImmutableSchemaCannotContainView() + @Test void testModelImmutableSchemaCannotContainView() throws Exception { CalciteAssert.model("{\n" + " version: '1.0',\n" @@ -5549,7 +5549,7 @@ private CalciteAssert.AssertThat modelWithView(String view, } /** Tests a JDBC connection that provides a model that contains a view. */ - @Test public void testModelView() throws Exception { + @Test void testModelView() throws Exception { final CalciteAssert.AssertThat with = modelWithView("select * from \"EMPLOYEES\" where \"deptno\" = 10", null); @@ -5642,7 +5642,7 @@ private CalciteAssert.AssertThat modelWithView(String view, } /** Tests a view with ORDER BY and LIMIT clauses. */ - @Test public void testOrderByView() throws Exception { + @Test void testOrderByView() throws Exception { final CalciteAssert.AssertThat with = modelWithView("select * from \"EMPLOYEES\" where \"deptno\" = 10 " + "order by \"empid\" limit 2", null); @@ -5666,7 +5666,7 @@ private CalciteAssert.AssertThat modelWithView(String view, * [CALCITE-1900] * Improve error message for cyclic views. * Previously got a {@link StackOverflowError}. */ - @Test public void testSelfReferentialView() throws Exception { + @Test void testSelfReferentialView() throws Exception { final CalciteAssert.AssertThat with = modelWithView("select * from \"V\"", null); with.query("select \"name\" from \"adhoc\".V") @@ -5674,7 +5674,7 @@ private CalciteAssert.AssertThat modelWithView(String view, + "whose definition is cyclic"); } - @Test public void testSelfReferentialView2() throws Exception { + @Test void testSelfReferentialView2() throws Exception { final String model = "{\n" + " version: '1.0',\n" + " defaultSchema: 'adhoc',\n" @@ -5737,7 +5737,7 @@ private CalciteAssert.AssertThat modelWithView(String view, /** Tests saving query results into temporary tables, per * {@link org.apache.calcite.avatica.Handler.ResultSink}. */ - @Test public void testAutomaticTemporaryTable() throws Exception { + @Test void testAutomaticTemporaryTable() throws Exception { final List objects = new ArrayList<>(); CalciteAssert.that() .with( @@ -5766,7 +5766,7 @@ public CalciteConnection createConnection() throws SQLException { }); } - @Test public void testExplain() { + @Test void testExplain() { final CalciteAssert.AssertThat with = CalciteAssert.that().with(CalciteAssert.Config.FOODMART_CLONE); with.query("explain plan for values (1, 'ab')") @@ -5865,7 +5865,7 @@ public CalciteConnection createConnection() throws SQLException { /** Test case for bug where if two tables have different element classes * but those classes have identical fields, Calcite would generate code to use * the wrong element class; a {@link ClassCastException} would ensue. */ - @Test public void testDifferentTypesSameFields() throws Exception { + @Test void testDifferentTypesSameFields() throws Exception { Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); @@ -5882,7 +5882,7 @@ public CalciteConnection createConnection() throws SQLException { /** Tests that CURRENT_TIMESTAMP gives different values each time a statement * is executed. */ - @Test public void testCurrentTimestamp() throws Exception { + @Test void testCurrentTimestamp() throws Exception { CalciteAssert.that() .with(CalciteConnectionProperty.TIME_ZONE, "GMT+1:00") .doWithConnection(connection -> { @@ -5915,7 +5915,7 @@ public CalciteConnection createConnection() throws SQLException { } /** Test for timestamps and time zones, based on pgsql TimezoneTest. */ - @Test public void testGetTimestamp() throws Exception { + @Test void testGetTimestamp() throws Exception { CalciteAssert.that() .with(CalciteConnectionProperty.TIME_ZONE, "GMT+1:00") .doWithConnection(connection -> { @@ -6057,7 +6057,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Test for MONTHNAME, DAYNAME and DAYOFWEEK functions in two locales. */ - @Test public void testMonthName() { + @Test void testMonthName() { final String sql = "SELECT * FROM (VALUES(\n" + " monthname(TIMESTAMP '1969-01-01 00:00:00'),\n" + " monthname(DATE '1969-01-01'),\n" @@ -6111,7 +6111,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests accessing a column in a JDBC source whose type is DATE. */ - @Test public void testGetDate() throws Exception { + @Test void testGetDate() throws Exception { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .doWithConnection(connection -> { @@ -6131,14 +6131,14 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests accessing a date as a string in a JDBC source whose type is DATE. */ - @Test public void testGetDateAsString() throws Exception { + @Test void testGetDateAsString() throws Exception { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select min(\"date\") mindate from \"foodmart\".\"currency\"") .returns2("MINDATE=1997-01-01\n"); } - @Test public void testGetTimestampObject() throws Exception { + @Test void testGetTimestampObject() throws Exception { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .doWithConnection(connection -> { @@ -6157,14 +6157,14 @@ private void checkGetTimestamp(Connection con) throws SQLException { }); } - @Test public void testRowComparison() { + @Test void testRowComparison() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_SCOTT) .query("SELECT empno FROM JDBC_SCOTT.emp WHERE (ename, job) < ('Blake', 'Manager')") .returnsUnordered("EMPNO=7876", "EMPNO=7499", "EMPNO=7698"); } - @Test public void testTimestampEqualsComparison() { + @Test void testTimestampEqualsComparison() { CalciteAssert.that() .query("select time0 = time1, time0 <> time1" + " from (" @@ -6180,7 +6180,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { + "EXPR$0=null; EXPR$1=null\n"); } - @Test public void testUnicode() throws Exception { + @Test void testUnicode() throws Exception { CalciteAssert.AssertThat with = CalciteAssert.that().with(CalciteAssert.Config.FOODMART_CLONE); @@ -6216,7 +6216,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests metadata for the MySQL lexical scheme. */ - @Test public void testLexMySQL() throws Exception { + @Test void testLexMySQL() throws Exception { CalciteAssert.that() .with(Lex.MYSQL) .doWithConnection(connection -> { @@ -6246,7 +6246,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests metadata for the MySQL ANSI lexical scheme. */ - @Test public void testLexMySQLANSI() throws Exception { + @Test void testLexMySQLANSI() throws Exception { CalciteAssert.that() .with(Lex.MYSQL_ANSI) .doWithConnection(connection -> { @@ -6276,7 +6276,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests metadata for different the "SQL_SERVER" lexical scheme. */ - @Test public void testLexSqlServer() throws Exception { + @Test void testLexSqlServer() throws Exception { CalciteAssert.that() .with(Lex.SQL_SERVER) .doWithConnection(connection -> { @@ -6306,7 +6306,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests metadata for the ORACLE (and default) lexical scheme. */ - @Test public void testLexOracle() throws Exception { + @Test void testLexOracle() throws Exception { CalciteAssert.that() .with(Lex.ORACLE) .doWithConnection(connection -> { @@ -6340,7 +6340,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests metadata for the JAVA lexical scheme. */ - @Test public void testLexJava() throws Exception { + @Test void testLexJava() throws Exception { CalciteAssert.that() .with(Lex.JAVA) .doWithConnection(connection -> { @@ -6371,7 +6371,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests metadata for the ORACLE lexical scheme overridden like JAVA. */ - @Test public void testLexOracleAsJava() throws Exception { + @Test void testLexOracleAsJava() throws Exception { CalciteAssert.that() .with(Lex.ORACLE) .with(CalciteConnectionProperty.QUOTING, Quoting.BACK_TICK) @@ -6406,7 +6406,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests case-insensitive resolution of schema and table names. */ - @Test public void testLexCaseInsensitive() { + @Test void testLexCaseInsensitive() { final CalciteAssert.AssertThat with = CalciteAssert.that().with(Lex.MYSQL); with.query("select COUNT(*) as c from metaData.tAbles") @@ -6433,7 +6433,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { * [CALCITE-1563] * In case-insensitive connection, non-existent tables use alphabetically * preceding table. */ - @Test public void testLexCaseInsensitiveFindsNonexistentTable() { + @Test void testLexCaseInsensitiveFindsNonexistentTable() { final CalciteAssert.AssertThat with = CalciteAssert.that().with(Lex.MYSQL); // With [CALCITE-1563], the following query succeeded; it queried @@ -6449,7 +6449,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { *

Test case for * [CALCITE-550] * Case-insensitive matching of sub-query columns fails. */ - @Test public void testLexCaseInsensitiveSubQueryField() { + @Test void testLexCaseInsensitiveSubQueryField() { CalciteAssert.that() .with(Lex.MYSQL) .query("select DID\n" @@ -6460,7 +6460,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returnsUnordered("DID=1", "DID=2"); } - @Test public void testLexCaseInsensitiveTableAlias() { + @Test void testLexCaseInsensitiveTableAlias() { CalciteAssert.that() .with(Lex.MYSQL) .query("select e.empno\n" @@ -6469,7 +6469,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returnsUnordered("empno=1"); } - @Test public void testFunOracle() { + @Test void testFunOracle() { CalciteAssert.that(CalciteAssert.Config.REGULAR) .with(CalciteConnectionProperty.FUN, "oracle") .query("select nvl(\"commission\", -99) as c from \"hr\".\"emps\"") @@ -6487,7 +6487,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { /** Test case for * [CALCITE-2072] * Enable spatial operator table by adding 'fun=spatial'to JDBC URL. */ - @Test public void testFunSpatial() { + @Test void testFunSpatial() { final String sql = "select distinct\n" + " ST_PointFromText('POINT(-71.0642.28)') as c\n" + "from \"hr\".\"emps\""; @@ -6503,7 +6503,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Unit test for LATERAL CROSS JOIN to table function. */ - @Test public void testLateralJoin() { + @Test void testLateralJoin() { final String sql = "SELECT *\n" + "FROM AUX.SIMPLETABLE ST\n" + "CROSS JOIN LATERAL TABLE(AUX.TBLFUN(ST.INTCOL))"; @@ -6519,7 +6519,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Unit test for view expansion with lateral join. */ - @Test public void testExpandViewWithLateralJoin() { + @Test void testExpandViewWithLateralJoin() { final String sql = "SELECT * FROM AUX.VIEWLATERAL"; CalciteAssert.that(CalciteAssert.Config.AUX) .query(sql) @@ -6533,7 +6533,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests that {@link Hook#PARSE_TREE} works. */ - @Test public void testHook() { + @Test void testHook() { final int[] callCount = {0}; try (Hook.Closeable ignored = Hook.PARSE_TREE.addThread( args -> { @@ -6557,7 +6557,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } /** Tests {@link SqlDialect}. */ - @Test public void testDialect() { + @Test void testDialect() { final String[] sqls = {null}; CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) @@ -6576,7 +6576,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { } } - @Test public void testExplicitImplicitSchemaSameName() throws Exception { + @Test void testExplicitImplicitSchemaSameName() throws Exception { final SchemaPlus rootSchema = CalciteSchema.createRootSchema(false).plus(); // create schema "/a" @@ -6600,7 +6600,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { assertThat(aSchema.getSubSchemaNames().size(), is(1)); } - @Test public void testSimpleCalciteSchema() throws Exception { + @Test void testSimpleCalciteSchema() throws Exception { final SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, false).plus(); // create schema "/a" @@ -6627,7 +6627,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { assertThat(aSchema.getSubSchemaNames().size(), is(2)); } - @Test public void testSimpleCalciteSchemaWithView() throws Exception { + @Test void testSimpleCalciteSchemaWithView() throws Exception { final SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, false).plus(); final Multimap functionMap = @@ -6663,7 +6663,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { assertThat(calciteSchema.getFunctions("V1", false), not(hasItem(view))); } - @Test public void testSchemaCaching() throws Exception { + @Test void testSchemaCaching() throws Exception { final Connection connection = CalciteAssert.that(CalciteAssert.Config.JDBC_FOODMART).connect(); final CalciteConnection calciteConnection = @@ -6752,7 +6752,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { connection.close(); } - @Test public void testCaseSensitiveSubQueryOracle() { + @Test void testCaseSensitiveSubQueryOracle() { final CalciteAssert.AssertThat with = CalciteAssert.that() .with(Lex.ORACLE); @@ -6766,7 +6766,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returnsUnordered("DID=1", "DID=2"); } - @Test public void testUnquotedCaseSensitiveSubQueryMySql() { + @Test void testUnquotedCaseSensitiveSubQueryMySql() { final CalciteAssert.AssertThat with = CalciteAssert.that() .with(Lex.MYSQL); @@ -6792,7 +6792,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returnsUnordered("DID2=1", "DID2=2"); } - @Test public void testQuotedCaseSensitiveSubQueryMySql() { + @Test void testQuotedCaseSensitiveSubQueryMySql() { final CalciteAssert.AssertThat with = CalciteAssert.that() .with(Lex.MYSQL); @@ -6818,7 +6818,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returnsUnordered("DID2=1", "DID2=2"); } - @Test public void testUnquotedCaseSensitiveSubQuerySqlServer() { + @Test void testUnquotedCaseSensitiveSubQuerySqlServer() { CalciteAssert.that() .with(Lex.SQL_SERVER) .query("select DID from (select deptid as did FROM\n" @@ -6826,7 +6826,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returnsUnordered("DID=1", "DID=2"); } - @Test public void testQuotedCaseSensitiveSubQuerySqlServer() { + @Test void testQuotedCaseSensitiveSubQuerySqlServer() { CalciteAssert.that() .with(Lex.SQL_SERVER) .query("select [DID] from (select deptid as did FROM\n" @@ -6839,7 +6839,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { * [CALCITE-596] * JDBC adapter incorrectly reads null values as 0. */ - @Test public void testPrimitiveColumnsWithNullValues() throws Exception { + @Test void testPrimitiveColumnsWithNullValues() throws Exception { String hsqldbMemUrl = "jdbc:hsqldb:mem:."; Connection baseConnection = DriverManager.getConnection(hsqldbMemUrl); Statement baseStmt = baseConnection.createStatement(); @@ -6899,7 +6899,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { * [CALCITE-2054] * Error while validating UPDATE with dynamic parameter in SET clause. */ - @Test public void testUpdateBind() throws Exception { + @Test void testUpdateBind() throws Exception { String hsqldbMemUrl = "jdbc:hsqldb:mem:."; try (Connection baseConnection = DriverManager.getConnection(hsqldbMemUrl); Statement baseStmt = baseConnection.createStatement()) { @@ -6967,7 +6967,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { /** Test case for * [CALCITE-730] * ClassCastException in table from CloneSchema. */ - @Test public void testNullableNumericColumnInCloneSchema() { + @Test void testNullableNumericColumnInCloneSchema() { CalciteAssert.model("{\n" + " version: '1.0',\n" + " defaultSchema: 'SCOTT_CLONE',\n" @@ -7002,7 +7002,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { /** Test case for * [CALCITE-1097] * Exception when executing query with too many aggregation columns. */ - @Test public void testAggMultipleMeasures() throws SQLException { + @Test void testAggMultipleMeasures() throws SQLException { final Driver driver = new Driver(); CalciteConnection connection = (CalciteConnection) driver.connect("jdbc:calcite:", new Properties()); @@ -7039,7 +7039,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { /** Test case for * [CALCITE-3039] * In Interpreter, min() incorrectly returns maximum double value. */ - @Test public void testMinAggWithDouble() { + @Test void testMinAggWithDouble() { try (Hook.Closeable ignored = Hook.ENABLE_BINDABLE.addThread(Hook.propertyJ(true))) { CalciteAssert.hr() .query( @@ -7055,7 +7055,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { /** Test case for * [CALCITE-2224] * WITHIN GROUP clause for aggregate functions. */ - @Test public void testWithinGroupClause1() { + @Test void testWithinGroupClause1() { final String sql = "select X,\n" + " collect(Y) within group (order by Y desc) as \"SET\"\n" + "from (values (1, 'a'), (1, 'b'),\n" @@ -7067,7 +7067,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { "X=3; SET=[d, c]"); } - @Test public void testWithinGroupClause2() { + @Test void testWithinGroupClause2() { final String sql = "select X,\n" + " collect(Y) within group (order by Y desc) as SET_1,\n" + " collect(Y) within group (order by Y asc) as SET_2\n" @@ -7081,7 +7081,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { "X=3; SET_1=[d, c]; SET_2=[c, d]"); } - @Test public void testWithinGroupClause3() { + @Test void testWithinGroupClause3() { final String sql = "select" + " collect(Y) within group (order by Y desc) as SET_1,\n" + " collect(Y) within group (order by Y asc) as SET_2\n" @@ -7091,7 +7091,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("SET_1=[d, c, b, a]; SET_2=[a, b, c, d]\n"); } - @Test public void testWithinGroupClause4() { + @Test void testWithinGroupClause4() { final String sql = "select" + " collect(Y) within group (order by Y desc) as SET_1,\n" + " collect(Y) within group (order by Y asc) as SET_2\n" @@ -7103,7 +7103,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { "SET_1=[d, c]; SET_2=[c, d]"); } - @Test public void testWithinGroupClause5() { + @Test void testWithinGroupClause5() { CalciteAssert .that() .query("select collect(array[X, Y])\n" @@ -7114,7 +7114,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("SET=[[a, d], [a, c], [a, b], [b, a]]\n"); } - @Test public void testWithinGroupClause6() { + @Test void testWithinGroupClause6() { final String sql = "select collect(\"commission\")" + " within group (order by \"commission\")\n" + "from \"hr\".\"emps\""; @@ -7129,7 +7129,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { /** Test case for * [CALCITE-3565] * Explicitly cast assignable operand types to decimal for udf. */ - @Test public void testAssignableTypeCast() { + @Test void testAssignableTypeCast() { final String sql = "SELECT ST_MakePoint(1, 2.1)"; CalciteAssert.that() .with(CalciteAssert.Config.GEO) @@ -7142,7 +7142,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("EXPR$0={\"x\":1,\"y\":2.1}\n"); } - @Test public void testMatchSimple() { + @Test void testMatchSimple() { final String sql = "select *\n" + "from \"hr\".\"emps\" match_recognize (\n" + " order by \"empid\" desc\n" @@ -7176,7 +7176,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C=1000; EMPID=100; TWO=2\nC=500; EMPID=200; TWO=2\n"); } - @Test public void testMatch() { + @Test void testMatch() { final String sql = "select *\n" + "from \"hr\".\"emps\" match_recognize (\n" + " order by \"empid\" desc\n" @@ -7209,7 +7209,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C=1000; EMPID=100\nC=500; EMPID=200\n"); } - @Test public void testJsonType() { + @Test void testJsonType() { CalciteAssert.that() .query("SELECT JSON_TYPE(v) AS c1\n" + ",JSON_TYPE(JSON_VALUE(v, 'lax $.b' ERROR ON ERROR)) AS c2\n" @@ -7220,7 +7220,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C1=OBJECT; C2=ARRAY; C3=INTEGER; C4=BOOLEAN\n"); } - @Test public void testJsonDepth() { + @Test void testJsonDepth() { CalciteAssert.that() .query("SELECT JSON_DEPTH(v) AS c1\n" + ",JSON_DEPTH(JSON_VALUE(v, 'lax $.b' ERROR ON ERROR)) AS c2\n" @@ -7231,7 +7231,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C1=3; C2=2; C3=1; C4=1\n"); } - @Test public void testJsonLength() { + @Test void testJsonLength() { CalciteAssert.that() .query("SELECT JSON_LENGTH(v) AS c1\n" + ",JSON_LENGTH(v, 'lax $.a') AS c2\n" @@ -7242,7 +7242,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C1=1; C2=2; C3=1; C4=1\n"); } - @Test public void testJsonPretty() { + @Test void testJsonPretty() { CalciteAssert.that() .query("SELECT JSON_PRETTY(v) AS c1\n" + "FROM (VALUES ('{\"a\": [10, true],\"b\": [10, true]}')) as t(v)\n" @@ -7253,7 +7253,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { + "}\n"); } - @Test public void testJsonKeys() { + @Test void testJsonKeys() { CalciteAssert.that() .query("SELECT JSON_KEYS(v) AS c1\n" + ",JSON_KEYS(v, 'lax $.a') AS c2\n" @@ -7265,7 +7265,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C1=[\"a\",\"b\"]; C2=null; C3=[\"c\"]; C4=null; C5=null\n"); } - @Test public void testJsonRemove() { + @Test void testJsonRemove() { CalciteAssert.that() .query("SELECT JSON_REMOVE(v, '$[1]') AS c1\n" + "FROM (VALUES ('[\"a\", [\"b\", \"c\"], \"d\"]')) AS t(v)\n" @@ -7273,7 +7273,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("C1=[\"a\",\"d\"]\n"); } - @Test public void testJsonStorageSize() { + @Test void testJsonStorageSize() { CalciteAssert.that() .query("SELECT\n" + "JSON_STORAGE_SIZE('[100, \"sakila\", [1, 3, 5], 425.05]') AS A,\n" @@ -7290,7 +7290,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { * Dynamic parameters ("?") pushed to underlying JDBC schema, causing * error. */ - @Test public void testQueryWithParameter() throws Exception { + @Test void testQueryWithParameter() throws Exception { String hsqldbMemUrl = "jdbc:hsqldb:mem:."; try (Connection baseConnection = DriverManager.getConnection(hsqldbMemUrl); Statement baseStmt = baseConnection.createStatement()) { @@ -7342,7 +7342,7 @@ private void checkGetTimestamp(Connection con) throws SQLException { * [CALCITE-3347] * IndexOutOfBoundsException in FixNullabilityShuttle when using FilterIntoJoinRule. */ - @Test public void testSemiJoin() { + @Test void testSemiJoin() { CalciteAssert.that() .with(CalciteAssert.Config.JDBC_FOODMART) .query("select *\n" diff --git a/core/src/test/java/org/apache/calcite/test/LatticeTest.java b/core/src/test/java/org/apache/calcite/test/LatticeTest.java index 2d814ac24c00..1a6866752009 100644 --- a/core/src/test/java/org/apache/calcite/test/LatticeTest.java +++ b/core/src/test/java/org/apache/calcite/test/LatticeTest.java @@ -68,7 +68,7 @@ * Unit test for lattices. */ @Tag("slow") -public class LatticeTest { +class LatticeTest { private static final String SALES_LATTICE = "{\n" + " name: 'star',\n" + " sql: [\n" @@ -201,7 +201,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** Tests that it's OK for a lattice to have the same name as a table in the * schema. */ - @Test public void testLatticeSql() throws Exception { + @Test void testLatticeSql() throws Exception { modelWithLattice("EMPLOYEES", "select * from \"foodmart\".\"days\"") .doWithConnection(c -> { final SchemaPlus schema = c.getRootSchema(); @@ -227,7 +227,7 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Tests some of the properties of the {@link Lattice} data structure. */ - @Test public void testLattice() throws Exception { + @Test void testLattice() throws Exception { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s\n" + "join \"foodmart\".\"product\" as p using (\"product_id\")\n" @@ -250,7 +250,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** Tests that it's OK for a lattice to have the same name as a table in the * schema. */ - @Test public void testLatticeWithSameNameAsTable() { + @Test void testLatticeWithSameNameAsTable() { modelWithLattice("EMPLOYEES", "select * from \"foodmart\".\"days\"") .query("select count(*) from EMPLOYEES") .returnsValue("4"); @@ -258,7 +258,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** Tests that it's an error to have two lattices with the same name in a * schema. */ - @Test public void testTwoLatticesWithSameNameFails() { + @Test void testTwoLatticesWithSameNameFails() { modelWithLattices( "{name: 'Lattice1', sql: 'select * from \"foodmart\".\"days\"'}", "{name: 'Lattice1', sql: 'select * from \"foodmart\".\"time_by_day\"'}") @@ -266,28 +266,28 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Tests a lattice whose SQL is invalid. */ - @Test public void testLatticeInvalidSqlFails() { + @Test void testLatticeInvalidSqlFails() { modelWithLattice("star", "select foo from nonexistent") .connectThrows("Error instantiating JsonLattice(name=star, ") .connectThrows("Object 'NONEXISTENT' not found"); } /** Tests a lattice whose SQL is invalid because it contains a GROUP BY. */ - @Test public void testLatticeSqlWithGroupByFails() { + @Test void testLatticeSqlWithGroupByFails() { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s group by \"product_id\"") .connectThrows("Invalid node type LogicalAggregate in lattice query"); } /** Tests a lattice whose SQL is invalid because it contains a ORDER BY. */ - @Test public void testLatticeSqlWithOrderByFails() { + @Test void testLatticeSqlWithOrderByFails() { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s order by \"product_id\"") .connectThrows("Invalid node type LogicalSort in lattice query"); } /** Tests a lattice whose SQL is invalid because it contains a UNION ALL. */ - @Test public void testLatticeSqlWithUnionFails() { + @Test void testLatticeSqlWithUnionFails() { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s\n" + "union all\n" @@ -296,14 +296,14 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Tests a lattice with valid join SQL. */ - @Test public void testLatticeSqlWithJoin() { + @Test void testLatticeSqlWithJoin() { foodmartModel() .query("values 1") .returnsValue("1"); } /** Tests a lattice with invalid SQL (for a lattice). */ - @Test public void testLatticeInvalidSql() { + @Test void testLatticeInvalidSql() { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s\n" + "join \"foodmart\".\"product\" as p using (\"product_id\")\n" @@ -312,7 +312,7 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Left join is invalid in a lattice. */ - @Test public void testLatticeInvalidSql2() { + @Test void testLatticeInvalidSql2() { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s\n" + "join \"foodmart\".\"product\" as p using (\"product_id\")\n" @@ -321,7 +321,7 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Each lattice table must have a parent. */ - @Test public void testLatticeInvalidSql3() { + @Test void testLatticeInvalidSql3() { modelWithLattice("star", "select 1 from \"foodmart\".\"sales_fact_1997\" as s\n" + "join \"foodmart\".\"product\" as p using (\"product_id\")\n" @@ -331,7 +331,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** When a lattice is registered, there is a table with the same name. * It can be used for explain, but not for queries. */ - @Test public void testLatticeStarTable() { + @Test void testLatticeStarTable() { final AtomicInteger counter = new AtomicInteger(); try { foodmartModel() @@ -349,7 +349,7 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Tests that a 2-way join query can be mapped 4-way join lattice. */ - @Test public void testLatticeRecognizeJoin() { + @Test void testLatticeRecognizeJoin() { final AtomicInteger counter = new AtomicInteger(); foodmartModel() .query("select s.\"unit_sales\", p.\"brand_name\"\n" @@ -366,7 +366,7 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Tests an aggregate on a 2-way join query can use an aggregate table. */ - @Test public void testLatticeRecognizeGroupJoin() { + @Test void testLatticeRecognizeGroupJoin() { final AtomicInteger counter = new AtomicInteger(); CalciteAssert.AssertQuery that = foodmartModel() .query("select distinct p.\"brand_name\", s.\"customer_id\"\n" @@ -409,7 +409,7 @@ private static CalciteAssert.AssertThat modelWithLattices( } /** Tests a model with pre-defined tiles. */ - @Test public void testLatticeWithPreDefinedTiles() { + @Test void testLatticeWithPreDefinedTiles() { foodmartModel(" auto: false,\n" + " defaultMeasures: [ {\n" + " agg: 'count'\n" @@ -428,7 +428,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** A query that uses a pre-defined aggregate table, at the same * granularity but fewer calls to aggregate functions. */ - @Test public void testLatticeWithPreDefinedTilesFewerMeasures() { + @Test void testLatticeWithPreDefinedTilesFewerMeasures() { foodmartModelWithOneTile() .query("select t.\"the_year\", t.\"quarter\", count(*) as c\n" + "from \"foodmart\".\"sales_fact_1997\" as s\n" @@ -448,7 +448,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** Tests a query that uses a pre-defined aggregate table at a lower * granularity. Includes a measure computed from a grouping column, a measure * based on COUNT rolled up using SUM, and an expression on a measure. */ - @Test public void testLatticeWithPreDefinedTilesRollUp() { + @Test void testLatticeWithPreDefinedTilesRollUp() { foodmartModelWithOneTile() .query("select t.\"the_year\",\n" + " count(*) as c,\n" @@ -474,7 +474,7 @@ private static CalciteAssert.AssertThat modelWithLattices( * [CALCITE-428] * Use optimization algorithm to suggest which tiles of a lattice to * materialize. */ - @Test public void testTileAlgorithm() { + @Test void testTileAlgorithm() { final String explain = "EnumerableAggregate(group=[{2, 3}])\n" + " EnumerableTableScan(table=[[adhoc, m{16, 17, 32, 36, 37}]])"; checkTileAlgorithm( @@ -484,7 +484,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** As {@link #testTileAlgorithm()}, but uses the * {@link Lattices#CACHED_SQL} statistics provider. */ - @Test public void testTileAlgorithm2() { + @Test void testTileAlgorithm2() { // Different explain than above, but note that it still selects columns // (27, 31). final String explain = "EnumerableAggregate(group=[{4, 5}])\n" @@ -495,7 +495,7 @@ private static CalciteAssert.AssertThat modelWithLattices( /** As {@link #testTileAlgorithm()}, but uses the * {@link Lattices#PROFILER} statistics provider. */ - @Test public void testTileAlgorithm3() { + @Test void testTileAlgorithm3() { assumeTrue(TestUtil.getJavaMajorVersion() >= 8, "Yahoo sketches requires JDK 8 or higher"); final String explain = "EnumerableAggregate(group=[{4, 5}])\n" @@ -566,7 +566,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( } /** Tests a query that is created within {@link #testTileAlgorithm()}. */ - @Test public void testJG() { + @Test void testJG() { final String sql = "" + "SELECT \"s\".\"unit_sales\", \"p\".\"recyclable_package\", \"t\".\"the_day\", \"t\".\"the_year\", \"t\".\"quarter\", \"pc\".\"product_family\", COUNT(*) AS \"m0\", SUM(\"s\".\"store_sales\") AS \"m1\", SUM(\"s\".\"unit_sales\") AS \"m2\"\n" + "FROM \"foodmart\".\"sales_fact_1997\" AS \"s\"\n" @@ -593,7 +593,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( } /** Tests a query that uses no columns from the fact table. */ - @Test public void testGroupByEmpty() { + @Test void testGroupByEmpty() { foodmartModel() .query("select count(*) as c from \"foodmart\".\"sales_fact_1997\"") .enableMaterializations(true) @@ -602,13 +602,13 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( /** Calls {@link #testDistinctCount()} followed by * {@link #testGroupByEmpty()}. */ - @Test public void testGroupByEmptyWithPrelude() { + @Test void testGroupByEmptyWithPrelude() { testDistinctCount(); testGroupByEmpty(); } /** Tests a query that uses no dimension columns and one measure column. */ - @Test public void testGroupByEmpty2() { + @Test void testGroupByEmpty2() { foodmartModel() .query("select sum(\"unit_sales\") as s\n" + "from \"foodmart\".\"sales_fact_1997\"") @@ -619,7 +619,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( /** Tests that two queries of the same dimensionality that use different * measures can use the same materialization. */ - @Test public void testGroupByEmpty3() { + @Test void testGroupByEmpty3() { final List mats = new ArrayList<>(); final CalciteAssert.AssertThat that = foodmartModel().pooled(); that.query("select sum(\"unit_sales\") as s, count(*) as c\n" @@ -642,7 +642,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( } /** Rolling up SUM. */ - @Test public void testSum() { + @Test void testSum() { foodmartModelWithOneTile() .query("select sum(\"unit_sales\") as c\n" + "from \"foodmart\".\"sales_fact_1997\"\n" @@ -657,7 +657,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( * *

We can't just roll up count(distinct ...) as we do count(...), but we * can still use the aggregate table if we're smart. */ - @Test public void testDistinctCount() { + @Test void testDistinctCount() { foodmartModelWithOneTile() .query("select count(distinct \"quarter\") as c\n" + "from \"foodmart\".\"sales_fact_1997\"\n" @@ -670,7 +670,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( .returnsUnordered("C=4"); } - @Test public void testDistinctCount2() { + @Test void testDistinctCount2() { foodmartModelWithOneTile() .query("select count(distinct \"the_year\") as c\n" + "from \"foodmart\".\"sales_fact_1997\"\n" @@ -688,7 +688,7 @@ private static CalciteAssert.AssertThat foodmartLatticeModel( * *

Disabled for normal runs, because it is slow. */ @Disabled - @Test public void testAllFoodmartQueries() throws IOException { + @Test void testAllFoodmartQueries() throws IOException { // Test ids that had bugs in them until recently. Useful for a sanity check. final List fixed = ImmutableList.of(13, 24, 28, 30, 61, 76, 79, 81, 85, 98, 101, 107, 128, 129, 130, 131); @@ -721,7 +721,7 @@ private void check(int n) throws IOException { /** A tile with no measures should inherit default measure list from the * lattice. */ - @Test public void testTileWithNoMeasures() { + @Test void testTileWithNoMeasures() { foodmartModel(" auto: false,\n" + " defaultMeasures: [ {\n" + " agg: 'count'\n" @@ -741,7 +741,7 @@ private void check(int n) throws IOException { /** A lattice with no default measure list should get "count(*)" is its * default measure. */ - @Test public void testLatticeWithNoMeasures() { + @Test void testLatticeWithNoMeasures() { foodmartModel(" auto: false,\n" + " tiles: [ {\n" + " dimensions: [ 'the_year', ['t', 'quarter'] ],\n" @@ -756,7 +756,7 @@ private void check(int n) throws IOException { .returnsCount(1); } - @Test public void testDimensionIsInvalidColumn() { + @Test void testDimensionIsInvalidColumn() { foodmartModel(" auto: false,\n" + " tiles: [ {\n" + " dimensions: [ 'invalid_column'],\n" @@ -765,7 +765,7 @@ private void check(int n) throws IOException { .connectThrows("Unknown lattice column 'invalid_column'"); } - @Test public void testMeasureArgIsInvalidColumn() { + @Test void testMeasureArgIsInvalidColumn() { foodmartModel(" auto: false,\n" + " defaultMeasures: [ {\n" + " agg: 'sum',\n" @@ -780,7 +780,7 @@ private void check(int n) throws IOException { /** It is an error for "time_id" to be a measure arg, because is not a * unique alias. Both "s" and "t" have "time_id". */ - @Test public void testMeasureArgIsNotUniqueAlias() { + @Test void testMeasureArgIsNotUniqueAlias() { foodmartModel(" auto: false,\n" + " defaultMeasures: [ {\n" + " agg: 'count',\n" @@ -793,7 +793,7 @@ private void check(int n) throws IOException { .connectThrows("Lattice column alias 'time_id' is not unique"); } - @Test public void testMeasureAggIsInvalid() { + @Test void testMeasureAggIsInvalid() { foodmartModel(" auto: false,\n" + " defaultMeasures: [ {\n" + " agg: 'invalid_count',\n" @@ -806,7 +806,7 @@ private void check(int n) throws IOException { .connectThrows("Unknown lattice aggregate function invalid_count"); } - @Test public void testTwoLattices() { + @Test void testTwoLattices() { final AtomicInteger counter = new AtomicInteger(); // disable for MySQL; times out running star-join query // disable for H2; it thinks our generated SQL has invalid syntax @@ -833,7 +833,7 @@ private void check(int n) throws IOException { /** Test case for * [CALCITE-787] * Star table wrongly assigned to materialized view. */ - @Test public void testOneLatticeOneMV() { + @Test void testOneLatticeOneMV() { final AtomicInteger counter = new AtomicInteger(); final Class clazz = JdbcTest.EmpDeptTableFactory.class; @@ -890,7 +890,7 @@ private void check(int n) throws IOException { * [CALCITE-760] * Aggregate recommender blows up if row count estimate is too high. */ @Disabled - @Test public void testLatticeWithBadRowCountEstimate() { + @Test void testLatticeWithBadRowCountEstimate() { final String lattice = INVENTORY_LATTICE.replace("rowCountEstimate: 4070,", "rowCountEstimate: 4074070,"); @@ -900,7 +900,7 @@ private void check(int n) throws IOException { .returns("EXPR$0=1\n"); } - @Test public void testSuggester() { + @Test void testSuggester() { final Class clazz = JdbcTest.EmpDeptTableFactory.class; final String model = "" @@ -980,7 +980,7 @@ private static void runJdbc() throws SQLException { } /** Unit test for {@link Lattice#getRowCount(double, List)}. */ - @Test public void testColumnCount() { + @Test void testColumnCount() { assertThat(Lattice.getRowCount(10, 2, 3), within(5.03D, 0.01D)); assertThat(Lattice.getRowCount(10, 9, 8), within(9.4D, 0.01D)); assertThat(Lattice.getRowCount(100, 9, 8), within(54.2D, 0.1D)); diff --git a/core/src/test/java/org/apache/calcite/test/LinqFrontJdbcBackTest.java b/core/src/test/java/org/apache/calcite/test/LinqFrontJdbcBackTest.java index 643f1b8d2590..f0ab387f66ca 100644 --- a/core/src/test/java/org/apache/calcite/test/LinqFrontJdbcBackTest.java +++ b/core/src/test/java/org/apache/calcite/test/LinqFrontJdbcBackTest.java @@ -31,8 +31,8 @@ /** * Tests for a linq4j front-end and JDBC back-end. */ -public class LinqFrontJdbcBackTest { - @Test public void testTableWhere() throws SQLException, +class LinqFrontJdbcBackTest { + @Test void testTableWhere() throws SQLException, ClassNotFoundException { final Connection connection = CalciteAssert.that(CalciteAssert.Config.JDBC_FOODMART).connect(); diff --git a/core/src/test/java/org/apache/calcite/test/LogicalProjectDigestTest.java b/core/src/test/java/org/apache/calcite/test/LogicalProjectDigestTest.java index c0974075eb02..043271dd34e4 100644 --- a/core/src/test/java/org/apache/calcite/test/LogicalProjectDigestTest.java +++ b/core/src/test/java/org/apache/calcite/test/LogicalProjectDigestTest.java @@ -33,11 +33,11 @@ /** * Verifies digest for {@link LogicalProject}. */ -public class LogicalProjectDigestTest { +class LogicalProjectDigestTest { /** * Planner does not compare */ - @Test public void fieldNamesDoNotInfluenceDigest() { + @Test void fieldNamesDoNotInfluenceDigest() { final RelBuilder rb = RelBuilder.create(Frameworks.newConfigBuilder().build()); final RelNode xAsEmpid = rb.values(new String[]{"x", "y", "z"}, 1, 2, 3) .project( @@ -68,7 +68,7 @@ public class LogicalProjectDigestTest { + " LogicalValues(tuples=[[{ 1, 2, 3 }]])\n")); } - @Test public void testProjectDigestWithOneTrivialField() { + @Test void testProjectDigestWithOneTrivialField() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); final RelNode rel = builder diff --git a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java index 468432d7e0ad..8b332217db8c 100644 --- a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java +++ b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java @@ -86,7 +86,7 @@ * query and one or more materializations (what Oracle calls materialized views) * and checks that the materialization is used. */ -public class MaterializationTest { +class MaterializationTest { private static final Consumer CONTAINS_M0 = CalciteAssert.checkResultContains( "EnumerableTableScan(table=[[hr, m0]])"); @@ -136,7 +136,7 @@ private static Sql sql(String materialize, String query) { .withQuery(query); } - @Test public void testScan() { + @Test void testScan() { CalciteAssert.that() .withMaterializations( "{\n" @@ -163,7 +163,7 @@ private static Sql sql(String materialize, String query) { .sameResultWithMaterializationsDisabled(); } - @Test public void testFilter() { + @Test void testFilter() { CalciteAssert.that() .withMaterializations( HR_FKUK_MODEL, @@ -176,7 +176,7 @@ private static Sql sql(String materialize, String query) { .sameResultWithMaterializationsDisabled(); } - @Test public void testFilterToProject0() { + @Test void testFilterToProject0() { String union = "select * from \"emps\" where \"empid\" > 300\n" + "union all select * from \"emps\" where \"empid\" < 200"; @@ -185,7 +185,7 @@ private static Sql sql(String materialize, String query) { sql(mv, query).ok(); } - @Test public void testFilterToProject1() { + @Test void testFilterToProject1() { String agg = "select \"deptno\", count(*) as \"c\", sum(\"salary\") as \"s\"\n" + "from \"emps\" group by \"deptno\""; @@ -194,7 +194,7 @@ private static Sql sql(String materialize, String query) { sql(mv, query).noMat(); } - @Test public void testFilterQueryOnProjectView() { + @Test void testFilterQueryOnProjectView() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { MaterializationService.setThreadLocal(); CalciteAssert.that() @@ -264,7 +264,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** Runs the same test as {@link #testFilterQueryOnProjectView()} but more * concisely. */ - @Test public void testFilterQueryOnProjectView0() { + @Test void testFilterQueryOnProjectView0() { sql("select \"deptno\", \"empid\" from \"emps\"", "select \"empid\" + 1 as x from \"emps\" where \"deptno\" = 10") .ok(); @@ -272,7 +272,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnProjectView()} but with extra column in * materialized view. */ - @Test public void testFilterQueryOnProjectView1() { + @Test void testFilterQueryOnProjectView1() { sql("select \"deptno\", \"empid\", \"name\" from \"emps\"", "select \"empid\" + 1 as x from \"emps\" where \"deptno\" = 10") .ok(); @@ -280,13 +280,13 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnProjectView()} but with extra column in both * materialized view and query. */ - @Test public void testFilterQueryOnProjectView2() { + @Test void testFilterQueryOnProjectView2() { sql("select \"deptno\", \"empid\", \"name\" from \"emps\"", "select \"empid\" + 1 as x, \"name\" from \"emps\" where \"deptno\" = 10") .ok(); } - @Test public void testFilterQueryOnProjectView3() { + @Test void testFilterQueryOnProjectView3() { sql("select \"deptno\" - 10 as \"x\", \"empid\" + 1, \"name\" from \"emps\"", "select \"name\" from \"emps\" where \"deptno\" - 10 = 0") .ok(); @@ -294,7 +294,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnProjectView3()} but materialized view cannot * be used because it does not contain required expression. */ - @Test public void testFilterQueryOnProjectView4() { + @Test void testFilterQueryOnProjectView4() { sql("select \"deptno\" - 10 as \"x\", \"empid\" + 1, \"name\" from \"emps\"", "select \"name\" from \"emps\" where \"deptno\" + 10 = 20") .noMat(); @@ -302,7 +302,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnProjectView3()} but also contains an * expression column. */ - @Test public void testFilterQueryOnProjectView5() { + @Test void testFilterQueryOnProjectView5() { sql("select \"deptno\" - 10 as \"x\", \"empid\" + 1 as ee, \"name\"\n" + "from \"emps\"", "select \"name\", \"empid\" + 1 as e\n" @@ -315,7 +315,7 @@ private static void checkNoMaterialize_(String materialize, String query, } /** Cannot materialize because "name" is not projected in the MV. */ - @Test public void testFilterQueryOnProjectView6() { + @Test void testFilterQueryOnProjectView6() { sql("select \"deptno\" - 10 as \"x\", \"empid\" from \"emps\"", "select \"name\" from \"emps\" where \"deptno\" - 10 = 0") .noMat(); @@ -323,7 +323,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnProjectView3()} but also contains an * expression column. */ - @Test public void testFilterQueryOnProjectView7() { + @Test void testFilterQueryOnProjectView7() { sql("select \"deptno\" - 10 as \"x\", \"empid\" + 1, \"name\" from \"emps\"", "select \"name\", \"empid\" + 2 from \"emps\" where \"deptno\" - 10 = 0") .noMat(); @@ -333,7 +333,7 @@ private static void checkNoMaterialize_(String materialize, String query, * [CALCITE-988] * FilterToProjectUnifyRule.invert(MutableRel, MutableRel, MutableProject) * works incorrectly. */ - @Test public void testFilterQueryOnProjectView8() { + @Test void testFilterQueryOnProjectView8() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { MaterializationService.setThreadLocal(); final String m = "select \"salary\", \"commission\",\n" @@ -379,7 +379,7 @@ private static void checkNoMaterialize_(String materialize, String query, } @Tag("slow") - @Test public void testFilterQueryOnFilterView() { + @Test void testFilterQueryOnFilterView() { sql("select \"deptno\", \"empid\", \"name\" from \"emps\" where \"deptno\" = 10", "select \"empid\" + 1 as x, \"name\" from \"emps\" where \"deptno\" = 10") .ok(); @@ -387,7 +387,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in * query. */ - @Test public void testFilterQueryOnFilterView2() { + @Test void testFilterQueryOnFilterView2() { final String materialize = "select \"deptno\", \"empid\", \"name\"\n" + "from \"emps\" where \"deptno\" = 10"; final String query = "select \"empid\" + 1 as x, \"name\"\n" @@ -397,7 +397,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in * view. */ - @Test public void testFilterQueryOnFilterView3() { + @Test void testFilterQueryOnFilterView3() { final String materialize = "select \"deptno\", \"empid\", \"name\"\n" + "from \"emps\"\n" + "where \"deptno\" = 10 or \"deptno\" = 20 or \"empid\" < 160"; @@ -415,7 +415,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in * query. */ - @Test public void testFilterQueryOnFilterView4() { + @Test void testFilterQueryOnFilterView4() { sql("select * from \"emps\" where \"deptno\" > 10", "select \"name\" from \"emps\" where \"deptno\" > 30") .ok(); @@ -423,7 +423,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in * query and columns selected are subset of columns in materialized view. */ - @Test public void testFilterQueryOnFilterView5() { + @Test void testFilterQueryOnFilterView5() { sql("select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10", "select \"name\" from \"emps\" where \"deptno\" > 30") .ok(); @@ -431,7 +431,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in * query and columns selected are subset of columns in materialized view. */ - @Test public void testFilterQueryOnFilterView6() { + @Test void testFilterQueryOnFilterView6() { final String materialize = "select \"name\", \"deptno\", \"salary\"\n" + "from \"emps\"\n" + "where \"salary\" > 2000.5"; @@ -444,7 +444,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in * query and columns selected are subset of columns in materialized view. * Condition here is complex. */ - @Test public void testFilterQueryOnFilterView7() { + @Test void testFilterQueryOnFilterView7() { final String materialize = "select * from \"emps\"\n" + "where ((\"salary\" < 1111.9 and \"deptno\" > 10)\n" + " or (\"empid\" > 400 and \"salary\" > 5000)\n" @@ -459,7 +459,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is stronger in * query. However, columns selected are not present in columns of materialized * view, Hence should not use materialized view. */ - @Test public void testFilterQueryOnFilterView8() { + @Test void testFilterQueryOnFilterView8() { sql("select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10", "select \"name\", \"empid\" from \"emps\" where \"deptno\" > 30") .noMat(); @@ -467,7 +467,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in * query. */ - @Test public void testFilterQueryOnFilterView9() { + @Test void testFilterQueryOnFilterView9() { sql("select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10", "select \"name\", \"empid\" from \"emps\"\n" + "where \"deptno\" > 30 or \"empid\" > 10") @@ -476,7 +476,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition currently * has unsupported type being checked on query. */ - @Test public void testFilterQueryOnFilterView10() { + @Test void testFilterQueryOnFilterView10() { sql("select \"name\", \"deptno\" from \"emps\" where \"deptno\" > 10 " + "and \"name\" = \'calcite\'", "select \"name\", \"empid\" from \"emps\" where \"deptno\" > 30 " @@ -487,7 +487,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in * query and columns selected are subset of columns in materialized view. * Condition here is complex. */ - @Test public void testFilterQueryOnFilterView11() { + @Test void testFilterQueryOnFilterView11() { sql("select \"name\", \"deptno\" from \"emps\" where " + "(\"salary\" < 1111.9 and \"deptno\" > 10)" + "or (\"empid\" > 400 and \"salary\" > 5000)", @@ -498,7 +498,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition of * query is stronger but is on the column not present in MV (salary). */ - @Test public void testFilterQueryOnFilterView12() { + @Test void testFilterQueryOnFilterView12() { sql("select \"name\", \"deptno\" from \"emps\" where \"salary\" > 2000.5", "select \"name\" from \"emps\" where \"deptno\" > 30 and \"salary\" > 3000") .noMat(); @@ -507,7 +507,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView()} but condition is weaker in * query and columns selected are subset of columns in materialized view. * Condition here is complex. */ - @Test public void testFilterQueryOnFilterView13() { + @Test void testFilterQueryOnFilterView13() { sql("select * from \"emps\" where " + "(\"salary\" < 1111.9 and \"deptno\" > 10)" + "or (\"empid\" > 400 and \"salary\" > 5000)", @@ -518,7 +518,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView7()} but columns in materialized * view are a permutation of columns in the query. */ - @Test public void testFilterQueryOnFilterView14() { + @Test void testFilterQueryOnFilterView14() { String q = "select * from \"emps\" where (\"salary\" > 1000 " + "or (\"deptno\" >= 30 and \"salary\" <= 500))"; String m = "select \"deptno\", \"empid\", \"name\", \"salary\", \"commission\" " @@ -531,7 +531,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** As {@link #testFilterQueryOnFilterView13()} but using alias * and condition of query is stronger. */ - @Test public void testAlias() { + @Test void testAlias() { sql("select * from \"emps\" as em where " + "(em.\"salary\" < 1111.9 and em.\"deptno\" > 10)" + "or (em.\"empid\" > 400 and em.\"salary\" > 5000)", @@ -542,7 +542,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** Aggregation query at same level of aggregation as aggregation * materialization. */ - @Test public void testAggregate0() { + @Test void testAggregate0() { sql("select count(*) as c from \"emps\" group by \"empid\"", "select count(*) + 1 as c from \"emps\" group by \"empid\"") .ok(); @@ -551,19 +551,19 @@ private static void checkNoMaterialize_(String materialize, String query, /** * Aggregation query at same level of aggregation as aggregation * materialization but with different row types. */ - @Test public void testAggregate1() { + @Test void testAggregate1() { sql("select count(*) as c0 from \"emps\" group by \"empid\"", "select count(*) as c1 from \"emps\" group by \"empid\"") .ok(); } - @Test public void testAggregate2() { + @Test void testAggregate2() { sql("select \"deptno\", count(*) as c, sum(\"empid\") as s from \"emps\" group by \"deptno\"", "select count(*) + 1 as c, \"deptno\" from \"emps\" group by \"deptno\"") .ok(); } - @Test public void testAggregate3() { + @Test void testAggregate3() { String deduplicated = "(select \"empid\", \"deptno\", \"name\", \"salary\", \"commission\"\n" + "from \"emps\"\n" @@ -583,7 +583,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).ok(); } - @Test public void testAggregate4() { + @Test void testAggregate4() { String mv = "" + "select \"deptno\", \"commission\", sum(\"salary\")\n" + "from \"emps\"\n" @@ -596,7 +596,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testAggregate5() { + @Test void testAggregate5() { String mv = "" + "select \"deptno\" + \"commission\", \"commission\", sum(\"salary\")\n" + "from \"emps\"\n" @@ -613,7 +613,7 @@ private static void checkNoMaterialize_(String materialize, String query, * Matching failed because the filtering condition under Aggregate * references columns for aggregation. */ - @Test public void testAggregate6() { + @Test void testAggregate6() { String mv = "" + "select * from\n" + "(select \"deptno\", sum(\"salary\") as \"sum_salary\", sum(\"commission\")\n" @@ -630,7 +630,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).noMat(); } - @Test public void testAggregate7() { + @Test void testAggregate7() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { MaterializationService.setThreadLocal(); CalciteAssert.that() @@ -652,7 +652,7 @@ private static void checkNoMaterialize_(String materialize, String query, * There will be a compensating Project added after matching of the Aggregate. * This rule targets to test if the Calc can be handled. */ - @Test public void testCompensatingCalcWithAggregate0() { + @Test void testCompensatingCalcWithAggregate0() { String mv = "" + "select * from\n" + "(select \"deptno\", sum(\"salary\") as \"sum_salary\", sum(\"commission\")\n" @@ -672,7 +672,7 @@ private static void checkNoMaterialize_(String materialize, String query, * There will be a compensating Project + Filter added after matching of the Aggregate. * This rule targets to test if the Calc can be handled. */ - @Test public void testCompensatingCalcWithAggregate1() { + @Test void testCompensatingCalcWithAggregate1() { String mv = "" + "select * from\n" + "(select \"deptno\", sum(\"salary\") as \"sum_salary\", sum(\"commission\")\n" @@ -693,7 +693,7 @@ private static void checkNoMaterialize_(String materialize, String query, * There will be a compensating Project + Filter added after matching of the Aggregate. * This rule targets to test if the Calc can be handled. */ - @Test public void testCompensatingCalcWithAggregate2() { + @Test void testCompensatingCalcWithAggregate2() { String mv = "" + "select * from\n" + "(select \"deptno\", sum(\"salary\") as \"sum_salary\", sum(\"commission\")\n" @@ -713,7 +713,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** Aggregation query at same level of aggregation as aggregation * materialization with grouping sets. */ - @Test public void testAggregateGroupSets1() { + @Test void testAggregateGroupSets1() { final String materialize = "" + "select \"empid\", \"deptno\", count(*) as c, sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -726,7 +726,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** Aggregation query with different grouping sets, should not * do materialization. */ - @Test public void testAggregateGroupSets2() { + @Test void testAggregateGroupSets2() { final String materialize = "select \"empid\", \"deptno\",\n" + " count(*) as c, sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -740,7 +740,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** Aggregation query at coarser level of aggregation than aggregation * materialization. Requires an additional aggregate to roll up. Note that * COUNT is rolled up using SUM0. */ - @Test public void testAggregateRollUp() { + @Test void testAggregateRollUp() { final String materialize = "select \"empid\", \"deptno\", count(*) as c,\n" + " sum(\"empid\") as s\n" + "from \"emps\"\n" @@ -760,7 +760,7 @@ private static void checkNoMaterialize_(String materialize, String query, /** Aggregation query with groupSets at coarser level of aggregation than * aggregation materialization. Requires an additional aggregate to roll up. * Note that COUNT is rolled up using SUM0. */ - @Test public void testAggregateGroupSetsRollUp() { + @Test void testAggregateGroupSetsRollUp() { final String materialize = "select \"empid\", \"deptno\", count(*) as c,\n" + " sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -776,7 +776,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testAggregateGroupSetsRollUp2() { + @Test void testAggregateGroupSetsRollUp2() { final String materialize = "select \"empid\", \"deptno\", count(*) as c,\n" + " sum(\"empid\") as s\n" + "from \"emps\"\n" @@ -793,7 +793,7 @@ private static void checkNoMaterialize_(String materialize, String query, } /** Aggregation materialization with a project. */ - @Test public void testAggregateProject() { + @Test void testAggregateProject() { // Note that materialization does not start with the GROUP BY columns. // Not a smart way to design a materialization, but people may do it. final String materialize = "select \"deptno\", count(*) as c,\n" @@ -814,7 +814,7 @@ private static void checkNoMaterialize_(String materialize, String query, * [CALCITE-3087] * AggregateOnProjectToAggregateUnifyRule ignores Project incorrectly when its * Mapping breaks ordering. */ - @Test public void testAggregateOnProject1() { + @Test void testAggregateOnProject1() { final String materialize = "select \"empid\", \"deptno\", count(*) as c,\n" + " sum(\"empid\") as s\n" + "from \"emps\"\n" @@ -825,7 +825,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(materialize, query).ok(); } - @Test public void testAggregateOnProject2() { + @Test void testAggregateOnProject2() { final String materialize = "select \"empid\", \"deptno\", count(*) as c,\n" + " sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -841,7 +841,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testAggregateOnProject3() { + @Test void testAggregateOnProject3() { final String materialize = "select \"empid\", \"deptno\", count(*) as c,\n" + " sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -856,7 +856,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testAggregateOnProject4() { + @Test void testAggregateOnProject4() { final String materialize = "select \"salary\", \"empid\", \"deptno\",\n" + " count(*) as c, sum(\"commission\") as s\n" + "from \"emps\"\n" @@ -876,7 +876,7 @@ private static void checkNoMaterialize_(String materialize, String query, * [CALCITE-3448] * AggregateOnCalcToAggregateUnifyRule ignores Project incorrectly when * there's missing grouping or mapping breaks ordering. */ - @Test public void testAggregateOnProject5() { + @Test void testAggregateOnProject5() { sql("select \"empid\", \"deptno\", \"name\", count(*) from \"emps\"\n" + "group by \"empid\", \"deptno\", \"name\"", "select \"name\", \"empid\", count(*) from \"emps\" group by \"name\", \"empid\"") @@ -887,7 +887,7 @@ private static void checkNoMaterialize_(String materialize, String query, .ok(); } - @Test public void testAggregateOnProjectAndFilter() { + @Test void testAggregateOnProjectAndFilter() { String mv = "" + "select \"deptno\", sum(\"salary\"), count(1)\n" + "from \"emps\"\n" @@ -900,7 +900,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testProjectOnProject() { + @Test void testProjectOnProject() { String mv = "" + "select \"deptno\", sum(\"salary\") + 2, sum(\"commission\")\n" + "from \"emps\"\n" @@ -912,7 +912,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testPermutationError() { + @Test void testPermutationError() { final String materialize = "select min(\"salary\"), count(*),\n" + " max(\"salary\"), sum(\"salary\"), \"empid\"\n" + "from \"emps\"\n" @@ -925,7 +925,7 @@ private static void checkNoMaterialize_(String materialize, String query, .ok(); } - @Test public void testJoinOnLeftProjectToJoin() { + @Test void testJoinOnLeftProjectToJoin() { String mv = "" + "select * from\n" + " (select \"deptno\", sum(\"salary\"), sum(\"commission\")\n" @@ -949,7 +949,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testJoinOnRightProjectToJoin() { + @Test void testJoinOnRightProjectToJoin() { String mv = "" + "select * from\n" + " (select \"deptno\", sum(\"salary\"), sum(\"commission\")\n" @@ -973,7 +973,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testJoinOnProjectsToJoin() { + @Test void testJoinOnProjectsToJoin() { String mv = "" + "select * from\n" + " (select \"deptno\", sum(\"salary\"), sum(\"commission\")\n" @@ -997,7 +997,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testJoinOnCalcToJoin0() { + @Test void testJoinOnCalcToJoin0() { String mv = "" + "select \"emps\".\"empid\", \"emps\".\"deptno\", \"depts\".\"deptno\" from\n" + "\"emps\" join \"depts\"\n" @@ -1010,7 +1010,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testJoinOnCalcToJoin1() { + @Test void testJoinOnCalcToJoin1() { String mv = "" + "select \"emps\".\"empid\", \"emps\".\"deptno\", \"depts\".\"deptno\" from\n" + "\"emps\" join \"depts\"\n" @@ -1023,7 +1023,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testJoinOnCalcToJoin2() { + @Test void testJoinOnCalcToJoin2() { String mv = "" + "select \"emps\".\"empid\", \"emps\".\"deptno\", \"depts\".\"deptno\" from\n" + "\"emps\" join \"depts\"\n" @@ -1037,7 +1037,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testJoinOnCalcToJoin3() { + @Test void testJoinOnCalcToJoin3() { String mv = "" + "select \"emps\".\"empid\", \"emps\".\"deptno\", \"depts\".\"deptno\" from\n" + "\"emps\" join \"depts\"\n" @@ -1052,7 +1052,7 @@ private static void checkNoMaterialize_(String materialize, String query, sql(mv, query).withOnlyBySubstitution(true).noMat(); } - @Test public void testJoinOnCalcToJoin4() { + @Test void testJoinOnCalcToJoin4() { String mv = "select \"emps\".\"empid\", \"emps\".\"deptno\",\n" + " \"depts\".\"deptno\"\n" + "from \"emps\"\n" @@ -1068,7 +1068,7 @@ private static void checkNoMaterialize_(String materialize, String query, } @Tag("slow") - @Test public void testSwapJoin() { + @Test void testSwapJoin() { final String materialize = "select count(*) as c\n" + "from \"foodmart\".\"sales_fact_1997\" as s\n" + "join \"foodmart\".\"time_by_day\" as t on s.\"time_id\" = t.\"time_id\""; @@ -1082,38 +1082,38 @@ private static void checkNoMaterialize_(String materialize, String query, } @Disabled - @Test public void testOrderByQueryOnProjectView() { + @Test void testOrderByQueryOnProjectView() { sql("select \"deptno\", \"empid\" from \"emps\"", "select \"empid\" from \"emps\" order by \"deptno\"") .ok(); } @Disabled - @Test public void testOrderByQueryOnOrderByView() { + @Test void testOrderByQueryOnOrderByView() { sql("select \"deptno\", \"empid\" from \"emps\" order by \"deptno\"", "select \"empid\" from \"emps\" order by \"deptno\"") .ok(); } @Disabled - @Test public void testDifferentColumnNames() {} + @Test void testDifferentColumnNames() {} @Disabled - @Test public void testDifferentType() {} + @Test void testDifferentType() {} @Disabled - @Test public void testPartialUnion() {} + @Test void testPartialUnion() {} @Disabled - @Test public void testNonDisjointUnion() {} + @Test void testNonDisjointUnion() {} @Disabled - @Test public void testMaterializationReferencesTableInOtherSchema() {} + @Test void testMaterializationReferencesTableInOtherSchema() {} /** Unit test for logic functions * {@link org.apache.calcite.plan.SubstitutionVisitor#mayBeSatisfiable} and * {@link RexUtil#simplify}. */ - @Test public void testSatisfiable() { + @Test void testSatisfiable() { // TRUE may be satisfiable checkSatisfiable(rexBuilder.makeLiteral(true), "true"); @@ -1276,7 +1276,7 @@ private void checkSatisfiable(RexNode e, String s) { assertEquals(s, simple.toStringRaw()); } - @Test public void testSplitFilter() { + @Test void testSplitFilter() { final RexLiteral i1 = rexBuilder.makeExactLiteral(BigDecimal.ONE); final RexLiteral i2 = rexBuilder.makeExactLiteral(BigDecimal.valueOf(2)); final RexLiteral i3 = rexBuilder.makeExactLiteral(BigDecimal.valueOf(3)); @@ -1431,7 +1431,7 @@ private void checkSatisfiable(RexNode e, String s) { * */ @Disabled - @Test public void testFilterGroupQueryOnStar() { + @Test void testFilterGroupQueryOnStar() { sql("select p.\"product_name\", t.\"the_year\",\n" + " sum(f.\"unit_sales\") as \"sum_unit_sales\", count(*) as \"c\"\n" + "from \"foodmart\".\"sales_fact_1997\" as f\n" @@ -1464,7 +1464,7 @@ private void checkSatisfiable(RexNode e, String s) { /** Simpler than {@link #testFilterGroupQueryOnStar()}, tests a query on a * materialization that is just a join. */ @Disabled - @Test public void testQueryOnStar() { + @Test void testQueryOnStar() { String q = "select *\n" + "from \"foodmart\".\"sales_fact_1997\" as f\n" + "join \"foodmart\".\"time_by_day\" as t on f.\"time_id\" = t.\"time_id\"\n" @@ -1479,14 +1479,14 @@ private void checkSatisfiable(RexNode e, String s) { * to a star table and therefore cannot be recognized. This test checks that * nothing unpleasant happens. */ @Disabled - @Test public void testJoinOnUnionMaterialization() { + @Test void testJoinOnUnionMaterialization() { String q = "select *\n" + "from (select * from \"emps\" union all select * from \"emps\")\n" + "join \"depts\" using (\"deptno\")"; sql(q, q).noMat(); } - @Test public void testJoinMaterialization() { + @Test void testJoinMaterialization() { String q = "select *\n" + "from (select * from \"emps\" where \"empid\" < 300)\n" + "join \"depts\" using (\"deptno\")"; @@ -1497,7 +1497,7 @@ private void checkSatisfiable(RexNode e, String s) { * [CALCITE-891] * TableScan without Project cannot be substituted by any projected * materialization. */ - @Test public void testJoinMaterialization2() { + @Test void testJoinMaterialization2() { String q = "select *\n" + "from \"emps\"\n" + "join \"depts\" using (\"deptno\")"; @@ -1506,7 +1506,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(m, q).ok(); } - @Test public void testJoinMaterialization3() { + @Test void testJoinMaterialization3() { String q = "select \"empid\" \"deptno\" from \"emps\"\n" + "join \"depts\" using (\"deptno\") where \"empid\" = 1"; final String m = "select \"empid\" \"deptno\" from \"emps\"\n" @@ -1514,7 +1514,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(m, q).ok(); } - @Test public void testUnionAll() { + @Test void testUnionAll() { String q = "select * from \"emps\" where \"empid\" > 300\n" + "union all select * from \"emps\" where \"empid\" < 200"; String m = "select * from \"emps\" where \"empid\" < 500"; @@ -1524,7 +1524,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationNoAggregateFuncs1() { + @Test void testAggregateMaterializationNoAggregateFuncs1() { sql("select \"empid\", \"deptno\" from \"emps\" group by \"empid\", \"deptno\"", "select \"empid\", \"deptno\" from \"emps\" group by \"empid\", \"deptno\"") .withResultContains( @@ -1532,7 +1532,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationNoAggregateFuncs2() { + @Test void testAggregateMaterializationNoAggregateFuncs2() { sql("select \"empid\", \"deptno\" from \"emps\" group by \"empid\", \"deptno\"", "select \"deptno\" from \"emps\" group by \"deptno\"") .withResultContains( @@ -1541,13 +1541,13 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationNoAggregateFuncs3() { + @Test void testAggregateMaterializationNoAggregateFuncs3() { sql("select \"deptno\" from \"emps\" group by \"deptno\"", "select \"empid\", \"deptno\" from \"emps\" group by \"empid\", \"deptno\"") .noMat(); } - @Test public void testAggregateMaterializationNoAggregateFuncs4() { + @Test void testAggregateMaterializationNoAggregateFuncs4() { final String materialize = "select \"empid\", \"deptno\"\n" + "from \"emps\"\n" + "where \"deptno\" = 10\n" @@ -1561,7 +1561,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testAggregateMaterializationNoAggregateFuncs5() { + @Test void testAggregateMaterializationNoAggregateFuncs5() { final String materialize = "select \"empid\", \"deptno\"\n" + "from \"emps\"\n" + "where \"deptno\" = 5\n" @@ -1573,7 +1573,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).noMat(); } - @Test public void testAggregateMaterializationNoAggregateFuncs6() { + @Test void testAggregateMaterializationNoAggregateFuncs6() { final String materialize = "select \"empid\", \"deptno\"\n" + "from \"emps\"\n" + "where \"deptno\" > 5\n" @@ -1589,7 +1589,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testAggregateMaterializationNoAggregateFuncs7() { + @Test void testAggregateMaterializationNoAggregateFuncs7() { final String materialize = "select \"empid\", \"deptno\"\n" + "from \"emps\"\n" + "where \"deptno\" > 5\n" @@ -1601,13 +1601,13 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).noMat(); } - @Test public void testAggregateMaterializationNoAggregateFuncs8() { + @Test void testAggregateMaterializationNoAggregateFuncs8() { sql("select \"empid\" from \"emps\" group by \"empid\", \"deptno\"", "select \"deptno\" from \"emps\" group by \"deptno\"") .noMat(); } - @Test public void testAggregateMaterializationNoAggregateFuncs9() { + @Test void testAggregateMaterializationNoAggregateFuncs9() { sql("select \"empid\", \"deptno\" from \"emps\"\n" + "where \"salary\" > 1000 group by \"name\", \"empid\", \"deptno\"", "select \"empid\" from \"emps\"\n" @@ -1615,7 +1615,7 @@ private void checkSatisfiable(RexNode e, String s) { .noMat(); } - @Test public void testAggregateMaterializationAggregateFuncs1() { + @Test void testAggregateMaterializationAggregateFuncs1() { sql("select \"empid\", \"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" group by \"empid\", \"deptno\"", "select \"deptno\" from \"emps\" group by \"deptno\"") @@ -1625,7 +1625,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs2() { + @Test void testAggregateMaterializationAggregateFuncs2() { sql("select \"empid\", \"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" group by \"empid\", \"deptno\"", "select \"deptno\", count(*) as c, sum(\"empid\") as s\n" @@ -1636,7 +1636,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs3() { + @Test void testAggregateMaterializationAggregateFuncs3() { sql("select \"empid\", \"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" group by \"empid\", \"deptno\"", "select \"deptno\", \"empid\", sum(\"empid\") as s, count(*) as c\n" @@ -1648,7 +1648,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs4() { + @Test void testAggregateMaterializationAggregateFuncs4() { sql("select \"empid\", \"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" where \"deptno\" >= 10 group by \"empid\", \"deptno\"", "select \"deptno\", sum(\"empid\") as s\n" @@ -1661,7 +1661,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs5() { + @Test void testAggregateMaterializationAggregateFuncs5() { sql("select \"empid\", \"deptno\", count(*) + 1 as c, sum(\"empid\") as s\n" + "from \"emps\" where \"deptno\" >= 10 group by \"empid\", \"deptno\"", "select \"deptno\", sum(\"empid\") + 1 as s\n" @@ -1676,7 +1676,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs6() { + @Test void testAggregateMaterializationAggregateFuncs6() { sql("select \"empid\", \"deptno\", count(*) + 1 as c, sum(\"empid\") + 2 as s\n" + "from \"emps\" where \"deptno\" >= 10 group by \"empid\", \"deptno\"", "select \"deptno\", sum(\"empid\") + 1 as s\n" @@ -1684,7 +1684,7 @@ private void checkSatisfiable(RexNode e, String s) { .noMat(); } - @Test public void testAggregateMaterializationAggregateFuncs7() { + @Test void testAggregateMaterializationAggregateFuncs7() { sql("select \"empid\", \"deptno\", count(*) + 1 as c, sum(\"empid\") as s\n" + "from \"emps\" where \"deptno\" >= 10 group by \"empid\", \"deptno\"", "select \"deptno\" + 1, sum(\"empid\") + 1 as s\n" @@ -1700,7 +1700,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Disabled - @Test public void testAggregateMaterializationAggregateFuncs8() { + @Test void testAggregateMaterializationAggregateFuncs8() { // TODO: It should work, but top project in the query is not matched by the planner. // It needs further checking. sql("select \"empid\", \"deptno\" + 1, count(*) + 1 as c, sum(\"empid\") as s\n" @@ -1710,7 +1710,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs9() { + @Test void testAggregateMaterializationAggregateFuncs9() { final String materialize = "select \"empid\",\n" + " floor(cast('1997-01-20 12:34:56' as timestamp) to month),\n" + " count(*) + 1 as c, sum(\"empid\") as s\n" @@ -1725,7 +1725,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs10() { + @Test void testAggregateMaterializationAggregateFuncs10() { final String materialize = "select \"empid\",\n" + " floor(cast('1997-01-20 12:34:56' as timestamp) to month),\n" + " count(*) + 1 as c, sum(\"empid\") as s\n" @@ -1740,7 +1740,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs11() { + @Test void testAggregateMaterializationAggregateFuncs11() { final String materialize = "select \"empid\",\n" + " floor(cast('1997-01-20 12:34:56' as timestamp) to second),\n" + " count(*) + 1 as c, sum(\"empid\") as s\nfrom \"emps\"\n" @@ -1754,7 +1754,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs12() { + @Test void testAggregateMaterializationAggregateFuncs12() { final String materialize = "select \"empid\",\n" + " floor(cast('1997-01-20 12:34:56' as timestamp) to second),\n" + " count(*) + 1 as c, sum(\"empid\") as s\n" @@ -1769,7 +1769,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs13() { + @Test void testAggregateMaterializationAggregateFuncs13() { final String materialize = "select \"empid\",\n" + " cast('1997-01-20 12:34:56' as timestamp),\n" + " count(*) + 1 as c, sum(\"empid\") as s\n" @@ -1783,7 +1783,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs14() { + @Test void testAggregateMaterializationAggregateFuncs14() { final String materialize = "select \"empid\",\n" + " floor(cast('1997-01-20 12:34:56' as timestamp) to month),\n" + " count(*) + 1 as c, sum(\"empid\") as s\n" @@ -1798,7 +1798,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs15() { + @Test void testAggregateMaterializationAggregateFuncs15() { final String materialize = "select \"eventid\",\n" + " floor(cast(\"ts\" as timestamp) to second), count(*) + 1 as c,\n" + " sum(\"eventid\") as s\n" @@ -1811,7 +1811,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs16() { + @Test void testAggregateMaterializationAggregateFuncs16() { sql("select \"eventid\", cast(\"ts\" as timestamp), count(*) + 1 as c, sum(\"eventid\") as s\n" + "from \"events\" group by \"eventid\", cast(\"ts\" as timestamp)", "select floor(cast(\"ts\" as timestamp) to year), sum(\"eventid\") as s\n" @@ -1819,7 +1819,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs17() { + @Test void testAggregateMaterializationAggregateFuncs17() { final String materialize = "select \"eventid\",\n" + " floor(cast(\"ts\" as timestamp) to month), count(*) + 1 as c,\n" + " sum(\"eventid\") as s\n" @@ -1833,7 +1833,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testAggregateMaterializationAggregateFuncs18() { + @Test void testAggregateMaterializationAggregateFuncs18() { sql("select \"empid\", \"deptno\", count(*) + 1 as c, sum(\"empid\") as s\n" + "from \"emps\" group by \"empid\", \"deptno\"", "select \"empid\"*\"deptno\", sum(\"empid\") as s\n" @@ -1841,7 +1841,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationAggregateFuncs19() { + @Test void testAggregateMaterializationAggregateFuncs19() { sql("select \"empid\", \"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" group by \"empid\", \"deptno\"", "select \"empid\" + 10, count(*) + 1 as c\n" @@ -1849,7 +1849,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs1() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs1() { sql("select \"empid\", \"depts\".\"deptno\" from \"emps\"\n" + "join \"depts\" using (\"deptno\") where \"depts\".\"deptno\" > 10\n" + "group by \"empid\", \"depts\".\"deptno\"", @@ -1863,7 +1863,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs2() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs2() { sql("select \"depts\".\"deptno\", \"empid\" from \"depts\"\n" + "join \"emps\" using (\"deptno\") where \"depts\".\"deptno\" > 10\n" + "group by \"empid\", \"depts\".\"deptno\"", @@ -1877,7 +1877,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs3() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs3() { // It does not match, Project on top of query sql("select \"empid\" from \"emps\"\n" + "join \"depts\" using (\"deptno\") where \"depts\".\"deptno\" > 10\n" @@ -1888,7 +1888,7 @@ private void checkSatisfiable(RexNode e, String s) { .noMat(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs4() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs4() { sql("select \"empid\", \"depts\".\"deptno\" from \"emps\"\n" + "join \"depts\" using (\"deptno\") where \"emps\".\"deptno\" > 10\n" + "group by \"empid\", \"depts\".\"deptno\"", @@ -1902,7 +1902,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs5() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs5() { final String materialize = "select \"depts\".\"deptno\", \"emps\".\"empid\" from \"depts\"\n" + "join \"emps\" using (\"deptno\") where \"emps\".\"empid\" > 10\n" + "group by \"depts\".\"deptno\", \"emps\".\"empid\""; @@ -1916,7 +1916,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs6() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs6() { final String materialize = "select \"depts\".\"deptno\", \"emps\".\"empid\" from \"depts\"\n" + "join \"emps\" using (\"deptno\") where \"emps\".\"empid\" > 10\n" + "group by \"depts\".\"deptno\", \"emps\".\"empid\""; @@ -1931,7 +1931,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinAggregateMaterializationNoAggregateFuncs7() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs7() { final String materialize = "select \"depts\".\"deptno\",\n" + " \"dependents\".\"empid\"\n" + "from \"depts\"\n" @@ -1956,7 +1956,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expecteds).ok(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs8() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs8() { final String materialize = "select \"depts\".\"deptno\",\n" + " \"dependents\".\"empid\"\n" + "from \"depts\"\n" @@ -1975,7 +1975,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).noMat(); } - @Test public void testJoinAggregateMaterializationNoAggregateFuncs9() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs9() { final String materialize = "select \"depts\".\"deptno\",\n" + " \"dependents\".\"empid\"\n" + "from \"depts\"\n" @@ -2001,7 +2001,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinAggregateMaterializationNoAggregateFuncs10() { + @Test void testJoinAggregateMaterializationNoAggregateFuncs10() { final String materialize = "select \"depts\".\"name\", \"dependents\".\"name\" as \"name2\", " + "\"emps\".\"deptno\", \"depts\".\"deptno\" as \"deptno2\", " + "\"dependents\".\"empid\"\n" @@ -2025,7 +2025,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs1() { + @Test void testJoinAggregateMaterializationAggregateFuncs1() { // This test relies on FK-UK relationship final String materialize = "select \"empid\", \"depts\".\"deptno\", count(*) as c, sum(\"empid\") as s\n" @@ -2037,7 +2037,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs2() { + @Test void testJoinAggregateMaterializationAggregateFuncs2() { final String materialize = "select \"empid\", \"emps\".\"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" join \"depts\" using (\"deptno\")\n" @@ -2050,7 +2050,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs3() { + @Test void testJoinAggregateMaterializationAggregateFuncs3() { // This test relies on FK-UK relationship final String materialize = "select \"empid\", \"depts\".\"deptno\", count(*) as c, sum(\"empid\") as s\n" @@ -2064,7 +2064,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs4() { + @Test void testJoinAggregateMaterializationAggregateFuncs4() { final String materialize = "select \"empid\", \"emps\".\"deptno\", count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" join \"depts\" using (\"deptno\")\n" @@ -2079,7 +2079,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs5() { + @Test void testJoinAggregateMaterializationAggregateFuncs5() { final String materialize = "select \"empid\", \"depts\".\"deptno\", count(*) + 1 as c, sum(\"empid\") as s\n" + "from \"emps\" join \"depts\" using (\"deptno\")\n" @@ -2097,7 +2097,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Disabled - @Test public void testJoinAggregateMaterializationAggregateFuncs6() { + @Test void testJoinAggregateMaterializationAggregateFuncs6() { // This rewriting would be possible if planner generates a pre-aggregation, // since the materialized view would match the sub-query. // Initial investigation after enabling AggregateJoinTransposeRule.EXTENDED @@ -2118,7 +2118,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(m, q).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs7() { + @Test void testJoinAggregateMaterializationAggregateFuncs7() { final String materialize = "select \"dependents\".\"empid\",\n" + " \"emps\".\"deptno\", sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -2138,7 +2138,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs8() { + @Test void testJoinAggregateMaterializationAggregateFuncs8() { final String materialize = "select \"dependents\".\"empid\",\n" + " \"emps\".\"deptno\", sum(\"salary\") as s\n" + "from \"emps\"\n" @@ -2158,7 +2158,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs9() { + @Test void testJoinAggregateMaterializationAggregateFuncs9() { final String materialize = "select \"dependents\".\"empid\",\n" + " \"emps\".\"deptno\", count(distinct \"salary\") as s\n" + "from \"emps\"\n" @@ -2175,7 +2175,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).withResultContains(expected).ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs10() { + @Test void testJoinAggregateMaterializationAggregateFuncs10() { final String materialize = "select \"dependents\".\"empid\",\n" + " \"emps\".\"deptno\", count(distinct \"salary\") as s\n" + "from \"emps\"\n" @@ -2190,7 +2190,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinAggregateMaterializationAggregateFuncs11() { + @Test void testJoinAggregateMaterializationAggregateFuncs11() { final String materialize = "select \"depts\".\"deptno\",\n" + " \"dependents\".\"empid\", count(\"emps\".\"salary\") as s\n" + "from \"depts\"\n" @@ -2220,7 +2220,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs12() { + @Test void testJoinAggregateMaterializationAggregateFuncs12() { final String materialize = "select \"depts\".\"deptno\",\n" + " \"dependents\".\"empid\",\n" + " count(distinct \"emps\".\"salary\") as s\n" @@ -2241,7 +2241,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).noMat(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs13() { + @Test void testJoinAggregateMaterializationAggregateFuncs13() { final String materialize = "select \"dependents\".\"empid\",\n" + " \"emps\".\"deptno\", count(distinct \"salary\") as s\n" + "from \"emps\"\n" @@ -2254,7 +2254,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(materialize, query).noMat(); } - @Test public void testJoinAggregateMaterializationAggregateFuncs14() { + @Test void testJoinAggregateMaterializationAggregateFuncs14() { sql("select \"empid\", \"emps\".\"name\", \"emps\".\"deptno\", \"depts\".\"name\", " + "count(*) as c, sum(\"empid\") as s\n" + "from \"emps\" join \"depts\" using (\"deptno\")\n" @@ -2268,7 +2268,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization4() { + @Test void testJoinMaterialization4() { sql("select \"empid\" \"deptno\" from \"emps\"\n" + "join \"depts\" using (\"deptno\")", "select \"empid\" \"deptno\" from \"emps\"\n" @@ -2280,7 +2280,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization5() { + @Test void testJoinMaterialization5() { sql("select cast(\"empid\" as BIGINT) from \"emps\"\n" + "join \"depts\" using (\"deptno\")", "select \"empid\" \"deptno\" from \"emps\"\n" @@ -2292,7 +2292,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization6() { + @Test void testJoinMaterialization6() { sql("select cast(\"empid\" as BIGINT) from \"emps\"\n" + "join \"depts\" using (\"deptno\")", "select \"empid\" \"deptno\" from \"emps\"\n" @@ -2305,7 +2305,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization7() { + @Test void testJoinMaterialization7() { sql("select \"depts\".\"name\"\n" + "from \"emps\"\n" + "join \"depts\" on (\"emps\".\"deptno\" = \"depts\".\"deptno\")", @@ -2323,7 +2323,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization8() { + @Test void testJoinMaterialization8() { sql("select \"depts\".\"name\"\n" + "from \"emps\"\n" + "join \"depts\" on (\"emps\".\"deptno\" = \"depts\".\"deptno\")", @@ -2339,7 +2339,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization9() { + @Test void testJoinMaterialization9() { sql("select \"depts\".\"name\"\n" + "from \"emps\"\n" + "join \"depts\" on (\"emps\".\"deptno\" = \"depts\".\"deptno\")", @@ -2352,7 +2352,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinMaterialization10() { + @Test void testJoinMaterialization10() { sql("select \"depts\".\"deptno\", \"dependents\".\"empid\"\n" + "from \"depts\"\n" + "join \"dependents\" on (\"depts\".\"name\" = \"dependents\".\"name\")\n" @@ -2370,7 +2370,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterialization11() { + @Test void testJoinMaterialization11() { sql("select \"empid\" from \"emps\"\n" + "join \"depts\" using (\"deptno\")", "select \"empid\" from \"emps\"\n" @@ -2381,7 +2381,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinMaterialization12() { + @Test void testJoinMaterialization12() { sql("select \"empid\", \"emps\".\"name\", \"emps\".\"deptno\", \"depts\".\"name\"\n" + "from \"emps\" join \"depts\" using (\"deptno\")\n" + "where (\"depts\".\"name\" is not null and \"emps\".\"name\" = 'a') or " @@ -2394,7 +2394,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterializationUKFK1() { + @Test void testJoinMaterializationUKFK1() { sql("select \"a\".\"empid\" \"deptno\" from\n" + "(select * from \"emps\" where \"empid\" = 1) \"a\"\n" + "join \"depts\" using (\"deptno\")\n" @@ -2407,7 +2407,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterializationUKFK2() { + @Test void testJoinMaterializationUKFK2() { sql("select \"a\".\"empid\", \"a\".\"deptno\" from\n" + "(select * from \"emps\" where \"empid\" = 1) \"a\"\n" + "join \"depts\" using (\"deptno\")\n" @@ -2421,7 +2421,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterializationUKFK3() { + @Test void testJoinMaterializationUKFK3() { sql("select \"a\".\"empid\", \"a\".\"deptno\" from\n" + "(select * from \"emps\" where \"empid\" = 1) \"a\"\n" + "join \"depts\" using (\"deptno\")\n" @@ -2432,7 +2432,7 @@ private void checkSatisfiable(RexNode e, String s) { .noMat(); } - @Test public void testJoinMaterializationUKFK4() { + @Test void testJoinMaterializationUKFK4() { sql("select \"empid\" \"deptno\" from\n" + "(select * from \"emps\" where \"empid\" = 1)\n" + "join \"depts\" using (\"deptno\")", @@ -2443,7 +2443,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinMaterializationUKFK5() { + @Test void testJoinMaterializationUKFK5() { sql("select \"emps\".\"empid\", \"emps\".\"deptno\" from \"emps\"\n" + "join \"depts\" using (\"deptno\")\n" + "join \"dependents\" using (\"empid\")" @@ -2458,7 +2458,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinMaterializationUKFK6() { + @Test void testJoinMaterializationUKFK6() { sql("select \"emps\".\"empid\", \"emps\".\"deptno\" from \"emps\"\n" + "join \"depts\" \"a\" on (\"emps\".\"deptno\"=\"a\".\"deptno\")\n" + "join \"depts\" \"b\" on (\"emps\".\"deptno\"=\"b\".\"deptno\")\n" @@ -2473,7 +2473,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testJoinMaterializationUKFK7() { + @Test void testJoinMaterializationUKFK7() { sql("select \"emps\".\"empid\", \"emps\".\"deptno\" from \"emps\"\n" + "join \"depts\" \"a\" on (\"emps\".\"name\"=\"a\".\"name\")\n" + "join \"depts\" \"b\" on (\"emps\".\"name\"=\"b\".\"name\")\n" @@ -2485,7 +2485,7 @@ private void checkSatisfiable(RexNode e, String s) { .noMat(); } - @Test public void testJoinMaterializationUKFK8() { + @Test void testJoinMaterializationUKFK8() { sql("select \"emps\".\"empid\", \"emps\".\"deptno\" from \"emps\"\n" + "join \"depts\" \"a\" on (\"emps\".\"deptno\"=\"a\".\"deptno\")\n" + "join \"depts\" \"b\" on (\"emps\".\"name\"=\"b\".\"name\")\n" @@ -2498,7 +2498,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Tag("slow") - @Test public void testJoinMaterializationUKFK9() { + @Test void testJoinMaterializationUKFK9() { sql("select * from \"emps\"\n" + "join \"dependents\" using (\"empid\")", "select \"emps\".\"empid\", \"dependents\".\"empid\", \"emps\".\"deptno\"\n" @@ -2511,7 +2511,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateOnJoinKeys() { + @Test void testAggregateOnJoinKeys() { sql("select \"deptno\", \"empid\", \"salary\" " + "from \"emps\"\n" + "group by \"deptno\", \"empid\", \"salary\"", @@ -2526,7 +2526,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateOnJoinKeys2() { + @Test void testAggregateOnJoinKeys2() { sql("select \"deptno\", \"empid\", \"salary\", sum(1) " + "from \"emps\"\n" + "group by \"deptno\", \"empid\", \"salary\"", @@ -2541,7 +2541,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testViewMaterialization() { + @Test void testViewMaterialization() { sql("select \"depts\".\"name\"\n" + "from \"emps\"\n" + "join \"depts\" on (\"emps\".\"deptno\" = \"depts\".\"deptno\")", @@ -2556,7 +2556,7 @@ private void checkSatisfiable(RexNode e, String s) { .returnsValue("noname"); } - @Test public void testSubQuery() { + @Test void testSubQuery() { String q = "select \"empid\", \"deptno\", \"salary\" from \"emps\" e1\n" + "where \"empid\" = (\n" + " select max(\"empid\") from \"emps\"\n" @@ -2568,7 +2568,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testTableModify() { + @Test void testTableModify() { final String m = "select \"deptno\", \"empid\", \"name\"" + "from \"emps\" where \"deptno\" = 10"; final String q = "upsert into \"dependents\"" @@ -2595,7 +2595,7 @@ private void checkSatisfiable(RexNode e, String s) { /** Test case for * [CALCITE-761] * Pre-populated materializations. */ - @Test public void testPrePopulated() { + @Test void testPrePopulated() { String q = "select distinct \"deptno\" from \"emps\""; try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { MaterializationService.setThreadLocal(); @@ -2616,7 +2616,7 @@ private void checkSatisfiable(RexNode e, String s) { } } - @Test public void testViewSchemaPath() { + @Test void testViewSchemaPath() { try (TryThreadLocal.Memo ignored = Prepare.THREAD_TRIM.push(true)) { MaterializationService.setThreadLocal(); final String m = "select empno, deptno from emp"; @@ -2656,7 +2656,7 @@ private void checkSatisfiable(RexNode e, String s) { } } - @Test public void testSingleMaterializationMultiUsage() { + @Test void testSingleMaterializationMultiUsage() { String q = "select *\n" + "from (select * from \"emps\" where \"empid\" < 300)\n" + "join (select * from \"emps\" where \"empid\" < 200) using (\"empid\")"; @@ -2667,7 +2667,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testMultiMaterializationMultiUsage() { + @Test void testMultiMaterializationMultiUsage() { String q = "select *\n" + "from (select * from \"emps\" where \"empid\" < 300)\n" + "join (select \"deptno\", count(*) as c from \"emps\" group by \"deptno\") using (\"deptno\")"; @@ -2685,7 +2685,7 @@ private void checkSatisfiable(RexNode e, String s) { } } - @Test public void testMaterializationOnJoinQuery() { + @Test void testMaterializationOnJoinQuery() { final String q = "select *\n" + "from \"emps\"\n" + "join \"depts\" using (\"deptno\") where \"empid\" < 300 "; @@ -2702,7 +2702,7 @@ private void checkSatisfiable(RexNode e, String s) { } @Disabled("Creating mv for depts considering all its column throws exception") - @Test public void testMultiMaterializationOnJoinQuery() { + @Test void testMultiMaterializationOnJoinQuery() { final String q = "select *\n" + "from \"emps\"\n" + "join \"depts\" using (\"deptno\") where \"empid\" < 300 " @@ -2721,7 +2721,7 @@ private void checkSatisfiable(RexNode e, String s) { } } - @Test public void testAggregateMaterializationOnCountDistinctQuery1() { + @Test void testAggregateMaterializationOnCountDistinctQuery1() { // The column empid is already unique, thus DISTINCT is not // in the COUNT of the resulting rewriting sql("select \"deptno\", \"empid\", \"salary\"\n" @@ -2738,7 +2738,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationOnCountDistinctQuery2() { + @Test void testAggregateMaterializationOnCountDistinctQuery2() { // The column empid is already unique, thus DISTINCT is not // in the COUNT of the resulting rewriting sql("select \"deptno\", \"salary\", \"empid\"\n" @@ -2755,7 +2755,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationOnCountDistinctQuery3() { + @Test void testAggregateMaterializationOnCountDistinctQuery3() { // The column salary is not unique, thus we end up with // a different rewriting sql("select \"deptno\", \"empid\", \"salary\"\n" @@ -2773,7 +2773,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testAggregateMaterializationOnCountDistinctQuery4() { + @Test void testAggregateMaterializationOnCountDistinctQuery4() { // Although there is no DISTINCT in the COUNT, this is // equivalent to previous query sql("select \"deptno\", \"salary\", \"empid\"\n" @@ -2791,7 +2791,7 @@ private void checkSatisfiable(RexNode e, String s) { .ok(); } - @Test public void testMaterializationSubstitution() { + @Test void testMaterializationSubstitution() { String q = "select *\n" + "from (select * from \"emps\" where \"empid\" < 300)\n" + "join (select * from \"emps\" where \"empid\" < 200) using (\"empid\")"; @@ -2823,7 +2823,7 @@ private void checkSatisfiable(RexNode e, String s) { } } - @Test public void testMaterializationSubstitution2() { + @Test void testMaterializationSubstitution2() { String q = "select *\n" + "from (select * from \"emps\" where \"empid\" < 300)\n" + "join (select * from \"emps\" where \"empid\" < 200) using (\"empid\")"; @@ -2863,7 +2863,7 @@ private void checkSatisfiable(RexNode e, String s) { } } - @Test public void testMaterializationAfterTrimingOfUnusedFields() { + @Test void testMaterializationAfterTrimingOfUnusedFields() { String sql = "select \"y\".\"deptno\", \"y\".\"name\", \"x\".\"sum_salary\"\n" + "from\n" @@ -2876,25 +2876,25 @@ private void checkSatisfiable(RexNode e, String s) { sql(sql, sql).ok(); } - @Test public void testUnionAllToUnionAll() { + @Test void testUnionAllToUnionAll() { String sql0 = "select * from \"emps\" where \"empid\" < 300"; String sql1 = "select * from \"emps\" where \"empid\" > 200"; sql(sql0 + " union all " + sql1, sql1 + " union all " + sql0).ok(); } - @Test public void testUnionDistinctToUnionDistinct() { + @Test void testUnionDistinctToUnionDistinct() { String sql0 = "select * from \"emps\" where \"empid\" < 300"; String sql1 = "select * from \"emps\" where \"empid\" > 200"; sql(sql0 + " union " + sql1, sql1 + " union " + sql0).ok(); } - @Test public void testUnionDistinctToUnionAll() { + @Test void testUnionDistinctToUnionAll() { String sql0 = "select * from \"emps\" where \"empid\" < 300"; String sql1 = "select * from \"emps\" where \"empid\" > 200"; sql(sql0 + " union " + sql1, sql0 + " union all " + sql1).noMat(); } - @Test public void testUnionOnCalcsToUnion() { + @Test void testUnionOnCalcsToUnion() { final String mv = "" + "select \"deptno\", \"salary\"\n" + "from \"emps\"\n" @@ -2914,7 +2914,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(mv, query).ok(); } - @Test public void testIntersectOnCalcsToIntersect() { + @Test void testIntersectOnCalcsToIntersect() { final String mv = "" + "select \"deptno\", \"salary\"\n" + "from \"emps\"\n" @@ -2934,7 +2934,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testIntersectToIntersect0() { + @Test void testIntersectToIntersect0() { final String mv = "" + "select \"deptno\" from \"emps\"\n" + "intersect\n" @@ -2946,7 +2946,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testIntersectToIntersect1() { + @Test void testIntersectToIntersect1() { final String mv = "" + "select \"deptno\" from \"emps\"\n" + "intersect all\n" @@ -2958,7 +2958,7 @@ private void checkSatisfiable(RexNode e, String s) { sql(mv, query).withOnlyBySubstitution(true).ok(); } - @Test public void testIntersectToCalcOnIntersect() { + @Test void testIntersectToCalcOnIntersect() { final String intersect = "" + "select \"deptno\",\"name\" from \"emps\"\n" + "intersect all\n" diff --git a/core/src/test/java/org/apache/calcite/test/ModelTest.java b/core/src/test/java/org/apache/calcite/test/ModelTest.java index 8bcfbd038a3e..4f54da7f88ac 100644 --- a/core/src/test/java/org/apache/calcite/test/ModelTest.java +++ b/core/src/test/java/org/apache/calcite/test/ModelTest.java @@ -46,7 +46,7 @@ /** * Unit test for data models. */ -public class ModelTest { +class ModelTest { private ObjectMapper mapper() { final ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); @@ -55,7 +55,7 @@ private ObjectMapper mapper() { } /** Reads a simple schema from a string into objects. */ - @Test public void testRead() throws IOException { + @Test void testRead() throws IOException { final ObjectMapper mapper = mapper(); JsonRoot root = mapper.readValue( "{\n" @@ -115,7 +115,7 @@ private ObjectMapper mapper() { } /** Reads a simple schema containing JdbcSchema, a sub-type of Schema. */ - @Test public void testSubtype() throws IOException { + @Test void testSubtype() throws IOException { final ObjectMapper mapper = mapper(); JsonRoot root = mapper.readValue( "{\n" @@ -140,7 +140,7 @@ private ObjectMapper mapper() { } /** Reads a custom schema. */ - @Test public void testCustomSchema() throws IOException { + @Test void testCustomSchema() throws IOException { final ObjectMapper mapper = mapper(); JsonRoot root = mapper.readValue("{\n" + " version: '1.0',\n" @@ -183,7 +183,7 @@ private ObjectMapper mapper() { /** Tests that an immutable schema in a model cannot contain a * materialization. */ - @Test public void testModelImmutableSchemaCannotContainMaterialization() + @Test void testModelImmutableSchemaCannotContainMaterialization() throws Exception { CalciteAssert.model("{\n" + " version: '1.0',\n" @@ -222,7 +222,7 @@ private ObjectMapper mapper() { * *

Schema without name should give useful error, not * NullPointerException. */ - @Test public void testSchemaWithoutName() throws Exception { + @Test void testSchemaWithoutName() throws Exception { final String model = "{\n" + " version: '1.0',\n" + " defaultSchema: 'adhoc',\n" @@ -233,7 +233,7 @@ private ObjectMapper mapper() { .connectThrows("Field 'name' is required in JsonMapSchema"); } - @Test public void testCustomSchemaWithoutFactory() throws Exception { + @Test void testCustomSchemaWithoutFactory() throws Exception { final String model = "{\n" + " version: '1.0',\n" + " defaultSchema: 'adhoc',\n" @@ -247,7 +247,7 @@ private ObjectMapper mapper() { } /** Tests a model containing a lattice and some views. */ - @Test public void testReadLattice() throws IOException { + @Test void testReadLattice() throws IOException { final ObjectMapper mapper = mapper(); JsonRoot root = mapper.readValue("{\n" + " version: '1.0',\n" @@ -319,7 +319,7 @@ private ObjectMapper mapper() { } /** Tests a model with bad multi-line SQL. */ - @Test public void testReadBadMultiLineSql() throws IOException { + @Test void testReadBadMultiLineSql() throws IOException { final ObjectMapper mapper = mapper(); JsonRoot root = mapper.readValue("{\n" + " version: '1.0',\n" @@ -350,7 +350,7 @@ private ObjectMapper mapper() { } } - @Test public void testYamlInlineDetection() throws Exception { + @Test void testYamlInlineDetection() throws Exception { // yaml model with different line endings final String yamlModel = "version: 1.0\r\n" + "schemas:\n" @@ -370,7 +370,7 @@ private ObjectMapper mapper() { .connectThrows("Unexpected end-of-input in a comment"); } - @Test public void testYamlFileDetection() throws Exception { + @Test void testYamlFileDetection() throws Exception { final URL inUrl = ModelTest.class.getResource("/empty-model.yaml"); CalciteAssert.that() .withModel(inUrl) diff --git a/core/src/test/java/org/apache/calcite/test/MultiJdbcSchemaJoinTest.java b/core/src/test/java/org/apache/calcite/test/MultiJdbcSchemaJoinTest.java index 8c4b6e9138c3..0731ac441062 100644 --- a/core/src/test/java/org/apache/calcite/test/MultiJdbcSchemaJoinTest.java +++ b/core/src/test/java/org/apache/calcite/test/MultiJdbcSchemaJoinTest.java @@ -50,8 +50,8 @@ import static org.junit.jupiter.api.Assertions.fail; /** Test case for joining tables from two different JDBC databases. */ -public class MultiJdbcSchemaJoinTest { - @Test public void test() throws SQLException, ClassNotFoundException { +class MultiJdbcSchemaJoinTest { + @Test void test() throws SQLException, ClassNotFoundException { // Create two databases // It's two times hsqldb, but imagine they are different rdbms's final String db1 = TempDb.INSTANCE.getUrl(); @@ -92,12 +92,12 @@ public class MultiJdbcSchemaJoinTest { /** Makes sure that {@link #test} is re-entrant. * Effectively a test for {@code TempDb}. */ - @Test public void test2() throws SQLException, ClassNotFoundException { + @Test void test2() throws SQLException, ClassNotFoundException { test(); } /** Tests {@link org.apache.calcite.adapter.jdbc.JdbcCatalogSchema}. */ - @Test public void test3() throws SQLException { + @Test void test3() throws SQLException { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setUrl(TempDb.INSTANCE.getUrl()); dataSource.setUsername(""); @@ -145,7 +145,7 @@ private Connection setup() throws SQLException { return connection; } - @Test public void testJdbcWithEnumerableHashJoin() throws SQLException { + @Test void testJdbcWithEnumerableHashJoin() throws SQLException { // This query works correctly String query = "select t.id, t.field1 " + "from db.table1 t join \"hr\".\"emps\" e on e.\"empid\" = t.id"; @@ -153,7 +153,7 @@ private Connection setup() throws SQLException { assertThat(runQuery(setup(), query), equalTo(expected)); } - @Test public void testEnumerableWithJdbcJoin() throws SQLException { + @Test void testEnumerableWithJdbcJoin() throws SQLException { // * compared to testJdbcWithEnumerableHashJoin, the join order is reversed // * the query fails with a CannotPlanException String query = "select t.id, t.field1 " @@ -162,7 +162,7 @@ private Connection setup() throws SQLException { assertThat(runQuery(setup(), query), equalTo(expected)); } - @Test public void testEnumerableWithJdbcJoinWithWhereClause() + @Test void testEnumerableWithJdbcJoinWithWhereClause() throws SQLException { // Same query as above but with a where condition added: // * the good: this query does not give a CannotPlanException @@ -202,7 +202,7 @@ private Set runQuery(Connection calciteConnection, String query) } } - @Test public void testSchemaConsistency() throws Exception { + @Test void testSchemaConsistency() throws Exception { // Create a database final String db = TempDb.INSTANCE.getUrl(); Connection c1 = DriverManager.getConnection(db, "", ""); diff --git a/core/src/test/java/org/apache/calcite/test/MutableRelTest.java b/core/src/test/java/org/apache/calcite/test/MutableRelTest.java index 58a447adeafa..89b7f323aa2a 100644 --- a/core/src/test/java/org/apache/calcite/test/MutableRelTest.java +++ b/core/src/test/java/org/apache/calcite/test/MutableRelTest.java @@ -52,33 +52,33 @@ /** * Tests for {@link MutableRel} sub-classes. */ -public class MutableRelTest { +class MutableRelTest { - @Test public void testConvertAggregate() { + @Test void testConvertAggregate() { checkConvertMutableRel( "Aggregate", "select empno, sum(sal) from emp group by empno"); } - @Test public void testConvertFilter() { + @Test void testConvertFilter() { checkConvertMutableRel( "Filter", "select * from emp where ename = 'DUMMY'"); } - @Test public void testConvertProject() { + @Test void testConvertProject() { checkConvertMutableRel( "Project", "select ename from emp"); } - @Test public void testConvertSort() { + @Test void testConvertSort() { checkConvertMutableRel( "Sort", "select * from emp order by ename"); } - @Test public void testConvertCalc() { + @Test void testConvertCalc() { checkConvertMutableRel( "Calc", "select * from emp where ename = 'DUMMY'", @@ -86,7 +86,7 @@ public class MutableRelTest { ImmutableList.of(FilterToCalcRule.INSTANCE)); } - @Test public void testConvertWindow() { + @Test void testConvertWindow() { checkConvertMutableRel( "Window", "select sal, avg(sal) over (partition by deptno) from emp", @@ -94,49 +94,49 @@ public class MutableRelTest { ImmutableList.of(ProjectToWindowRule.PROJECT)); } - @Test public void testConvertCollect() { + @Test void testConvertCollect() { checkConvertMutableRel( "Collect", "select multiset(select deptno from dept) from (values(true))"); } - @Test public void testConvertUncollect() { + @Test void testConvertUncollect() { checkConvertMutableRel( "Uncollect", "select * from unnest(multiset[1,2])"); } - @Test public void testConvertTableModify() { + @Test void testConvertTableModify() { checkConvertMutableRel( "TableModify", "insert into dept select empno, ename from emp"); } - @Test public void testConvertSample() { + @Test void testConvertSample() { checkConvertMutableRel( "Sample", "select * from emp tablesample system(50) where empno > 5"); } - @Test public void testConvertTableFunctionScan() { + @Test void testConvertTableFunctionScan() { checkConvertMutableRel( "TableFunctionScan", "select * from table(ramp(3))"); } - @Test public void testConvertValues() { + @Test void testConvertValues() { checkConvertMutableRel( "Values", "select * from (values (1, 2))"); } - @Test public void testConvertJoin() { + @Test void testConvertJoin() { checkConvertMutableRel( "Join", "select * from emp join dept using (deptno)"); } - @Test public void testConvertSemiJoin() { + @Test void testConvertSemiJoin() { final String sql = "select * from dept where exists (\n" + " select * from emp\n" + " where emp.deptno = dept.deptno\n" @@ -152,7 +152,7 @@ public class MutableRelTest { SemiJoinRule.PROJECT)); } - @Test public void testConvertCorrelate() { + @Test void testConvertCorrelate() { final String sql = "select * from dept where exists (\n" + " select * from emp\n" + " where emp.deptno = dept.deptno\n" @@ -160,28 +160,28 @@ public class MutableRelTest { checkConvertMutableRel("Correlate", sql); } - @Test public void testConvertUnion() { + @Test void testConvertUnion() { checkConvertMutableRel( "Union", "select * from emp where deptno = 10" + "union select * from emp where ename like 'John%'"); } - @Test public void testConvertMinus() { + @Test void testConvertMinus() { checkConvertMutableRel( "Minus", "select * from emp where deptno = 10" + "except select * from emp where ename like 'John%'"); } - @Test public void testConvertIntersect() { + @Test void testConvertIntersect() { checkConvertMutableRel( "Intersect", "select * from emp where deptno = 10" + "intersect select * from emp where ename like 'John%'"); } - @Test public void testUpdateInputOfUnion() { + @Test void testUpdateInputOfUnion() { MutableRel mutableRel = createMutableRel( "select sal from emp where deptno = 10" + "union select sal from emp where ename like 'John%'"); @@ -200,7 +200,7 @@ public class MutableRelTest { MatcherAssert.assertThat(actual, Matchers.isLinux(expected)); } - @Test public void testParentInfoOfUnion() { + @Test void testParentInfoOfUnion() { MutableRel mutableRel = createMutableRel( "select sal from emp where deptno = 10" + "union select sal from emp where ename like 'John%'"); @@ -209,7 +209,7 @@ public class MutableRelTest { } } - @Test public void testMutableTableFunctionScanEquals() { + @Test void testMutableTableFunctionScanEquals() { final String sql = "SELECT * FROM TABLE(RAMP(3))"; final MutableRel mutableRel1 = createMutableRel(sql); final MutableRel mutableRel2 = createMutableRel(sql); diff --git a/core/src/test/java/org/apache/calcite/test/PigRelBuilderTest.java b/core/src/test/java/org/apache/calcite/test/PigRelBuilderTest.java index 784c45c13b7f..133512379af5 100644 --- a/core/src/test/java/org/apache/calcite/test/PigRelBuilderTest.java +++ b/core/src/test/java/org/apache/calcite/test/PigRelBuilderTest.java @@ -35,7 +35,7 @@ /** * Unit test for {@link PigRelBuilder}. */ -public class PigRelBuilderTest { +class PigRelBuilderTest { /** Creates a config based on the "scott" schema. */ public static Frameworks.ConfigBuilder config() { return RelBuilderTest.config(); @@ -54,7 +54,7 @@ private String str(RelNode r) { return Util.toLinux(RelOptUtil.toString(r)); } - @Test public void testScan() { + @Test void testScan() { // Equivalent SQL: // SELECT * // FROM emp @@ -66,11 +66,11 @@ private String str(RelNode r) { is("LogicalTableScan(table=[[scott, EMP]])\n")); } - @Test public void testCogroup() {} - @Test public void testCross() {} - @Test public void testCube() {} - @Test public void testDefine() {} - @Test public void testDistinct() { + @Test void testCogroup() {} + @Test void testCross() {} + @Test void testCube() {} + @Test void testDefine() {} + @Test void testDistinct() { // Syntax: // alias = DISTINCT alias [PARTITION BY partitioner] [PARALLEL n]; final PigRelBuilder builder = PigRelBuilder.create(config().build()); @@ -85,7 +85,7 @@ private String str(RelNode r) { assertThat(str(root), is(plan)); } - @Test public void testFilter() { + @Test void testFilter() { // Syntax: // FILTER name BY expr // Example: @@ -100,9 +100,9 @@ private String str(RelNode r) { assertThat(str(root), is(plan)); } - @Test public void testForeach() {} + @Test void testForeach() {} - @Test public void testGroup() { + @Test void testGroup() { // Syntax: // alias = GROUP alias { ALL | BY expression} // [, alias ALL | BY expression ...] [USING 'collected' | 'merge'] @@ -131,7 +131,7 @@ private String str(RelNode r) { is(plan2)); } - @Test public void testGroup2() { + @Test void testGroup2() { // Equivalent to Pig Latin: // r = GROUP e BY deptno, d BY deptno; final PigRelBuilder builder = PigRelBuilder.create(config().build()); @@ -152,12 +152,12 @@ private String str(RelNode r) { assertThat(str(root), is(plan)); } - @Test public void testImport() {} - @Test public void testJoinInner() {} - @Test public void testJoinOuter() {} - @Test public void testLimit() {} + @Test void testImport() {} + @Test void testJoinInner() {} + @Test void testJoinOuter() {} + @Test void testLimit() {} - @Test public void testLoad() { + @Test void testLoad() { // Syntax: // LOAD 'data' [USING function] [AS schema]; // Equivalent to Pig Latin: @@ -170,11 +170,11 @@ private String str(RelNode r) { is("LogicalTableScan(table=[[scott, EMP]])\n")); } - @Test public void testMapReduce() {} - @Test public void testOrderBy() {} - @Test public void testRank() {} - @Test public void testSample() {} - @Test public void testSplit() {} - @Test public void testStore() {} - @Test public void testUnion() {} + @Test void testMapReduce() {} + @Test void testOrderBy() {} + @Test void testRank() {} + @Test void testSample() {} + @Test void testSplit() {} + @Test void testStore() {} + @Test void testUnion() {} } diff --git a/core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java b/core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java index a4a63c5b6a04..cc5578d41dcd 100644 --- a/core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java +++ b/core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java @@ -85,7 +85,7 @@ public class ReflectiveSchemaTest { * * @throws Exception on error */ - @Test public void testQueryProvider() throws Exception { + @Test void testQueryProvider() throws Exception { Connection connection = CalciteAssert .that(CalciteAssert.Config.REGULAR).connect(); QueryProvider queryProvider = connection.unwrap(QueryProvider.class); @@ -135,7 +135,7 @@ public class ReflectiveSchemaTest { assertEquals("SEBASTIAN", list.get(0)[1]); } - @Test public void testQueryProviderSingleColumn() throws Exception { + @Test void testQueryProviderSingleColumn() throws Exception { Connection connection = CalciteAssert .that(CalciteAssert.Config.REGULAR).connect(); QueryProvider queryProvider = connection.unwrap(QueryProvider.class); @@ -165,7 +165,7 @@ public class ReflectiveSchemaTest { * The function returns a {@link org.apache.calcite.linq4j.Queryable}. */ @Disabled - @Test public void testOperator() throws SQLException, ClassNotFoundException { + @Test void testOperator() throws SQLException, ClassNotFoundException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = @@ -189,7 +189,7 @@ public class ReflectiveSchemaTest { /** * Tests a view. */ - @Test public void testView() throws SQLException, ClassNotFoundException { + @Test void testView() throws SQLException, ClassNotFoundException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = @@ -214,7 +214,7 @@ public class ReflectiveSchemaTest { /** * Tests a view with a path. */ - @Test public void testViewPath() throws SQLException, ClassNotFoundException { + @Test void testViewPath() throws SQLException, ClassNotFoundException { Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = @@ -262,7 +262,7 @@ private int count(ResultSet resultSet) throws SQLException { } /** Tests column based on java.sql.Date field. */ - @Test public void testDateColumn() throws Exception { + @Test void testDateColumn() throws Exception { CalciteAssert.that() .withSchema("s", new ReflectiveSchema(new DateColumnSchema())) .query("select * from \"s\".\"emps\"") @@ -272,7 +272,7 @@ private int count(ResultSet resultSet) throws SQLException { } /** Tests querying an object that has no public fields. */ - @Test public void testNoPublicFields() throws Exception { + @Test void testNoPublicFields() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select 1 from \"s\".\"allPrivates\"") @@ -284,7 +284,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Tests columns based on types such as java.sql.Date and java.util.Date. * * @see CatchallSchema#everyTypes */ - @Test public void testColumnTypes() throws Exception { + @Test void testColumnTypes() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"primitiveBoolean\" from \"s\".\"everyTypes\"") @@ -299,7 +299,7 @@ private int count(ResultSet resultSet) throws SQLException { /** * Tests NOT for nullable columns * @see CatchallSchema#everyTypes */ - @Test public void testWhereNOT() throws Exception { + @Test void testWhereNOT() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query( @@ -310,7 +310,7 @@ private int count(ResultSet resultSet) throws SQLException { /** * Tests NOT for nullable columns * @see CatchallSchema#everyTypes */ - @Test public void testSelectNOT() throws Exception { + @Test void testSelectNOT() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query( @@ -323,7 +323,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testSelectWithFieldAccessOnFirstLevelRecordType() { + @Test void testSelectWithFieldAccessOnFirstLevelRecordType() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"birthPlace\".\"city\" as city from \"bookstore\".\"authors\" au\n") @@ -333,7 +333,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testSelectWithFieldAccessOnSecondLevelRecordType() { + @Test void testSelectWithFieldAccessOnSecondLevelRecordType() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"birthPlace\".\"coords\".\"latitude\" as lat\n" @@ -344,7 +344,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testWhereWithFieldAccessOnFirstLevelRecordType() { + @Test void testWhereWithFieldAccessOnFirstLevelRecordType() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"aid\" as aid from \"bookstore\".\"authors\" au\n" @@ -355,7 +355,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testWhereWithFieldAccessOnSecondLevelRecordType() { + @Test void testWhereWithFieldAccessOnSecondLevelRecordType() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"aid\" as aid from \"bookstore\".\"authors\" au\n" @@ -366,7 +366,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testSelectWithFieldAccessOnFirstLevelRecordTypeArray() { + @Test void testSelectWithFieldAccessOnFirstLevelRecordTypeArray() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"books\"[1].\"title\" as title from \"bookstore\".\"authors\" au\n") @@ -376,7 +376,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testSelectWithFieldAccessOnSecondLevelRecordTypeArray() { + @Test void testSelectWithFieldAccessOnSecondLevelRecordTypeArray() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"books\"[1].\"pages\"[1].\"pageNo\" as pno\n" @@ -387,7 +387,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testWhereWithFieldAccessOnFirstLevelRecordTypeArray() { + @Test void testWhereWithFieldAccessOnFirstLevelRecordTypeArray() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"aid\" as aid from \"bookstore\".\"authors\" au\n" @@ -398,7 +398,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Test case for * [CALCITE-2404] * Accessing structured-types is not implemented by the runtime. */ - @Test public void testWhereWithFieldAccessOnSecondLevelRecordTypeArray() { + @Test void testWhereWithFieldAccessOnSecondLevelRecordTypeArray() { CalciteAssert.that() .with(CalciteAssert.SchemaSpec.BOOKSTORE) .query("select au.\"aid\" as aid from \"bookstore\".\"authors\" au\n" @@ -409,7 +409,7 @@ private int count(ResultSet resultSet) throws SQLException { /** Tests columns based on types such as java.sql.Date and java.util.Date. * * @see CatchallSchema#everyTypes */ - @Test public void testAggregateFunctions() throws Exception { + @Test void testAggregateFunctions() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); checkAgg(with, "min"); @@ -474,7 +474,7 @@ private Object get(ResultSet input) throws SQLException { } } - @Test public void testClassNames() throws Exception { + @Test void testClassNames() throws Exception { CalciteAssert.that() .withSchema("s", CATCHALL).query("select * from \"s\".\"everyTypes\"") .returns( @@ -520,7 +520,7 @@ private void check(ResultSetMetaData metaData, String columnName, fail("column not found: " + columnName); } - @Test public void testJavaBoolean() throws Exception { + @Test void testJavaBoolean() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select count(*) as c from \"s\".\"everyTypes\"\n" @@ -556,7 +556,7 @@ private void check(ResultSetMetaData metaData, String columnName, * [CALCITE-119] * Comparing a Java type long with a SQL type INTEGER gives wrong * answer. */ - @Test public void testCompareJavaAndSqlTypes() throws Exception { + @Test void testCompareJavaAndSqlTypes() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); // With CALCITE-119, returned 0 rows. The problem was that when comparing @@ -579,7 +579,7 @@ private void check(ResultSetMetaData metaData, String columnName, .returns("P=2; W=1; SP=2; SW=1; IP=2; IW=1; LP=2; LW=1\n"); } - @Test public void testDivideWraperPrimitive() throws Exception { + @Test void testDivideWraperPrimitive() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"wrapperLong\" / \"primitiveLong\" as c\n" @@ -592,7 +592,7 @@ private void check(ResultSetMetaData metaData, String columnName, .returns("C=null\n"); } - @Test public void testDivideDoubleBigDecimal() { + @Test void testDivideDoubleBigDecimal() { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"wrapperDouble\" / \"bigDecimal\" as c\n" @@ -600,7 +600,7 @@ private void check(ResultSetMetaData metaData, String columnName, .runs(); } - @Test public void testDivideWraperWrapper() throws Exception { + @Test void testDivideWraperWrapper() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"wrapperLong\" / \"wrapperLong\" as c\n" @@ -613,7 +613,7 @@ private void check(ResultSetMetaData metaData, String columnName, .returns("C=null\n"); } - @Test public void testDivideWraperWrapperMultipleTimes() throws Exception { + @Test void testDivideWraperWrapperMultipleTimes() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); with.query("select \"wrapperLong\" / \"wrapperLong\"\n" @@ -628,7 +628,7 @@ private void check(ResultSetMetaData metaData, String columnName, .returns("C=null\n"); } - @Test public void testOp() throws Exception { + @Test void testOp() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that() .withSchema("s", CATCHALL); @@ -652,7 +652,7 @@ private void checkOp(CalciteAssert.AssertThat with, String fn) { } } - @Test public void testCastFromString() { + @Test void testCastFromString() { CalciteAssert.that().withSchema("s", CATCHALL) .query("select cast(\"string\" as int) as c from \"s\".\"everyTypes\"") .returns("C=1\n" @@ -662,7 +662,7 @@ private void checkOp(CalciteAssert.AssertThat with, String fn) { /** Test case for * [CALCITE-580] * Average aggregation on an Integer column throws ClassCastException. */ - @Test public void testAvgInt() throws Exception { + @Test void testAvgInt() throws Exception { CalciteAssert.that().withSchema("s", CATCHALL).with(Lex.JAVA) .query("select primitiveLong, avg(primitiveInt)\n" + "from s.everyTypes\n" @@ -695,7 +695,7 @@ private static boolean isNumeric(Class type) { * case a {@link BitSet}) then it is treated as an object. * * @see CatchallSchema#badTypes */ - @Test public void testTableFieldHasBadType() throws Exception { + @Test void testTableFieldHasBadType() throws Exception { CalciteAssert.that() .withSchema("s", CATCHALL) .query("select * from \"s\".\"badTypes\"") @@ -707,7 +707,7 @@ private static boolean isNumeric(Class type) { * * @see CatchallSchema#enumerable * @see CatchallSchema#list */ - @Test public void testSchemaFieldHasBadType() throws Exception { + @Test void testSchemaFieldHasBadType() throws Exception { final CalciteAssert.AssertThat with = CalciteAssert.that().withSchema("s", CATCHALL); // BitSet is not a valid relation type. It's as if "bitSet" field does @@ -730,7 +730,7 @@ private static boolean isNumeric(Class type) { /** Test case for a bug where a Java string 'Abc' compared to a char 'Ab' * would be truncated to the char precision and falsely match. */ - @Test public void testPrefix() throws Exception { + @Test void testPrefix() throws Exception { CalciteAssert.that() .withSchema("s", CATCHALL) .query( @@ -743,7 +743,7 @@ private static boolean isNumeric(Class type) { * {@link ViewTable}.{@code ViewTableMacro}, then it * should be expanded. */ @Disabled - @Test public void testTableMacroIsView() throws Exception { + @Test void testTableMacroIsView() throws Exception { CalciteAssert.that() .withSchema("s", new ReflectiveSchema(new JdbcTest.HrSchema())) .query("select * from table(\"s\".\"view\"('abc'))") @@ -754,7 +754,7 @@ private static boolean isNumeric(Class type) { /** Finds a table-macro using reflection. */ @Disabled - @Test public void testTableMacro() throws Exception { + @Test void testTableMacro() throws Exception { CalciteAssert.that() .withSchema("s", new ReflectiveSchema(new JdbcTest.HrSchema())) .query("select * from table(\"s\".\"foo\"(3))") @@ -766,7 +766,7 @@ private static boolean isNumeric(Class type) { /** Table with single field as Integer[] */ @Disabled( "java.lang.AssertionError RelDataTypeImpl.getFieldList(RelDataTypeImpl.java:99)") - @Test public void testArrayOfBoxedPrimitives() { + @Test void testArrayOfBoxedPrimitives() { CalciteAssert.that() .withSchema("s", CATCHALL) .query("select * from \"s\".\"primesBoxed\"") @@ -776,21 +776,21 @@ private static boolean isNumeric(Class type) { /** Table with single field as int[] */ @Disabled( "java.lang.AssertionError RelDataTypeImpl.getFieldList(RelDataTypeImpl.java:99)") - @Test public void testArrayOfPrimitives() { + @Test void testArrayOfPrimitives() { CalciteAssert.that() .withSchema("s", CATCHALL) .query("select * from \"s\".\"primes\"") .returnsUnordered("value=1", "value=3", "value=7"); } - @Test public void testCustomBoxedScalar() { + @Test void testCustomBoxedScalar() { CalciteAssert.that() .withSchema("s", CATCHALL) .query("select \"value\" from \"s\".\"primesCustomBoxed\"") .returnsUnordered("value=1", "value=3", "value=5"); } - @Test public void testCustomBoxedSalarCalc() { + @Test void testCustomBoxedSalarCalc() { CalciteAssert.that() .withSchema("s", CATCHALL) .query("select \"value\"*2 \"value\" from \"s\".\"primesCustomBoxed\"") @@ -801,7 +801,7 @@ private static boolean isNumeric(Class type) { * [CALCITE-1569] * Date condition can generates Integer == Integer, which is always * false. */ - @Test public void testDateCanCompare() { + @Test void testDateCanCompare() { final String sql = "select a.v\n" + "from (select \"sqlDate\" v\n" + " from \"s\".\"everyTypes\" " @@ -820,7 +820,7 @@ private static boolean isNumeric(Class type) { /** Test case for * [CALCITE-3512] * Query fails when comparing Time/TimeStamp types. */ - @Test public void testTimeCanCompare() { + @Test void testTimeCanCompare() { final String sql = "select a.v\n" + "from (select \"sqlTime\" v\n" + " from \"s\".\"everyTypes\" " @@ -836,7 +836,7 @@ private static boolean isNumeric(Class type) { .returnsUnordered("V=00:00:00"); } - @Test public void testTimestampCanCompare() { + @Test void testTimestampCanCompare() { final String sql = "select a.v\n" + "from (select \"sqlTimestamp\" v\n" + " from \"s\".\"everyTypes\" " @@ -855,7 +855,7 @@ private static boolean isNumeric(Class type) { /** Test case for * [CALCITE-1919] * NPE when target in ReflectiveSchema belongs to the unnamed package. */ - @Test public void testReflectiveSchemaInUnnamedPackage() throws Exception { + @Test void testReflectiveSchemaInUnnamedPackage() throws Exception { final Driver driver = new Driver(); try (CalciteConnection connection = (CalciteConnection) driver.connect("jdbc:calcite:", new Properties())) { @@ -1065,7 +1065,7 @@ public static class DateColumnSchema { } /** CALCITE-2611 unknown on one side of an or may lead to uncompilable code */ - @Test public void testUnknownInOr() { + @Test void testUnknownInOr() { CalciteAssert.that() .withSchema("s", CATCHALL) .query("select (\"value\" = 3 and unknown) or ( \"value\" = 3 ) " diff --git a/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java b/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java index e9cbe2e305dc..cbdaecb405cb 100644 --- a/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java +++ b/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java @@ -180,7 +180,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { return RelBuilder.create(configBuilder.build()); } - @Test public void testScan() { + @Test void testScan() { // Equivalent SQL: // SELECT * // FROM emp @@ -192,7 +192,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { hasTree("LogicalTableScan(table=[[scott, EMP]])\n")); } - @Test public void testScanQualifiedTable() { + @Test void testScanQualifiedTable() { // Equivalent SQL: // SELECT * // FROM "scott"."emp" @@ -204,7 +204,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { hasTree("LogicalTableScan(table=[[scott, EMP]])\n")); } - @Test public void testScanInvalidTable() { + @Test void testScanInvalidTable() { // Equivalent SQL: // SELECT * // FROM zzz @@ -219,7 +219,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { } } - @Test public void testScanInvalidSchema() { + @Test void testScanInvalidSchema() { // Equivalent SQL: // SELECT * // FROM "zzz"."emp" @@ -234,7 +234,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { } } - @Test public void testScanInvalidQualifiedTable() { + @Test void testScanInvalidQualifiedTable() { // Equivalent SQL: // SELECT * // FROM "scott"."zzz" @@ -249,7 +249,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { } } - @Test public void testScanValidTableWrongCase() { + @Test void testScanValidTableWrongCase() { // Equivalent SQL: // SELECT * // FROM "emp" @@ -264,7 +264,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { } } - @Test public void testScanFilterTrue() { + @Test void testScanFilterTrue() { // Equivalent SQL: // SELECT * // FROM emp @@ -278,7 +278,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { hasTree("LogicalTableScan(table=[[scott, EMP]])\n")); } - @Test public void testScanFilterTriviallyFalse() { + @Test void testScanFilterTriviallyFalse() { // Equivalent SQL: // SELECT * // FROM emp @@ -292,7 +292,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { hasTree("LogicalValues(tuples=[[]])\n")); } - @Test public void testScanFilterEquals() { + @Test void testScanFilterEquals() { // Equivalent SQL: // SELECT * // FROM emp @@ -308,7 +308,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { assertThat(root, hasTree(expected)); } - @Test public void testSnapshotTemporalTable() { + @Test void testSnapshotTemporalTable() { // Equivalent SQL: // SELECT * // FROM products_temporal FOR SYSTEM_TIME AS OF TIMESTAMP '2011-07-20 12:34:56' @@ -324,7 +324,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { assertThat(root, hasTree(expected)); } - @Test public void testTableFunctionScan() { + @Test void testTableFunctionScan() { // Equivalent SQL: // SELECT * // FROM TABLE( @@ -354,7 +354,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { } } - @Test public void testTableFunctionScanZeroInputs() { + @Test void testTableFunctionScanZeroInputs() { // Equivalent SQL: // SELECT * // FROM TABLE(RAMP(3)) @@ -375,7 +375,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { } } - @Test public void testJoinTemporalTable() { + @Test void testJoinTemporalTable() { // Equivalent SQL: // SELECT * // FROM orders @@ -402,7 +402,7 @@ static RelBuilder createBuilder(UnaryOperator transform) { /** Tests that {@link RelBuilder#project} simplifies expressions if and only if * {@link RelBuilder.Config#simplify}. */ - @Test public void testSimplify() { + @Test void testSimplify() { checkSimplify(c -> c.withSimplify(true), hasTree("LogicalProject($f0=[true])\n" + " LogicalTableScan(table=[[scott, EMP]])\n")); @@ -424,7 +424,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, matcher); } - @Test public void testScanFilterOr() { + @Test void testScanFilterOr() { // Equivalent SQL: // SELECT * // FROM emp @@ -446,7 +446,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, hasTree(expected)); } - @Test public void testScanFilterOr2() { + @Test void testScanFilterOr2() { // Equivalent SQL: // SELECT * // FROM emp @@ -472,7 +472,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, hasTree(expected)); } - @Test public void testScanFilterAndFalse() { + @Test void testScanFilterAndFalse() { // Equivalent SQL: // SELECT * // FROM emp @@ -492,7 +492,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, hasTree(expected)); } - @Test public void testScanFilterAndTrue() { + @Test void testScanFilterAndTrue() { // Equivalent SQL: // SELECT * // FROM emp @@ -515,7 +515,7 @@ private void checkSimplify(UnaryOperator transform, * [CALCITE-2730] * RelBuilder incorrectly simplifies a filter with duplicate conjunction to * empty. */ - @Test public void testScanFilterDuplicateAnd() { + @Test void testScanFilterDuplicateAnd() { // Equivalent SQL: // SELECT * // FROM emp @@ -547,7 +547,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root2, hasTree(expected2)); } - @Test public void testBadFieldName() { + @Test void testBadFieldName() { final RelBuilder builder = RelBuilder.create(config().build()); try { RexInputRef ref = builder.scan("EMP").field("deptno"); @@ -559,7 +559,7 @@ private void checkSimplify(UnaryOperator transform, } } - @Test public void testBadFieldOrdinal() { + @Test void testBadFieldOrdinal() { final RelBuilder builder = RelBuilder.create(config().build()); try { RexInputRef ref = builder.scan("DEPT").field(20); @@ -571,7 +571,7 @@ private void checkSimplify(UnaryOperator transform, } } - @Test public void testBadType() { + @Test void testBadType() { final RelBuilder builder = RelBuilder.create(config().build()); try { builder.scan("EMP"); @@ -586,7 +586,7 @@ private void checkSimplify(UnaryOperator transform, } } - @Test public void testProject() { + @Test void testProject() { // Equivalent SQL: // SELECT deptno, CAST(comm AS SMALLINT) AS comm, 20 AS $f2, // comm AS comm3, comm AS c @@ -609,7 +609,7 @@ private void checkSimplify(UnaryOperator transform, } /** Tests each method that creates a scalar expression. */ - @Test public void testProject2() { + @Test void testProject2() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -642,7 +642,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, hasTree(expected)); } - @Test public void testProjectIdentity() { + @Test void testProjectIdentity() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("DEPT") @@ -656,7 +656,7 @@ private void checkSimplify(UnaryOperator transform, * [CALCITE-1297] * RelBuilder does not translate identity projects even if they rename * fields. */ - @Test public void testProjectIdentityWithFieldsRename() { + @Test void testProjectIdentityWithFieldsRename() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("DEPT") @@ -674,7 +674,7 @@ private void checkSimplify(UnaryOperator transform, /** Variation on {@link #testProjectIdentityWithFieldsRename}: don't use a * table alias, and make sure the field names propagate through a filter. */ - @Test public void testProjectIdentityWithFieldsRenameFilter() { + @Test void testProjectIdentityWithFieldsRenameFilter() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("DEPT") @@ -699,7 +699,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, hasTree(expected)); } - @Test public void testProjectLeadingEdge() { + @Test void testProjectLeadingEdge() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -710,7 +710,7 @@ private void checkSimplify(UnaryOperator transform, assertThat(root, hasTree(expected)); } - @Test public void testProjectWithAliasFromScan() { + @Test void testProjectWithAliasFromScan() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -725,7 +725,7 @@ private void checkSimplify(UnaryOperator transform, /** Test case for * [CALCITE-3228] * IllegalArgumentException in getMapping() for project containing same reference. */ - @Test public void testProjectMapping() { + @Test void testProjectMapping() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -750,7 +750,7 @@ private void project1(int value, SqlTypeName sqlTypeName, String message, String assertThat(message, actual, hasTree(expected)); } - @Test public void testProject1asInt() { + @Test void testProject1asInt() { project1(1, SqlTypeName.INTEGER, "project(1 as INT) might omit type of 1 in the output plan as" + " it is convention to omit INTEGER for integer literals", @@ -758,14 +758,14 @@ private void project1(int value, SqlTypeName sqlTypeName, String message, String + " LogicalValues(tuples=[[]])\n"); } - @Test public void testProject1asBigInt() { + @Test void testProject1asBigInt() { project1(1, SqlTypeName.BIGINT, "project(1 as BIGINT) should contain" + " type of 1 in the output plan since the convention is to omit type of INTEGER", "LogicalProject($f0=[1:BIGINT])\n" + " LogicalValues(tuples=[[]])\n"); } - @Test public void testProjectBloat() { + @Test void testProjectBloat() { final Function f = b -> b.scan("EMP") .project( @@ -801,7 +801,7 @@ private void project1(int value, SqlTypeName sqlTypeName, String message, String hasTree(expected)); } - @Test public void testProjectBloat2() { + @Test void testProjectBloat2() { final Function f = b -> b.scan("EMP") .project( @@ -847,7 +847,7 @@ private RexNode caseCall(RelBuilder b, RexNode ref, RexNode... nodes) { /** Creates a {@link Project} that contains a windowed aggregate function. As * {@link RelBuilder} not explicitly support for {@link RexOver} the syntax is * a bit cumbersome. */ - @Test public void testProjectOver() { + @Test void testProjectOver() { final Function f = b -> b.scan("EMP") .project(b.field("DEPTNO"), over(b, @@ -864,7 +864,7 @@ private RexNode caseCall(RelBuilder b, RexNode ref, RexNode... nodes) { /** Tests that RelBuilder does not merge a Project that contains a windowed * aggregate function into a lower Project. */ - @Test public void testProjectOverOver() { + @Test void testProjectOverOver() { final Function f = b -> b.scan("EMP") .project(b.field("DEPTNO"), over(b, @@ -899,7 +899,7 @@ private RexNode over(RelBuilder b, false, false), alias); } - @Test public void testRename() { + @Test void testRename() { final RelBuilder builder = RelBuilder.create(config().build()); // No rename necessary (null name is ignored) @@ -957,7 +957,7 @@ private RexNode over(RelBuilder b, } } - @Test public void testRenameValues() { + @Test void testRenameValues() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.values(new String[]{"a", "b"}, true, 1, false, -50) @@ -975,7 +975,7 @@ private RexNode over(RelBuilder b, assertThat(root.getRowType().getFieldNames().toString(), is("[x, y z]")); } - @Test public void testPermute() { + @Test void testPermute() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -986,7 +986,7 @@ private RexNode over(RelBuilder b, assertThat(root, hasTree(expected)); } - @Test public void testConvert() { + @Test void testConvert() { final RelBuilder builder = RelBuilder.create(config().build()); RelDataType rowType = builder.getTypeFactory().builder() @@ -1004,7 +1004,7 @@ private RexNode over(RelBuilder b, assertThat(root, hasTree(expected)); } - @Test public void testConvertRename() { + @Test void testConvertRename() { final RelBuilder builder = RelBuilder.create(config().build()); RelDataType rowType = builder.getTypeFactory().builder() @@ -1022,7 +1022,7 @@ private RexNode over(RelBuilder b, assertThat(root, hasTree(expected)); } - @Test public void testAggregate() { + @Test void testAggregate() { // Equivalent SQL: // SELECT COUNT(DISTINCT deptno) AS c // FROM emp @@ -1039,7 +1039,7 @@ private RexNode over(RelBuilder b, assertThat(root, hasTree(expected)); } - @Test public void testAggregate2() { + @Test void testAggregate2() { // Equivalent SQL: // SELECT COUNT(*) AS c, SUM(mgr + 1) AS s // FROM emp @@ -1078,7 +1078,7 @@ private RexNode over(RelBuilder b, * [CALCITE-2192] * RelBuilder wrongly skips creation of Aggregate that prunes columns if input * is unique. */ - @Test public void testAggregate3() { + @Test void testAggregate3() { // Equivalent SQL: // SELECT DISTINCT deptno FROM ( // SELECT deptno, COUNT(*) @@ -1099,7 +1099,7 @@ private RexNode over(RelBuilder b, } /** As {@link #testAggregate3()} but with Filter. */ - @Test public void testAggregate4() { + @Test void testAggregate4() { // Equivalent SQL: // SELECT DISTINCT deptno FROM ( // SELECT deptno, COUNT(*) @@ -1130,7 +1130,7 @@ private RexNode over(RelBuilder b, * [CALCITE-2946] * RelBuilder wrongly skips creation of Aggregate that prunes columns if input * produces one row at most. */ - @Test public void testAggregate5() { + @Test void testAggregate5() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -1148,7 +1148,7 @@ private RexNode over(RelBuilder b, /** Test case for * [CALCITE-3839] * After calling RelBuilder.aggregate, cannot lookup field by name. */ - @Test public void testAggregateAndThenProjectNamedField() { + @Test void testAggregateAndThenProjectNamedField() { final Function f = builder -> builder.scan("EMP") .project(builder.field("EMPNO"), builder.field("ENAME"), @@ -1169,7 +1169,7 @@ private RexNode over(RelBuilder b, /** Tests that {@link RelBuilder#aggregate} eliminates duplicate aggregate * calls and creates a {@code Project} to compensate. */ - @Test public void testAggregateEliminatesDuplicateCalls() { + @Test void testAggregateEliminatesDuplicateCalls() { final String expected = "" + "LogicalProject(S1=[$0], C=[$1], S2=[$2], S1b=[$0])\n" + " LogicalAggregate(group=[{}], S1=[SUM($1)], C=[COUNT()], S2=[SUM($2)])\n" @@ -1189,7 +1189,7 @@ private RexNode over(RelBuilder b, /** As {@link #testAggregateEliminatesDuplicateCalls()} but with a * single-column GROUP BY clause. */ - @Test public void testAggregateEliminatesDuplicateCalls2() { + @Test void testAggregateEliminatesDuplicateCalls2() { RelNode root = buildRelWithDuplicateAggregates(c -> c, 0); final String expected = "" + "LogicalProject(EMPNO=[$0], S1=[$1], C=[$2], S2=[$3], S1b=[$1])\n" @@ -1200,7 +1200,7 @@ private RexNode over(RelBuilder b, /** As {@link #testAggregateEliminatesDuplicateCalls()} but with a * multi-column GROUP BY clause. */ - @Test public void testAggregateEliminatesDuplicateCalls3() { + @Test void testAggregateEliminatesDuplicateCalls3() { RelNode root = buildRelWithDuplicateAggregates(c -> c, 2, 0, 4, 3); final String expected = "" + "LogicalProject(EMPNO=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], S1=[$4], C=[$5], S2=[$6], S1b=[$4])\n" @@ -1228,7 +1228,7 @@ private RelNode buildRelWithDuplicateAggregates( *

Note that "M2" and "MD2" are based on the same field, because * "MIN(DISTINCT $2)" is identical to "MIN($2)". The same is not true for * "SUM". */ - @Test public void testAggregateEliminatesDuplicateDistinctCalls() { + @Test void testAggregateEliminatesDuplicateDistinctCalls() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") .aggregate(builder.groupKey(2), @@ -1249,7 +1249,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAggregateFilter() { + @Test void testAggregateFilter() { // Equivalent SQL: // SELECT deptno, COUNT(*) FILTER (WHERE empno > 100) AS c // FROM emp @@ -1283,7 +1283,7 @@ private RelNode buildRelWithDuplicateAggregates( hasTree(expected2)); } - @Test public void testAggregateFilterFails() { + @Test void testAggregateFilterFails() { // Equivalent SQL: // SELECT deptno, SUM(sal) FILTER (WHERE comm) AS c // FROM emp @@ -1305,7 +1305,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testAggregateFilterNullable() { + @Test void testAggregateFilterNullable() { // Equivalent SQL: // SELECT deptno, SUM(sal) FILTER (WHERE comm < 100) AS c // FROM emp @@ -1341,7 +1341,7 @@ private RelNode buildRelWithDuplicateAggregates( * *

Now, the alias does not cause a new expression to be added to the input, * but causes the referenced fields to be renamed. */ - @Test public void testAggregateProjectWithAliases() { + @Test void testAggregateProjectWithAliases() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -1357,7 +1357,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAggregateProjectWithExpression() { + @Test void testAggregateProjectWithExpression() { final Function f = builder -> builder.scan("EMP") .project(builder.field("DEPTNO")) @@ -1387,7 +1387,7 @@ private RelNode buildRelWithDuplicateAggregates( * away expressions that are not used. * * @see RelBuilder.Config#pruneInputOfAggregate */ - @Test public void testAggregateProjectPrune() { + @Test void testAggregateProjectPrune() { // SELECT deptno, SUM(sal) FILTER (WHERE b) // FROM ( // SELECT deptno, empno + 10, sal, job = 'CLERK' AS b @@ -1434,7 +1434,7 @@ private RelNode buildRelWithDuplicateAggregates( * we remove the project (rather than projecting zero fields, which * would be wrong), and (b) if the same aggregate function is used * twice, we add a project on top. */ - @Test public void testAggregateProjectPruneEmpty() { + @Test void testAggregateProjectPruneEmpty() { // SELECT COUNT(*) AS C, COUNT(*) AS C2 FROM ( // SELECT deptno, empno + 10, sal, job = 'CLERK' AS b // FROM emp) @@ -1470,7 +1470,7 @@ private RelNode buildRelWithDuplicateAggregates( hasTree(expected2)); } - @Test public void testAggregateGroupingKeyOutOfRangeFails() { + @Test void testAggregateGroupingKeyOutOfRangeFails() { final RelBuilder builder = RelBuilder.create(config().build()); try { RelNode root = @@ -1483,7 +1483,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testAggregateGroupingSetNotSubsetFails() { + @Test void testAggregateGroupingSetNotSubsetFails() { final RelBuilder builder = RelBuilder.create(config().build()); try { RelNode root = @@ -1501,7 +1501,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testAggregateGroupingSetDuplicateIgnored() { + @Test void testAggregateGroupingSetDuplicateIgnored() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -1518,7 +1518,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAggregateGrouping() { + @Test void testAggregateGrouping() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -1532,7 +1532,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAggregateGroupingWithDistinctFails() { + @Test void testAggregateGroupingWithDistinctFails() { final RelBuilder builder = RelBuilder.create(config().build()); try { RelNode root = @@ -1549,7 +1549,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testAggregateGroupingWithFilterFails() { + @Test void testAggregateGroupingWithFilterFails() { final RelBuilder builder = RelBuilder.create(config().build()); try { RelNode root = @@ -1566,7 +1566,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testDistinct() { + @Test void testDistinct() { // Equivalent SQL: // SELECT DISTINCT deptno // FROM emp @@ -1582,7 +1582,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testDistinctAlready() { + @Test void testDistinctAlready() { // DEPT is already distinct final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = @@ -1593,7 +1593,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testDistinctEmpty() { + @Test void testDistinctEmpty() { // Is a relation with zero columns distinct? // What about if we know there are zero rows? // It is a matter of definition: there are no duplicate rows, @@ -1623,7 +1623,7 @@ private RelNode buildRelWithDuplicateAggregates( hasTree(expected2)); } - @Test public void testUnion() { + @Test void testUnion() { // Equivalent SQL: // SELECT deptno FROM emp // UNION ALL @@ -1653,7 +1653,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-1522] * Fix error message for SetOp with incompatible args. */ - @Test public void testBadUnionArgsErrorMessage() { + @Test void testBadUnionArgsErrorMessage() { // Equivalent SQL: // SELECT EMPNO, SAL FROM emp // UNION ALL @@ -1676,7 +1676,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testUnion3() { + @Test void testUnion3() { // Equivalent SQL: // SELECT deptno FROM dept // UNION ALL @@ -1704,7 +1704,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testUnion1() { + @Test void testUnion1() { // Equivalent SQL: // SELECT deptno FROM dept // UNION ALL @@ -1726,7 +1726,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testRepeatUnion1() { + @Test void testRepeatUnion1() { // Generates the sequence 1,2,3,...10 using a repeat union. Equivalent SQL: // WITH RECURSIVE delta(n) AS ( // VALUES (1) @@ -1759,7 +1759,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testRepeatUnion2() { + @Test void testRepeatUnion2() { // Generates the factorial function from 0 to 7. Equivalent SQL: // WITH RECURSIVE delta (n, fact) AS ( // VALUES (0, 1) @@ -1799,7 +1799,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testIntersect() { + @Test void testIntersect() { // Equivalent SQL: // SELECT empno FROM emp // WHERE deptno = 20 @@ -1827,7 +1827,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testIntersect3() { + @Test void testIntersect3() { // Equivalent SQL: // SELECT deptno FROM dept // INTERSECT ALL @@ -1855,7 +1855,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testExcept() { + @Test void testExcept() { // Equivalent SQL: // SELECT empno FROM emp // WHERE deptno = 20 @@ -1883,7 +1883,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testJoin() { + @Test void testJoin() { // Equivalent SQL: // SELECT * // FROM (SELECT * FROM emp WHERE comm IS NULL) @@ -1909,7 +1909,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** Same as {@link #testJoin} using USING. */ - @Test public void testJoinUsing() { + @Test void testJoinUsing() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root2 = builder.scan("EMP") @@ -1927,7 +1927,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root2, hasTree(expected)); } - @Test public void testJoin2() { + @Test void testJoin2() { // Equivalent SQL: // SELECT * // FROM emp @@ -1956,7 +1956,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testJoinCartesian() { + @Test void testJoinCartesian() { // Equivalent SQL: // SELECT * emp CROSS JOIN dept final RelBuilder builder = RelBuilder.create(config().build()); @@ -1972,7 +1972,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testCorrelationFails() { + @Test void testCorrelationFails() { final RelBuilder builder = RelBuilder.create(config().build()); final Holder v = Holder.of(null); try { @@ -1989,7 +1989,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testCorrelationWithCondition() { + @Test void testCorrelationWithCondition() { final RelBuilder builder = RelBuilder.create(config().build()); final Holder v = Holder.of(null); RelNode root = builder.scan("EMP") @@ -2014,7 +2014,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAntiJoin() { + @Test void testAntiJoin() { // Equivalent SQL: // SELECT * FROM dept d // WHERE NOT EXISTS (SELECT 1 FROM emp e WHERE e.deptno = d.deptno) @@ -2034,7 +2034,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAlias() { + @Test void testAlias() { // Equivalent SQL: // SELECT * // FROM emp AS e, dept @@ -2062,7 +2062,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(field.getType().isNullable(), is(true)); } - @Test public void testAlias2() { + @Test void testAlias2() { // Equivalent SQL: // SELECT * // FROM emp AS e, emp as m, dept @@ -2093,7 +2093,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAliasSort() { + @Test void testAliasSort() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2108,7 +2108,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAliasLimit() { + @Test void testAliasLimit() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2127,7 +2127,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-1551] * RelBuilder's project() doesn't preserve alias. */ - @Test public void testAliasProject() { + @Test void testAliasProject() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2144,7 +2144,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Tests that table aliases are propagated even when there is a project on * top of a project. (Aliases tend to get lost when projects are merged). */ - @Test public void testAliasProjectProject() { + @Test void testAliasProjectProject() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2166,7 +2166,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Tests that table aliases are propagated and are available to a filter, * even when there is a project on top of a project. (Aliases tend to get lost * when projects are merged). */ - @Test public void testAliasFilter() { + @Test void testAliasFilter() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2190,7 +2190,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Tests that the {@link RelBuilder#alias(RexNode, String)} function is * idempotent. */ - @Test public void testScanAlias() { + @Test void testScanAlias() { final RelBuilder builder = RelBuilder.create(config().build()); builder.scan("EMP"); @@ -2226,7 +2226,7 @@ private RelNode buildRelWithDuplicateAggregates( /** * Tests that project field name aliases are suggested incrementally. */ - @Test public void testAliasSuggester() { + @Test void testAliasSuggester() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") .project(builder.field(0), @@ -2250,7 +2250,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testAliasAggregate() { + @Test void testAliasAggregate() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2271,7 +2271,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** Tests that a projection retains field names after a join. */ - @Test public void testProjectJoin() { + @Test void testProjectJoin() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2296,7 +2296,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** Tests that a projection after a projection. */ - @Test public void testProjectProject() { + @Test void testProjectProject() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2319,7 +2319,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3462] * Add projectExcept method in RelBuilder for projecting out expressions. */ - @Test public void testProjectExceptWithOrdinal() { + @Test void testProjectExceptWithOrdinal() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2336,7 +2336,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3462] * Add projectExcept method in RelBuilder for projecting out expressions. */ - @Test public void testProjectExceptWithName() { + @Test void testProjectExceptWithName() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2353,7 +2353,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3462] * Add projectExcept method in RelBuilder for projecting out expressions. */ - @Test public void testProjectExceptWithExplicitAliasAndName() { + @Test void testProjectExceptWithExplicitAliasAndName() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2371,7 +2371,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3462] * Add projectExcept method in RelBuilder for projecting out expressions. */ - @Test public void testProjectExceptWithImplicitAliasAndName() { + @Test void testProjectExceptWithImplicitAliasAndName() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2388,7 +2388,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3462] * Add projectExcept method in RelBuilder for projecting out expressions. */ - @Test public void testProjectExceptWithDuplicateField() { + @Test void testProjectExceptWithDuplicateField() { final RelBuilder builder = RelBuilder.create(config().build()); IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> { builder.scan("EMP") @@ -2402,7 +2402,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3462] * Add projectExcept method in RelBuilder for projecting out expressions. */ - @Test public void testProjectExceptWithMissingField() { + @Test void testProjectExceptWithMissingField() { final RelBuilder builder = RelBuilder.create(config().build()); builder.scan("EMP"); RexNode deptnoField = builder.field("DEPTNO"); @@ -2415,7 +2415,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(ex.getMessage(), allOf(containsString("Expression"), containsString("not found"))); } - @Test public void testMultiLevelAlias() { + @Test void testMultiLevelAlias() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2449,7 +2449,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testUnionAlias() { + @Test void testUnionAlias() { final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.scan("EMP") @@ -2482,7 +2482,7 @@ private RelNode buildRelWithDuplicateAggregates( * Add RelBuilder field() method to reference aliased relations not on top of * stack, accessing tables aliased that are not accessible in the top * RelNode. */ - @Test public void testAliasPastTop() { + @Test void testAliasPastTop() { // Equivalent SQL: // SELECT * // FROM emp @@ -2509,7 +2509,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** As {@link #testAliasPastTop()}. */ - @Test public void testAliasPastTop2() { + @Test void testAliasPastTop2() { // Equivalent SQL: // SELECT t1.EMPNO, t2.EMPNO, t3.DEPTNO // FROM emp t1 @@ -2544,7 +2544,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testEmpty() { + @Test void testEmpty() { // Equivalent SQL: // SELECT deptno, true FROM dept LIMIT 0 // optimized to @@ -2566,7 +2566,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-3172] * RelBuilder#empty does not keep aliases. */ - @Test public void testEmptyWithAlias() { + @Test void testEmptyWithAlias() { final RelBuilder builder = RelBuilder.create(config().build()); final String expected = "LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalValues(tuples=[[]])\n"; @@ -2607,7 +2607,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root.getRowType().getFullTypeString(), is(expectedType)); } - @Test public void testValues() { + @Test void testValues() { // Equivalent SQL: // VALUES (true, 1), (false, -50) AS t(a, b) final RelBuilder builder = RelBuilder.create(config().build()); @@ -2623,7 +2623,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** Tests creating Values with some field names and some values null. */ - @Test public void testValuesNullable() { + @Test void testValuesNullable() { // Equivalent SQL: // VALUES (null, 1, 'abc'), (false, null, 'longer string') final RelBuilder builder = RelBuilder.create(config().build()); @@ -2639,7 +2639,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root.getRowType().getFullTypeString(), is(expectedType)); } - @Test public void testValuesBadNullFieldNames() { + @Test void testValuesBadNullFieldNames() { try { final RelBuilder builder = RelBuilder.create(config().build()); RelBuilder root = builder.values((String[]) null, "a", "b"); @@ -2650,7 +2650,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testValuesBadNoFields() { + @Test void testValuesBadNoFields() { try { final RelBuilder builder = RelBuilder.create(config().build()); RelBuilder root = builder.values(new String[0], 1, 2, 3); @@ -2661,7 +2661,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testValuesBadNoValues() { + @Test void testValuesBadNoValues() { try { final RelBuilder builder = RelBuilder.create(config().build()); RelBuilder root = builder.values(new String[]{"a", "b"}); @@ -2672,7 +2672,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testValuesBadOddMultiple() { + @Test void testValuesBadOddMultiple() { try { final RelBuilder builder = RelBuilder.create(config().build()); RelBuilder root = builder.values(new String[] {"a", "b"}, 1, 2, 3, 4, 5); @@ -2683,7 +2683,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testValuesBadAllNull() { + @Test void testValuesBadAllNull() { try { final RelBuilder builder = RelBuilder.create(config().build()); RelBuilder root = @@ -2695,7 +2695,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testValuesAllNull() { + @Test void testValuesAllNull() { final RelBuilder builder = RelBuilder.create(config().build()); RelDataType rowType = builder.getTypeFactory().builder() @@ -2712,7 +2712,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root.getRowType().getFullTypeString(), is(expectedType)); } - @Test public void testSort() { + @Test void testSort() { // Equivalent SQL: // SELECT * // FROM emp @@ -2738,7 +2738,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-1015] * OFFSET 0 causes AssertionError. */ - @Test public void testTrivialSort() { + @Test void testTrivialSort() { // Equivalent SQL: // SELECT * // FROM emp @@ -2752,7 +2752,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testSortDuplicate() { + @Test void testSortDuplicate() { // Equivalent SQL: // SELECT * // FROM emp @@ -2773,7 +2773,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testSortByExpression() { + @Test void testSortByExpression() { // Equivalent SQL: // SELECT * // FROM emp @@ -2794,7 +2794,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testLimit() { + @Test void testLimit() { // Equivalent SQL: // SELECT * // FROM emp @@ -2810,7 +2810,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testSortLimit() { + @Test void testSortLimit() { // Equivalent SQL: // SELECT * // FROM emp @@ -2826,7 +2826,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testSortLimit0() { + @Test void testSortLimit0() { // Equivalent SQL: // SELECT * // FROM emp @@ -2843,7 +2843,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Test case for * [CALCITE-1610] * RelBuilder sort-combining optimization treats aliases incorrectly. */ - @Test public void testSortOverProjectSort() { + @Test void testSortOverProjectSort() { final RelBuilder builder = RelBuilder.create(config().build()); builder.scan("EMP") .sort(0) @@ -2872,7 +2872,7 @@ private RelNode buildRelWithDuplicateAggregates( *

In general a relational operator cannot rely on the order of its input, * but it is reasonable to merge sort and limit if they were created by * consecutive builder operations. And clients such as Piglet rely on it. */ - @Test public void testSortThenLimit() { + @Test void testSortThenLimit() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") @@ -2893,7 +2893,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Tests that a sort on an expression followed by a limit gives the same * effect as calling sortLimit. */ - @Test public void testSortExpThenLimit() { + @Test void testSortExpThenLimit() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("DEPT") @@ -2921,7 +2921,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** Tests {@link org.apache.calcite.tools.RelRunner} for a VALUES query. */ - @Test public void testRunValues() throws Exception { + @Test void testRunValues() throws Exception { // Equivalent SQL: // VALUES (true, 1), (false, -50) AS t(a, b) final RelBuilder builder = RelBuilder.create(config().build()); @@ -2938,7 +2938,7 @@ private RelNode buildRelWithDuplicateAggregates( /** Tests {@link org.apache.calcite.tools.RelRunner} for a table scan + filter * query. */ - @Test public void testRun() throws Exception { + @Test void testRun() throws Exception { // Equivalent SQL: // SELECT * FROM EMP WHERE DEPTNO = 20 final RelBuilder builder = RelBuilder.create(config().build()); @@ -2966,7 +2966,7 @@ private RelNode buildRelWithDuplicateAggregates( * [CALCITE-1595] * RelBuilder.call throws NullPointerException if argument types are * invalid. */ - @Test public void testTypeInferenceValidation() { + @Test void testTypeInferenceValidation() { final RelBuilder builder = RelBuilder.create(config().build()); // test for a) call(operator, Iterable) final RexNode arg0 = builder.literal(0); @@ -2987,7 +2987,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testMatchRecognize() { + @Test void testMatchRecognize() { // Equivalent SQL: // SELECT * // FROM emp @@ -3073,7 +3073,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testFilterCastAny() { + @Test void testFilterCastAny() { final RelBuilder builder = RelBuilder.create(config().build()); final RelDataType anyType = builder.getTypeFactory().createSqlType(SqlTypeName.ANY); @@ -3090,7 +3090,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testFilterCastNull() { + @Test void testFilterCastNull() { final RelBuilder builder = RelBuilder.create(config().build()); final RelDataTypeFactory typeFactory = builder.getTypeFactory(); final RelNode root = @@ -3109,7 +3109,7 @@ private RelNode buildRelWithDuplicateAggregates( } /** Tests filter builder with correlation variables */ - @Test public void testFilterWithCorrelationVariables() { + @Test void testFilterWithCorrelationVariables() { final RelBuilder builder = RelBuilder.create(config().build()); final Holder v = Holder.of(null); RelNode root = builder.scan("EMP") @@ -3142,7 +3142,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree(expected)); } - @Test public void testFilterEmpty() { + @Test void testFilterEmpty() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") @@ -3156,7 +3156,7 @@ private RelNode buildRelWithDuplicateAggregates( assertThat(root, hasTree("LogicalTableScan(table=[[scott, EMP]])\n")); } - @Test public void testRelBuilderToString() { + @Test void testRelBuilderToString() { final RelBuilder builder = RelBuilder.create(config().build()); builder.scan("EMP"); @@ -3183,7 +3183,7 @@ private RelNode buildRelWithDuplicateAggregates( * *

This test currently fails (thus ignored). */ - @Test public void testExpandViewInRelBuilder() throws SQLException { + @Test void testExpandViewInRelBuilder() throws SQLException { try (Connection connection = DriverManager.getConnection("jdbc:calcite:")) { final Frameworks.ConfigBuilder configBuilder = expandingConfig(connection); @@ -3206,7 +3206,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testExpandViewShouldKeepAlias() throws SQLException { + @Test void testExpandViewShouldKeepAlias() throws SQLException { try (Connection connection = DriverManager.getConnection("jdbc:calcite:")) { final Frameworks.ConfigBuilder configBuilder = expandingConfig(connection); @@ -3228,7 +3228,7 @@ private RelNode buildRelWithDuplicateAggregates( } } - @Test public void testExpandTable() throws SQLException { + @Test void testExpandTable() throws SQLException { try (Connection connection = DriverManager.getConnection("jdbc:calcite:")) { // RelBuilder expands as default. Plan contains JdbcTableScan, // because RelBuilder.scan has called RelOptTable.toRel. @@ -3251,7 +3251,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { assertThat(root, matcher); } - @Test public void testExchange() { + @Test void testExchange() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") .exchange(RelDistributions.hash(Lists.newArrayList(0))) @@ -3262,7 +3262,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { assertThat(root, hasTree(expected)); } - @Test public void testSortExchange() { + @Test void testSortExchange() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") @@ -3275,7 +3275,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { assertThat(root, hasTree(expected)); } - @Test public void testCorrelate() { + @Test void testCorrelate() { final RelBuilder builder = RelBuilder.create(config().build()); final Holder v = Holder.of(null); RelNode root = builder.scan("EMP") @@ -3295,7 +3295,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { assertThat(root, hasTree(expected)); } - @Test public void testCorrelateWithComplexFields() { + @Test void testCorrelateWithComplexFields() { final RelBuilder builder = RelBuilder.create(config().build()); final Holder v = Holder.of(null); RelNode root = builder.scan("EMP") @@ -3320,7 +3320,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { assertThat(root, hasTree(expected)); } - @Test public void testHints() { + @Test void testHints() { final RelHint indexHint = RelHint.builder("INDEX") .hintOption("_idx1") .hintOption("_idx2") @@ -3372,7 +3372,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { assertThat(root2, hasHints("[[NO_HASH_JOIN inheritPath:[0]]]")); } - @Test public void testHintsOnEmptyStack() { + @Test void testHintsOnEmptyStack() { final RelHint indexHint = RelHint.builder("INDEX") .hintOption("_idx1") .hintOption("_idx2") @@ -3386,7 +3386,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { containsString("There is no relational expression to attach the hints")); } - @Test public void testHintsOnNonHintable() { + @Test void testHintsOnNonHintable() { final RelHint indexHint = RelHint.builder("INDEX") .hintOption("_idx1") .hintOption("_idx2") @@ -3416,7 +3416,7 @@ private void checkExpandTable(RelBuilder builder, Matcher matcher) { /** Test case for * [CALCITE-3747] * Constructing BETWEEN with RelBuilder throws class cast exception. */ - @Test public void testCallBetweenOperator() { + @Test void testCallBetweenOperator() { final RelBuilder builder = RelBuilder.create(config().build()); final RexNode call = builder.scan("EMP") .call( diff --git a/core/src/test/java/org/apache/calcite/test/RelMdColumnOriginsTest.java b/core/src/test/java/org/apache/calcite/test/RelMdColumnOriginsTest.java index b42e053276eb..4f19ebc9b1f0 100644 --- a/core/src/test/java/org/apache/calcite/test/RelMdColumnOriginsTest.java +++ b/core/src/test/java/org/apache/calcite/test/RelMdColumnOriginsTest.java @@ -33,11 +33,11 @@ import static org.hamcrest.MatcherAssert.assertThat; /** Test case for CALCITE-542. */ -public class RelMdColumnOriginsTest { +class RelMdColumnOriginsTest { /** Test case for * [CALCITE-542] * Support for Aggregate with grouping sets in RelMdColumnOrigins. */ - @Test public void testQueryWithAggregateGroupingSets() throws Exception { + @Test void testQueryWithAggregateGroupingSets() throws Exception { Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); diff --git a/core/src/test/java/org/apache/calcite/test/RelMdPercentageOriginalRowsTest.java b/core/src/test/java/org/apache/calcite/test/RelMdPercentageOriginalRowsTest.java index 0adbddbd82ca..c3afeb998715 100644 --- a/core/src/test/java/org/apache/calcite/test/RelMdPercentageOriginalRowsTest.java +++ b/core/src/test/java/org/apache/calcite/test/RelMdPercentageOriginalRowsTest.java @@ -23,12 +23,12 @@ import org.junit.jupiter.api.Test; /** Test case for CALCITE-2894 */ -public class RelMdPercentageOriginalRowsTest { +class RelMdPercentageOriginalRowsTest { /** Test case for * [CALCITE-2894] * NullPointerException thrown by RelMdPercentageOriginalRows when explaining * plan with all attributes. */ - @Test public void testExplainAllAttributesSemiJoinUnionCorrelate() { + @Test void testExplainAllAttributesSemiJoinUnionCorrelate() { CalciteAssert.that() .with(CalciteConnectionProperty.LEX, Lex.JAVA) .with(CalciteConnectionProperty.FORCE_DECORRELATE, false) diff --git a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java index 65cee7f874be..cf1ece4728b2 100644 --- a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java +++ b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java @@ -221,27 +221,27 @@ private void checkPercentageOriginalRows( assertEquals(expected, result, epsilon); } - @Test public void testPercentageOriginalRowsTableOnly() { + @Test void testPercentageOriginalRowsTableOnly() { checkPercentageOriginalRows( "select * from dept", 1.0); } - @Test public void testPercentageOriginalRowsAgg() { + @Test void testPercentageOriginalRowsAgg() { checkPercentageOriginalRows( "select deptno from dept group by deptno", 1.0); } @Disabled - @Test public void testPercentageOriginalRowsOneFilter() { + @Test void testPercentageOriginalRowsOneFilter() { checkPercentageOriginalRows( "select * from dept where deptno = 20", DEFAULT_EQUAL_SELECTIVITY); } @Disabled - @Test public void testPercentageOriginalRowsTwoFilters() { + @Test void testPercentageOriginalRowsTwoFilters() { checkPercentageOriginalRows("select * from (\n" + " select * from dept where name='X')\n" + "where deptno = 20", @@ -249,21 +249,21 @@ private void checkPercentageOriginalRows( } @Disabled - @Test public void testPercentageOriginalRowsRedundantFilter() { + @Test void testPercentageOriginalRowsRedundantFilter() { checkPercentageOriginalRows("select * from (\n" + " select * from dept where deptno=20)\n" + "where deptno = 20", DEFAULT_EQUAL_SELECTIVITY); } - @Test public void testPercentageOriginalRowsJoin() { + @Test void testPercentageOriginalRowsJoin() { checkPercentageOriginalRows( "select * from emp inner join dept on emp.deptno=dept.deptno", 1.0); } @Disabled - @Test public void testPercentageOriginalRowsJoinTwoFilters() { + @Test void testPercentageOriginalRowsJoinTwoFilters() { checkPercentageOriginalRows("select * from (\n" + " select * from emp where deptno=10) e\n" + "inner join (select * from dept where deptno=10) d\n" @@ -271,14 +271,14 @@ private void checkPercentageOriginalRows( DEFAULT_EQUAL_SELECTIVITY_SQUARED); } - @Test public void testPercentageOriginalRowsUnionNoFilter() { + @Test void testPercentageOriginalRowsUnionNoFilter() { checkPercentageOriginalRows( "select name from dept union all select ename from emp", 1.0); } @Disabled - @Test public void testPercentageOriginalRowsUnionLittleFilter() { + @Test void testPercentageOriginalRowsUnionLittleFilter() { checkPercentageOriginalRows( "select name from dept where deptno=20" + " union all select ename from emp", @@ -287,7 +287,7 @@ private void checkPercentageOriginalRows( } @Disabled - @Test public void testPercentageOriginalRowsUnionBigFilter() { + @Test void testPercentageOriginalRowsUnionBigFilter() { checkPercentageOriginalRows( "select name from dept" + " union all select ename from emp where deptno=20", @@ -374,7 +374,7 @@ private void checkTwoColumnOrigin( } } - @Test public void testColumnOriginsTableOnly() { + @Test void testColumnOriginsTableOnly() { checkSingleColumnOrigin( "select name as dname from dept", "DEPT", @@ -382,7 +382,7 @@ private void checkTwoColumnOrigin( false); } - @Test public void testColumnOriginsExpression() { + @Test void testColumnOriginsExpression() { checkSingleColumnOrigin( "select upper(name) as dname from dept", "DEPT", @@ -390,7 +390,7 @@ private void checkTwoColumnOrigin( true); } - @Test public void testColumnOriginsDyadicExpression() { + @Test void testColumnOriginsDyadicExpression() { checkTwoColumnOrigin( "select name||ename from dept,emp", "DEPT", @@ -400,12 +400,12 @@ private void checkTwoColumnOrigin( true); } - @Test public void testColumnOriginsConstant() { + @Test void testColumnOriginsConstant() { checkNoColumnOrigin( "select 'Minstrelsy' as dname from dept"); } - @Test public void testColumnOriginsFilter() { + @Test void testColumnOriginsFilter() { checkSingleColumnOrigin( "select name as dname from dept where deptno=10", "DEPT", @@ -413,7 +413,7 @@ private void checkTwoColumnOrigin( false); } - @Test public void testColumnOriginsJoinLeft() { + @Test void testColumnOriginsJoinLeft() { checkSingleColumnOrigin( "select ename from emp,dept", "EMP", @@ -421,7 +421,7 @@ private void checkTwoColumnOrigin( false); } - @Test public void testColumnOriginsJoinRight() { + @Test void testColumnOriginsJoinRight() { checkSingleColumnOrigin( "select name as dname from emp,dept", "DEPT", @@ -429,7 +429,7 @@ private void checkTwoColumnOrigin( false); } - @Test public void testColumnOriginsJoinOuter() { + @Test void testColumnOriginsJoinOuter() { checkSingleColumnOrigin( "select name as dname from emp left outer join dept" + " on emp.deptno = dept.deptno", @@ -438,7 +438,7 @@ private void checkTwoColumnOrigin( true); } - @Test public void testColumnOriginsJoinFullOuter() { + @Test void testColumnOriginsJoinFullOuter() { checkSingleColumnOrigin( "select name as dname from emp full outer join dept" + " on emp.deptno = dept.deptno", @@ -447,7 +447,7 @@ private void checkTwoColumnOrigin( true); } - @Test public void testColumnOriginsAggKey() { + @Test void testColumnOriginsAggKey() { checkSingleColumnOrigin( "select name,count(deptno) from dept group by name", "DEPT", @@ -455,12 +455,12 @@ private void checkTwoColumnOrigin( false); } - @Test public void testColumnOriginsAggReduced() { + @Test void testColumnOriginsAggReduced() { checkNoColumnOrigin( "select count(deptno),name from dept group by name"); } - @Test public void testColumnOriginsAggCountNullable() { + @Test void testColumnOriginsAggCountNullable() { checkSingleColumnOrigin( "select count(mgr),ename from emp group by ename", "EMP", @@ -468,17 +468,17 @@ private void checkTwoColumnOrigin( true); } - @Test public void testColumnOriginsAggCountStar() { + @Test void testColumnOriginsAggCountStar() { checkNoColumnOrigin( "select count(*),name from dept group by name"); } - @Test public void testColumnOriginsValues() { + @Test void testColumnOriginsValues() { checkNoColumnOrigin( "values(1,2,3)"); } - @Test public void testColumnOriginsUnion() { + @Test void testColumnOriginsUnion() { checkTwoColumnOrigin( "select name from dept union all select ename from emp", "DEPT", @@ -488,7 +488,7 @@ private void checkTwoColumnOrigin( false); } - @Test public void testColumnOriginsSelfUnion() { + @Test void testColumnOriginsSelfUnion() { checkSingleColumnOrigin( "select ename from emp union all select ename from emp", "EMP", @@ -525,34 +525,34 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected assertThat(min, is(expectedMin)); } - @Test public void testRowCountEmp() { + @Test void testRowCountEmp() { final String sql = "select * from emp"; checkRowCount(sql, EMP_SIZE, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountDept() { + @Test void testRowCountDept() { final String sql = "select * from dept"; checkRowCount(sql, DEPT_SIZE, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountValues() { + @Test void testRowCountValues() { final String sql = "select * from (values (1), (2)) as t(c)"; checkRowCount(sql, 2, 2, 2); } - @Test public void testRowCountCartesian() { + @Test void testRowCountCartesian() { final String sql = "select * from emp,dept"; checkRowCount(sql, EMP_SIZE * DEPT_SIZE, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountJoin() { + @Test void testRowCountJoin() { final String sql = "select * from emp\n" + "inner join dept on emp.deptno = dept.deptno"; checkRowCount(sql, EMP_SIZE * DEPT_SIZE * DEFAULT_EQUAL_SELECTIVITY, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountJoinFinite() { + @Test void testRowCountJoinFinite() { final String sql = "select * from (select * from emp limit 14) as emp\n" + "inner join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -560,7 +560,7 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected 0D, 56D); // 4 * 14 } - @Test public void testRowCountJoinEmptyFinite() { + @Test void testRowCountJoinEmptyFinite() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "inner join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -568,7 +568,7 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected 0D, 0D); // 0 * 4 } - @Test public void testRowCountLeftJoinEmptyFinite() { + @Test void testRowCountLeftJoinEmptyFinite() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "left join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -576,7 +576,7 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected 0D, 0D); // 0 * 4 } - @Test public void testRowCountRightJoinEmptyFinite() { + @Test void testRowCountRightJoinEmptyFinite() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "right join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -584,7 +584,7 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected 0D, 4D); // 1 * 4 } - @Test public void testRowCountJoinFiniteEmpty() { + @Test void testRowCountJoinFiniteEmpty() { final String sql = "select * from (select * from emp limit 7) as emp\n" + "inner join (select * from dept limit 0) as dept\n" + "on emp.deptno = dept.deptno"; @@ -592,7 +592,7 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected 0D, 0D); // 7 * 0 } - @Test public void testRowCountJoinEmptyEmpty() { + @Test void testRowCountJoinEmptyEmpty() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "inner join (select * from dept limit 0) as dept\n" + "on emp.deptno = dept.deptno"; @@ -600,57 +600,57 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected 0D, 0D); // 0 * 0 } - @Test public void testRowCountUnion() { + @Test void testRowCountUnion() { final String sql = "select ename from emp\n" + "union all\n" + "select name from dept"; checkRowCount(sql, EMP_SIZE + DEPT_SIZE, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountUnionOnFinite() { + @Test void testRowCountUnionOnFinite() { final String sql = "select ename from (select * from emp limit 100)\n" + "union all\n" + "select name from (select * from dept limit 40)"; checkRowCount(sql, EMP_SIZE + DEPT_SIZE, 0D, 140D); } - @Test public void testRowCountIntersectOnFinite() { + @Test void testRowCountIntersectOnFinite() { final String sql = "select ename from (select * from emp limit 100)\n" + "intersect\n" + "select name from (select * from dept limit 40)"; checkRowCount(sql, Math.min(EMP_SIZE, DEPT_SIZE), 0D, 40D); } - @Test public void testRowCountMinusOnFinite() { + @Test void testRowCountMinusOnFinite() { final String sql = "select ename from (select * from emp limit 100)\n" + "except\n" + "select name from (select * from dept limit 40)"; checkRowCount(sql, 4D, 0D, 100D); } - @Test public void testRowCountFilter() { + @Test void testRowCountFilter() { final String sql = "select * from emp where ename='Mathilda'"; checkRowCount(sql, EMP_SIZE * DEFAULT_EQUAL_SELECTIVITY, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountFilterOnFinite() { + @Test void testRowCountFilterOnFinite() { final String sql = "select * from (select * from emp limit 10)\n" + "where ename='Mathilda'"; checkRowCount(sql, 10D * DEFAULT_EQUAL_SELECTIVITY, 0D, 10D); } - @Test public void testRowCountFilterFalse() { + @Test void testRowCountFilterFalse() { final String sql = "select * from (values 'a', 'b') as t(x) where false"; checkRowCount(sql, 1D, 0D, 0D); } - @Test public void testRowCountSort() { + @Test void testRowCountSort() { final String sql = "select * from emp order by ename"; checkRowCount(sql, EMP_SIZE, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountExchange() { + @Test void testRowCountExchange() { final String sql = "select * from emp order by ename limit 123456"; RelNode rel = convertSql(sql); final RelDistribution dist = RelDistributions.hash(ImmutableList.of()); @@ -658,87 +658,87 @@ private void checkExchangeRowCount(RelNode rel, double expected, double expected checkExchangeRowCount(exchange, EMP_SIZE, 0D, 123456D); } - @Test public void testRowCountTableModify() { + @Test void testRowCountTableModify() { final String sql = "insert into emp select * from emp order by ename limit 123456"; checkRowCount(sql, EMP_SIZE, 0D, 123456D); } - @Test public void testRowCountSortHighLimit() { + @Test void testRowCountSortHighLimit() { final String sql = "select * from emp order by ename limit 123456"; checkRowCount(sql, EMP_SIZE, 0D, 123456D); } - @Test public void testRowCountSortHighOffset() { + @Test void testRowCountSortHighOffset() { final String sql = "select * from emp order by ename offset 123456"; checkRowCount(sql, 1D, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountSortHighOffsetLimit() { + @Test void testRowCountSortHighOffsetLimit() { final String sql = "select * from emp order by ename limit 5 offset 123456"; checkRowCount(sql, 1D, 0D, 5D); } - @Test public void testRowCountSortLimit() { + @Test void testRowCountSortLimit() { final String sql = "select * from emp order by ename limit 10"; checkRowCount(sql, 10d, 0D, 10d); } - @Test public void testRowCountSortLimit0() { + @Test void testRowCountSortLimit0() { final String sql = "select * from emp order by ename limit 0"; checkRowCount(sql, 1d, 0D, 0d); } - @Test public void testRowCountSortLimitOffset() { + @Test void testRowCountSortLimitOffset() { final String sql = "select * from emp order by ename limit 10 offset 5"; checkRowCount(sql, 9D /* 14 - 5 */, 0D, 10d); } - @Test public void testRowCountSortLimitOffsetOnFinite() { + @Test void testRowCountSortLimitOffsetOnFinite() { final String sql = "select * from (select * from emp limit 12)\n" + "order by ename limit 20 offset 5"; checkRowCount(sql, 7d, 0D, 7d); } - @Test public void testRowCountAggregate() { + @Test void testRowCountAggregate() { final String sql = "select deptno from emp group by deptno"; checkRowCount(sql, 1.4D, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountAggregateGroupingSets() { + @Test void testRowCountAggregateGroupingSets() { final String sql = "select deptno from emp\n" + "group by grouping sets ((deptno), (ename, deptno))"; checkRowCount(sql, 2.8D, // EMP_SIZE / 10 * 2 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountAggregateGroupingSetsOneEmpty() { + @Test void testRowCountAggregateGroupingSetsOneEmpty() { final String sql = "select deptno from emp\n" + "group by grouping sets ((deptno), ())"; checkRowCount(sql, 2.8D, 0D, Double.POSITIVE_INFINITY); } - @Test public void testRowCountAggregateEmptyKey() { + @Test void testRowCountAggregateEmptyKey() { final String sql = "select count(*) from emp"; checkRowCount(sql, 1D, 1D, 1D); } - @Test public void testRowCountAggregateConstantKey() { + @Test void testRowCountAggregateConstantKey() { final String sql = "select count(*) from emp where deptno=2 and ename='emp1' " + "group by deptno, ename"; checkRowCount(sql, 1D, 0D, 1D); } - @Test public void testRowCountAggregateConstantKeys() { + @Test void testRowCountAggregateConstantKeys() { final String sql = "select distinct deptno from emp where deptno=4"; checkRowCount(sql, 1D, 0D, 1D); } - @Test public void testRowCountFilterAggregateEmptyKey() { + @Test void testRowCountFilterAggregateEmptyKey() { final String sql = "select count(*) from emp where 1 = 0"; checkRowCount(sql, 1D, 1D, 1D); } - @Test public void testRowCountAggregateEmptyKeyOnEmptyTable() { + @Test void testRowCountAggregateEmptyKeyOnEmptyTable() { final String sql = "select count(*) from (select * from emp limit 0)"; checkRowCount(sql, 1D, 1D, 1D); } @@ -753,37 +753,37 @@ private void checkFilterSelectivity( assertEquals(expected, result, EPSILON); } - @Test public void testSelectivityIsNotNullFilter() { + @Test void testSelectivityIsNotNullFilter() { checkFilterSelectivity( "select * from emp where mgr is not null", DEFAULT_NOTNULL_SELECTIVITY); } - @Test public void testSelectivityIsNotNullFilterOnNotNullColumn() { + @Test void testSelectivityIsNotNullFilterOnNotNullColumn() { checkFilterSelectivity( "select * from emp where deptno is not null", 1.0d); } - @Test public void testSelectivityComparisonFilter() { + @Test void testSelectivityComparisonFilter() { checkFilterSelectivity( "select * from emp where deptno > 10", DEFAULT_COMP_SELECTIVITY); } - @Test public void testSelectivityAndFilter() { + @Test void testSelectivityAndFilter() { checkFilterSelectivity( "select * from emp where ename = 'foo' and deptno = 10", DEFAULT_EQUAL_SELECTIVITY_SQUARED); } - @Test public void testSelectivityOrFilter() { + @Test void testSelectivityOrFilter() { checkFilterSelectivity( "select * from emp where ename = 'foo' or deptno = 10", DEFAULT_SELECTIVITY); } - @Test public void testSelectivityJoin() { + @Test void testSelectivityJoin() { checkFilterSelectivity( "select * from emp join dept using (deptno) where ename = 'foo'", DEFAULT_EQUAL_SELECTIVITY); @@ -798,19 +798,19 @@ private void checkRelSelectivity( assertEquals(expected, result, EPSILON); } - @Test public void testSelectivityRedundantFilter() { + @Test void testSelectivityRedundantFilter() { RelNode rel = convertSql("select * from emp where deptno = 10"); checkRelSelectivity(rel, DEFAULT_EQUAL_SELECTIVITY); } - @Test public void testSelectivitySort() { + @Test void testSelectivitySort() { RelNode rel = convertSql("select * from emp where deptno = 10" + "order by ename"); checkRelSelectivity(rel, DEFAULT_EQUAL_SELECTIVITY); } - @Test public void testSelectivityUnion() { + @Test void testSelectivityUnion() { RelNode rel = convertSql("select * from (\n" + " select * from emp union all select * from emp) " @@ -818,7 +818,7 @@ private void checkRelSelectivity( checkRelSelectivity(rel, DEFAULT_EQUAL_SELECTIVITY); } - @Test public void testSelectivityAgg() { + @Test void testSelectivityAgg() { RelNode rel = convertSql("select deptno, count(*) from emp where deptno > 10 " + "group by deptno having count(*) = 0"); @@ -829,7 +829,7 @@ private void checkRelSelectivity( /** Checks that we can cache a metadata request that includes a null * argument. */ - @Test public void testSelectivityAggCached() { + @Test void testSelectivityAggCached() { RelNode rel = convertSql("select deptno, count(*) from emp where deptno > 10 " + "group by deptno having count(*) = 0"); @@ -850,7 +850,7 @@ private void checkRelSelectivity( * * Too slow to run every day, and it does not reproduce the issue. */ @Tag("slow") - @Test public void testMetadataHandlerCacheLimit() { + @Test void testMetadataHandlerCacheLimit() { assumeTrue(CalciteSystemProperty.METADATA_HANDLER_CACHE_MAXIMUM_SIZE.value() < 10_000, "If cache size is too large, this test may fail and the test won't be to blame"); final int iterationCount = 2_000; @@ -868,7 +868,7 @@ private void checkRelSelectivity( } } - @Test public void testDistinctRowCountTable() { + @Test void testDistinctRowCountTable() { // no unique key information is available so return null RelNode rel = convertSql("select * from emp where deptno = 10"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -878,7 +878,7 @@ private void checkRelSelectivity( assertThat(result, nullValue()); } - @Test public void testDistinctRowCountTableEmptyKey() { + @Test void testDistinctRowCountTableEmptyKey() { RelNode rel = convertSql("select * from emp where deptno = 10"); ImmutableBitSet groupKey = ImmutableBitSet.of(); // empty key final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -951,12 +951,12 @@ private boolean isUnique(Set uniqueKeys, ImmutableBitSet key) { * [CALCITE-509] * "RelMdColumnUniqueness uses ImmutableBitSet.Builder twice, gets * NullPointerException". */ - @Test public void testJoinUniqueKeys() { + @Test void testJoinUniqueKeys() { checkGetUniqueKeys("select * from emp join bonus using (ename)", ImmutableSet.of()); } - @Test public void testCorrelateUniqueKeys() { + @Test void testCorrelateUniqueKeys() { final String sql = "select *\n" + "from (select distinct deptno from emp) as e,\n" + " lateral (\n" @@ -981,17 +981,17 @@ private boolean isUnique(Set uniqueKeys, ImmutableBitSet key) { } } - @Test public void testGroupByEmptyUniqueKeys() { + @Test void testGroupByEmptyUniqueKeys() { checkGetUniqueKeys("select count(*) from emp", ImmutableSet.of(ImmutableBitSet.of())); } - @Test public void testGroupByEmptyHavingUniqueKeys() { + @Test void testGroupByEmptyHavingUniqueKeys() { checkGetUniqueKeys("select count(*) from emp where 1 = 1", ImmutableSet.of(ImmutableBitSet.of())); } - @Test public void testFullOuterJoinUniqueness1() { + @Test void testFullOuterJoinUniqueness1() { final String sql = "select e.empno, d.deptno\n" + "from (select cast(null as int) empno from sales.emp " + " where empno = 10 group by cast(null as int)) as e\n" @@ -1006,7 +1006,7 @@ private boolean isUnique(Set uniqueKeys, ImmutableBitSet key) { assertThat(areGroupByKeysUnique, is(false)); } - @Test public void testColumnUniquenessForFilterWithConstantColumns() { + @Test void testColumnUniquenessForFilterWithConstantColumns() { checkColumnUniquenessForFilterWithConstantColumns("" + "select *\n" + "from (select distinct deptno, sal from emp)\n" @@ -1027,7 +1027,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(1)), is(false)); } - @Test public void testColumnUniquenessForUnionWithConstantColumns() { + @Test void testColumnUniquenessForUnionWithConstantColumns() { final String sql = "" + "select deptno, sal from emp where sal=1000\n" + "union\n" @@ -1039,7 +1039,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(0)), is(true)); } - @Test public void testColumnUniquenessForIntersectWithConstantColumns() { + @Test void testColumnUniquenessForIntersectWithConstantColumns() { final String sql = "" + "select deptno, sal\n" + "from (select distinct deptno, sal from emp)\n" @@ -1053,7 +1053,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(0, 1)), is(true)); } - @Test public void testColumnUniquenessForMinusWithConstantColumns() { + @Test void testColumnUniquenessForMinusWithConstantColumns() { final String sql = "" + "select deptno, sal\n" + "from (select distinct deptno, sal from emp)\n" @@ -1068,7 +1068,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(0, 1)), is(true)); } - @Test public void testColumnUniquenessForSortWithConstantColumns() { + @Test void testColumnUniquenessForSortWithConstantColumns() { final String sql = "" + "select *\n" + "from (select distinct deptno, sal from emp)\n" @@ -1081,7 +1081,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(0, 1)), is(true)); } - @Test public void testColumnUniquenessForJoinWithConstantColumns() { + @Test void testColumnUniquenessForJoinWithConstantColumns() { final String sql = "" + "select *\n" + "from (select distinct deptno, sal from emp) A\n" @@ -1097,7 +1097,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(0, 1)), is(false)); } - @Test public void testColumnUniquenessForAggregateWithConstantColumns() { + @Test void testColumnUniquenessForAggregateWithConstantColumns() { final String sql = "" + "select deptno, ename, sum(sal)\n" + "from emp\n" @@ -1108,7 +1108,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(rel, ImmutableBitSet.of(1)), is(true)); } - @Test public void testColumnUniquenessForExchangeWithConstantColumns() { + @Test void testColumnUniquenessForExchangeWithConstantColumns() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); RelNode exchange = builder.scan("EMP") @@ -1121,7 +1121,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(exchange, ImmutableBitSet.of(0)), is(true)); } - @Test public void testColumnUniquenessForCorrelateWithConstantColumns() { + @Test void testColumnUniquenessForCorrelateWithConstantColumns() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); RelNode rel0 = builder.scan("EMP") @@ -1145,19 +1145,19 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { assertThat(mq.areColumnsUnique(correl, ImmutableBitSet.of(0)), is(true)); } - @Test public void testGroupBy() { + @Test void testGroupBy() { checkGetUniqueKeys("select deptno, count(*), sum(sal) from emp group by deptno", ImmutableSet.of(ImmutableBitSet.of(0))); } - @Test public void testUnion() { + @Test void testUnion() { checkGetUniqueKeys("select deptno from emp\n" + "union\n" + "select deptno from dept", ImmutableSet.of(ImmutableBitSet.of(0))); } - @Test public void testSingleKeyTableScanUniqueKeys() { + @Test void testSingleKeyTableScanUniqueKeys() { // select key column checkGetUniqueKeys("select empno, ename from emp", ImmutableSet.of(ImmutableBitSet.of(0))); @@ -1167,7 +1167,7 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { ImmutableSet.of()); } - @Test public void testCompositeKeysTableScanUniqueKeys() { + @Test void testCompositeKeysTableScanUniqueKeys() { SqlTestFactory.MockCatalogReaderFactory factory = (typeFactory, caseSensitive) -> { CompositeKeysCatalogReader catalogReader = new CompositeKeysCatalogReader(typeFactory, false); @@ -1197,32 +1197,32 @@ private static ImmutableBitSet bitSetOf(int... bits) { return ImmutableBitSet.of(bits); } - @Test public void calcColumnsAreUniqueSimpleCalc() { + @Test void calcColumnsAreUniqueSimpleCalc() { checkGetUniqueKeys("select empno, empno*0 from emp", ImmutableSet.of(bitSetOf(0)), convertProjectAsCalc()); } - @Test public void calcColumnsAreUniqueCalcWithFirstConstant() { + @Test void calcColumnsAreUniqueCalcWithFirstConstant() { checkGetUniqueKeys("select 1, empno, empno*0 from emp", ImmutableSet.of(bitSetOf(1)), convertProjectAsCalc()); } - @Test public void calcMultipleColumnsAreUniqueCalc() { + @Test void calcMultipleColumnsAreUniqueCalc() { checkGetUniqueKeys("select empno, empno from emp", ImmutableSet.of(bitSetOf(0), bitSetOf(1), bitSetOf(0, 1)), convertProjectAsCalc()); } - @Test public void calcMultipleColumnsAreUniqueCalc2() { + @Test void calcMultipleColumnsAreUniqueCalc2() { checkGetUniqueKeys( "select a1.empno, a2.empno from emp a1 join emp a2 on (a1.empno=a2.empno)", ImmutableSet.of(bitSetOf(0), bitSetOf(1), bitSetOf(0, 1)), convertProjectAsCalc()); } - @Test public void calcMultipleColumnsAreUniqueCalc3() { + @Test void calcMultipleColumnsAreUniqueCalc3() { checkGetUniqueKeys( "select a1.empno, a2.empno, a2.empno\n" + " from emp a1 join emp a2\n" @@ -1233,7 +1233,7 @@ private static ImmutableBitSet bitSetOf(int... bits) { convertProjectAsCalc()); } - @Test public void calcColumnsAreNonUniqueCalc() { + @Test void calcColumnsAreNonUniqueCalc() { checkGetUniqueKeys("select empno*0 from emp", ImmutableSet.of(), convertProjectAsCalc()); @@ -1253,7 +1253,7 @@ private Function convertProjectAsCalc() { }; } - @Test public void testBrokenCustomProviderWithMetadataFactory() { + @Test void testBrokenCustomProviderWithMetadataFactory() { final List buf = new ArrayList<>(); ColTypeImpl.THREAD_LIST.set(buf); @@ -1285,7 +1285,7 @@ private Function convertProjectAsCalc() { } } - @Test public void testBrokenCustomProviderWithMetadataQuery() { + @Test void testBrokenCustomProviderWithMetadataQuery() { final List buf = new ArrayList<>(); ColTypeImpl.THREAD_LIST.set(buf); @@ -1327,7 +1327,7 @@ public String colType(MyRelMetadataQuery myRelMetadataQuery, RelNode rel, int co return myRelMetadataQuery.colType(rel, column); } - @Test public void testCustomProviderWithRelMetadataFactory() { + @Test void testCustomProviderWithRelMetadataFactory() { final List buf = new ArrayList<>(); ColTypeImpl.THREAD_LIST.set(buf); @@ -1392,7 +1392,7 @@ public String colType(MyRelMetadataQuery myRelMetadataQuery, RelNode rel, int co assertThat(buf.size(), equalTo(7)); } - @Test public void testCustomProviderWithRelMetadataQuery() { + @Test void testCustomProviderWithRelMetadataQuery() { final List buf = new ArrayList<>(); ColTypeImpl.THREAD_LIST.set(buf); @@ -1456,7 +1456,7 @@ public String colType(MyRelMetadataQuery myRelMetadataQuery, RelNode rel, int co /** Unit test for * {@link org.apache.calcite.rel.metadata.RelMdCollation#project} * and other helper functions for deducing collations. */ - @Test public void testCollation() { + @Test void testCollation() { final Project rel = (Project) convertSql("select * from emp, dept"); final Join join = (Join) rel.getInput(); final RelOptTable empTable = join.getInput(0).getTable(); @@ -1572,7 +1572,7 @@ private void checkCollation(RelOptCluster cluster, RelOptTable empTable, /** Unit test for * {@link org.apache.calcite.rel.metadata.RelMdColumnUniqueness#areColumnsUnique} * applied to {@link Values}. */ - @Test public void testColumnUniquenessForValues() { + @Test void testColumnUniquenessForValues() { Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> { final RexBuilder rexBuilder = cluster.getRexBuilder(); final RelMetadataQuery mq = cluster.getMetadataQuery(); @@ -1642,7 +1642,7 @@ private void addRow(ImmutableList.Builder> builder, /** Unit test for * {@link org.apache.calcite.rel.metadata.RelMetadataQuery#getAverageColumnSizes(org.apache.calcite.rel.RelNode)}, * {@link org.apache.calcite.rel.metadata.RelMetadataQuery#getAverageRowSize(org.apache.calcite.rel.RelNode)}. */ - @Test public void testAverageRowSize() { + @Test void testAverageRowSize() { final Project rel = (Project) convertSql("select * from emp, dept"); final Join join = (Join) rel.getInput(); final RelOptTable empTable = join.getInput(0).getTable(); @@ -1784,7 +1784,7 @@ private void checkAverageRowSize(RelOptCluster cluster, RelOptTable empTable, /** Unit test for * {@link org.apache.calcite.rel.metadata.RelMdPredicates#getPredicates(Join, RelMetadataQuery)}. */ - @Test public void testPredicates() { + @Test void testPredicates() { final Project rel = (Project) convertSql("select * from emp, dept"); final Join join = (Join) rel.getInput(); final RelOptTable empTable = join.getInput(0).getTable(); @@ -1903,7 +1903,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, * Unit test for * {@link org.apache.calcite.rel.metadata.RelMdPredicates#getPredicates(Aggregate, RelMetadataQuery)}. */ - @Test public void testPullUpPredicatesFromAggregation() { + @Test void testPullUpPredicatesFromAggregation() { final String sql = "select a, max(b) from (\n" + " select 1 as a, 2 as b from emp)subq\n" + "group by a"; @@ -1921,7 +1921,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, * [CALCITE-2205]. * Since this is a performance problem, the test result does not * change, but takes over 15 minutes before the fix and 6 seconds after. */ - @Test public void testPullUpPredicatesForExprsItr() { + @Test void testPullUpPredicatesForExprsItr() { final String sql = "select a.EMPNO, a.ENAME\n" + "from (select * from sales.emp ) a\n" + "join (select * from sales.emp ) b\n" @@ -1948,7 +1948,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, } } - @Test public void testPullUpPredicatesOnConstant() { + @Test void testPullUpPredicatesOnConstant() { final String sql = "select deptno, mgr, x, 'y' as y, z from (\n" + " select deptno, mgr, cast(null as integer) as x, cast('1' as int) as z\n" + " from emp\n" @@ -1960,7 +1960,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[<($0, 10), =($3, 'y'), =($4, 1), IS NULL($1), IS NULL($2)]")); } - @Test public void testPullUpPredicatesOnNullableConstant() { + @Test void testPullUpPredicatesOnNullableConstant() { final String sql = "select nullif(1, 1) as c\n" + " from emp\n" + " where mgr is null and deptno < 10"; @@ -1972,7 +1972,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[IS NULL($0)]")); } - @Test public void testPullUpPredicatesFromUnion0() { + @Test void testPullUpPredicatesFromUnion0() { final RelNode rel = convertSql("" + "select empno from emp where empno=1\n" + "union all\n" @@ -1982,7 +1982,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[=($0, 1)]")); } - @Test public void testPullUpPredicatesFromUnion1() { + @Test void testPullUpPredicatesFromUnion1() { final RelNode rel = convertSql("" + "select empno, deptno from emp where empno=1 or deptno=2\n" + "union all\n" @@ -1992,7 +1992,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[OR(=($0, 1), =($1, 2), =($0, 3), =($1, 4))]")); } - @Test public void testPullUpPredicatesFromUnion2() { + @Test void testPullUpPredicatesFromUnion2() { final RelNode rel = convertSql("" + "select empno, comm, deptno from emp where empno=1 and comm=2 and deptno=3\n" + "union all\n" @@ -2003,7 +2003,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, } - @Test public void testPullUpPredicatesFromIntersect0() { + @Test void testPullUpPredicatesFromIntersect0() { final RelNode rel = convertSql("" + "select empno from emp where empno=1\n" + "intersect all\n" @@ -2014,7 +2014,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, } - @Test public void testPullUpPredicatesFromIntersect1() { + @Test void testPullUpPredicatesFromIntersect1() { final RelNode rel = convertSql("" + "select empno, deptno, comm from emp where empno=1 and deptno=2\n" + "intersect all\n" @@ -2025,7 +2025,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, } - @Test public void testPullUpPredicatesFromIntersect2() { + @Test void testPullUpPredicatesFromIntersect2() { final RelNode rel = convertSql("" + "select empno, deptno, comm from emp where empno=1 and deptno=2\n" + "intersect all\n" @@ -2036,7 +2036,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, } - @Test public void testPullUpPredicatesFromIntersect3() { + @Test void testPullUpPredicatesFromIntersect3() { final RelNode rel = convertSql("" + "select empno, deptno, comm from emp where empno=1 or deptno=2\n" + "intersect all\n" @@ -2046,7 +2046,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[OR(=($0, 1), =($1, 2))]")); } - @Test public void testPullUpPredicatesFromMinus() { + @Test void testPullUpPredicatesFromMinus() { final RelNode rel = convertSql("" + "select empno, deptno, comm from emp where empno=1 and deptno=2\n" + "except all\n" @@ -2056,14 +2056,14 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[=($0, 1), =($1, 2)]")); } - @Test public void testDistributionSimple() { + @Test void testDistributionSimple() { RelNode rel = convertSql("select * from emp where deptno = 10"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); RelDistribution d = mq.getDistribution(rel); assertThat(d, is(RelDistributions.BROADCAST_DISTRIBUTED)); } - @Test public void testDistributionHash() { + @Test void testDistributionHash() { final RelNode rel = convertSql("select * from emp"); final RelDistribution dist = RelDistributions.hash(ImmutableList.of(1)); final LogicalExchange exchange = LogicalExchange.create(rel, dist); @@ -2073,7 +2073,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(d, is(dist)); } - @Test public void testDistributionHashEmpty() { + @Test void testDistributionHashEmpty() { final RelNode rel = convertSql("select * from emp"); final RelDistribution dist = RelDistributions.hash(ImmutableList.of()); final LogicalExchange exchange = LogicalExchange.create(rel, dist); @@ -2083,7 +2083,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(d, is(dist)); } - @Test public void testDistributionSingleton() { + @Test void testDistributionSingleton() { final RelNode rel = convertSql("select * from emp"); final RelDistribution dist = RelDistributions.SINGLETON; final LogicalExchange exchange = LogicalExchange.create(rel, dist); @@ -2094,7 +2094,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, } /** Unit test for {@link RelMdUtil#linear(int, int, int, double, double)}. */ - @Test public void testLinear() { + @Test void testLinear() { assertThat(RelMdUtil.linear(0, 0, 10, 100, 200), is(100d)); assertThat(RelMdUtil.linear(5, 0, 10, 100, 200), is(150d)); assertThat(RelMdUtil.linear(6, 0, 10, 100, 200), is(160d)); @@ -2103,7 +2103,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(RelMdUtil.linear(12, 0, 10, 100, 200), is(200d)); } - @Test public void testExpressionLineageStar() { + @Test void testExpressionLineageStar() { // All columns in output final RelNode tableRel = convertSql("select * from emp"); final RelMetadataQuery mq = tableRel.getCluster().getMetadataQuery(); @@ -2117,7 +2117,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(resultString, endsWith(inputRef)); } - @Test public void testExpressionLineageTwoColumns() { + @Test void testExpressionLineageTwoColumns() { // mgr is column 3 in catalog.sales.emp // deptno is column 7 in catalog.sales.emp final RelNode rel = convertSql("select mgr, deptno from emp"); @@ -2140,7 +2140,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(result1.getIdentifier(), is(result2.getIdentifier())); } - @Test public void testExpressionLineageTwoColumnsSwapped() { + @Test void testExpressionLineageTwoColumnsSwapped() { // deptno is column 7 in catalog.sales.emp // mgr is column 3 in catalog.sales.emp final RelNode rel = convertSql("select deptno, mgr from emp"); @@ -2163,7 +2163,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(result1.getIdentifier(), is(result2.getIdentifier())); } - @Test public void testExpressionLineageCombineTwoColumns() { + @Test void testExpressionLineageCombineTwoColumns() { // empno is column 0 in catalog.sales.emp // deptno is column 7 in catalog.sales.emp final RelNode rel = convertSql("select empno + deptno from emp"); @@ -2186,7 +2186,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(inputRef1.getIdentifier(), is(inputRef2.getIdentifier())); } - @Test public void testExpressionLineageInnerJoinLeft() { + @Test void testExpressionLineageInnerJoinLeft() { // ename is column 1 in catalog.sales.emp final RelNode rel = convertSql("select ename from emp,dept"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -2199,7 +2199,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(result.getIndex(), is(1)); } - @Test public void testExpressionLineageInnerJoinRight() { + @Test void testExpressionLineageInnerJoinRight() { // ename is column 0 in catalog.sales.bonus final RelNode rel = convertSql("select bonus.ename from emp join bonus using (ename)"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -2212,7 +2212,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(result.getIndex(), is(0)); } - @Test public void testExpressionLineageLeftJoinLeft() { + @Test void testExpressionLineageLeftJoinLeft() { // ename is column 1 in catalog.sales.emp final RelNode rel = convertSql("select ename from emp left join dept using (deptno)"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -2225,7 +2225,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(result.getIndex(), is(1)); } - @Test public void testExpressionLineageRightJoinRight() { + @Test void testExpressionLineageRightJoinRight() { // ename is column 0 in catalog.sales.bonus final RelNode rel = convertSql("select bonus.ename from emp right join bonus using (ename)"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -2238,7 +2238,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(result.getIndex(), is(0)); } - @Test public void testExpressionLineageSelfJoin() { + @Test void testExpressionLineageSelfJoin() { // deptno is column 7 in catalog.sales.emp // sal is column 5 in catalog.sales.emp final RelNode rel = convertSql("select a.deptno, b.sal from (select * from emp limit 7) as a\n" @@ -2267,7 +2267,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, not(((RexTableInputRef) r2.iterator().next()).getIdentifier())); } - @Test public void testExpressionLineageOuterJoin() { + @Test void testExpressionLineageOuterJoin() { // lineage cannot be determined final RelNode rel = convertSql("select name as dname from emp left outer join dept" + " on emp.deptno = dept.deptno"); @@ -2278,7 +2278,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertNull(r); } - @Test public void testExpressionLineageFilter() { + @Test void testExpressionLineageFilter() { // ename is column 1 in catalog.sales.emp final RelNode rel = convertSql("select ename from emp where deptno = 10"); final RelNode tableRel = convertSql("select * from emp"); @@ -2293,7 +2293,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(resultString, endsWith(inputRef)); } - @Test public void testExpressionLineageAggregateGroupColumn() { + @Test void testExpressionLineageAggregateGroupColumn() { // deptno is column 7 in catalog.sales.emp final RelNode rel = convertSql("select deptno, count(*) from emp where deptno > 10 " + "group by deptno having count(*) = 0"); @@ -2309,7 +2309,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(resultString, endsWith(inputRef)); } - @Test public void testExpressionLineageAggregateAggColumn() { + @Test void testExpressionLineageAggregateAggColumn() { // lineage cannot be determined final RelNode rel = convertSql("select deptno, count(*) from emp where deptno > 10 " + "group by deptno having count(*) = 0"); @@ -2320,7 +2320,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertNull(r); } - @Test public void testExpressionLineageUnion() { + @Test void testExpressionLineageUnion() { // sal is column 5 in catalog.sales.emp final RelNode rel = convertSql("select sal from (\n" + " select * from emp union all select * from emp) " @@ -2343,7 +2343,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, not(((RexTableInputRef) it.next()).getIdentifier())); } - @Test public void testExpressionLineageMultiUnion() { + @Test void testExpressionLineageMultiUnion() { // empno is column 0 in catalog.sales.emp // sal is column 5 in catalog.sales.emp final RelNode rel = convertSql("select a.empno + b.sal from\n" @@ -2378,7 +2378,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(set.size(), is(1)); } - @Test public void testExpressionLineageValues() { + @Test void testExpressionLineageValues() { // lineage cannot be determined final RelNode rel = convertSql("select * from (values (1), (2)) as t(c)"); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); @@ -2388,7 +2388,7 @@ private void checkPredicates(RelOptCluster cluster, RelOptTable empTable, assertNull(r); } - @Test public void testAllPredicates() { + @Test void testAllPredicates() { final Project rel = (Project) convertSql("select * from emp, dept"); final Join join = (Join) rel.getInput(); final RelOptTable empTable = join.getInput(0).getTable(); @@ -2455,7 +2455,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(inputRef2.getIndex(), is(0)); } - @Test public void testAllPredicatesAggregate1() { + @Test void testAllPredicatesAggregate1() { final String sql = "select a, max(b) from (\n" + " select empno as a, sal as b from emp where empno = 5)subq\n" + "group by a"; @@ -2473,7 +2473,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(constant.toString(), is("5")); } - @Test public void testAllPredicatesAggregate2() { + @Test void testAllPredicatesAggregate2() { final String sql = "select * from (select a, max(b) from (\n" + " select empno as a, sal as b from emp)subq\n" + "group by a)\n" @@ -2492,7 +2492,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, assertThat(constant.toString(), is("5")); } - @Test public void testAllPredicatesAggregate3() { + @Test void testAllPredicatesAggregate3() { final String sql = "select * from (select a, max(b) as b from (\n" + " select empno as a, sal as b from emp)subq\n" + "group by a)\n" @@ -2504,7 +2504,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, assertNull(inputSet); } - @Test public void testAllPredicatesAndTablesJoin() { + @Test void testAllPredicatesAndTablesJoin() { final String sql = "select x.sal, y.deptno from\n" + "(select a.deptno, c.sal from (select * from emp limit 7) as a\n" + "cross join (select * from dept limit 1) as b\n" @@ -2532,7 +2532,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, + "[CATALOG, SALES, EMP].#2, [CATALOG, SALES, EMP].#3]")); } - @Test public void testAllPredicatesAndTableUnion() { + @Test void testAllPredicatesAndTableUnion() { final String sql = "select a.deptno, c.sal from (select * from emp limit 7) as a\n" + "cross join (select * from dept limit 1) as b\n" + "inner join (select * from emp limit 2) as c\n" @@ -2557,7 +2557,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, + "[CATALOG, SALES, EMP].#2, [CATALOG, SALES, EMP].#3]")); } - @Test public void testTableReferenceForIntersect() { + @Test void testTableReferenceForIntersect() { final String sql1 = "select a.deptno, a.sal from emp a\n" + "intersect all select b.deptno, b.sal from emp b where empno = 5"; final RelNode rel1 = convertSql(sql1); @@ -2575,7 +2575,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, } - @Test public void testTableReferenceForMinus() { + @Test void testTableReferenceForMinus() { final String sql = "select emp.deptno, emp.sal from emp\n" + "except all select emp.deptno, emp.sal from emp where empno = 5"; final RelNode rel = convertSql(sql); @@ -2585,7 +2585,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, equalTo("[[CATALOG, SALES, EMP].#0, [CATALOG, SALES, EMP].#1]")); } - @Test public void testAllPredicatesCrossJoinMultiTable() { + @Test void testAllPredicatesCrossJoinMultiTable() { final String sql = "select x.sal from\n" + "(select a.deptno, c.sal from (select * from emp limit 7) as a\n" + "cross join (select * from dept limit 1) as b\n" @@ -2603,7 +2603,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[=([CATALOG, SALES, EMP].#1.$0, 5), true, true]")); } - @Test public void testTableReferencesJoinUnknownNode() { + @Test void testTableReferencesJoinUnknownNode() { final String sql = "select * from emp limit 10"; final RelNode node = convertSql(sql); final RelNode nodeWithUnknown = new DummyRelNode( @@ -2618,7 +2618,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, assertNull(tableReferences); } - @Test public void testAllPredicatesUnionMultiTable() { + @Test void testAllPredicatesUnionMultiTable() { final String sql = "select x.sal from\n" + "(select a.deptno, a.sal from (select * from emp) as a\n" + "union all select emp.deptno, emp.sal from emp\n" @@ -2637,7 +2637,7 @@ private void checkAllPredicates(RelOptCluster cluster, RelOptTable empTable, sortsAs("[=([CATALOG, SALES, EMP].#2.$0, 5)]")); } - @Test public void testTableReferencesUnionUnknownNode() { + @Test void testTableReferencesUnionUnknownNode() { final String sql = "select * from emp limit 10"; final RelNode node = convertSql(sql); final RelNode nodeWithUnknown = new DummyRelNode( @@ -2663,7 +2663,7 @@ private void checkNodeTypeCount(String sql, Map, Intege assertThat(resultCount, is(expected)); } - @Test public void testNodeTypeCountEmp() { + @Test void testNodeTypeCountEmp() { final String sql = "select * from emp"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2671,7 +2671,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountDept() { + @Test void testNodeTypeCountDept() { final String sql = "select * from dept"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2679,7 +2679,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountValues() { + @Test void testNodeTypeCountValues() { final String sql = "select * from (values (1), (2)) as t(c)"; final Map, Integer> expected = new HashMap<>(); expected.put(Values.class, 1); @@ -2687,7 +2687,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountCartesian() { + @Test void testNodeTypeCountCartesian() { final String sql = "select * from emp,dept"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 2); @@ -2696,7 +2696,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountJoin() { + @Test void testNodeTypeCountJoin() { final String sql = "select * from emp\n" + "inner join dept on emp.deptno = dept.deptno"; final Map, Integer> expected = new HashMap<>(); @@ -2706,7 +2706,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountTableModify() { + @Test void testNodeTypeCountTableModify() { final String sql = "insert into emp select * from emp"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2715,7 +2715,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountExchange() { + @Test void testNodeTypeCountExchange() { final RelNode rel = convertSql("select * from emp"); final RelDistribution dist = RelDistributions.hash(ImmutableList.of()); @@ -2736,7 +2736,7 @@ private void checkNodeTypeCount(String sql, Map, Intege assertThat(expected, equalTo(resultCount)); } - @Test public void testNodeTypeCountSample() { + @Test void testNodeTypeCountSample() { final String sql = "select * from emp tablesample system(50) where empno > 5"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2746,7 +2746,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountJoinFinite() { + @Test void testNodeTypeCountJoinFinite() { final String sql = "select * from (select * from emp limit 14) as emp\n" + "inner join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -2758,7 +2758,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountJoinEmptyFinite() { + @Test void testNodeTypeCountJoinEmptyFinite() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "inner join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -2770,7 +2770,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountLeftJoinEmptyFinite() { + @Test void testNodeTypeCountLeftJoinEmptyFinite() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "left join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -2782,7 +2782,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountRightJoinEmptyFinite() { + @Test void testNodeTypeCountRightJoinEmptyFinite() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "right join (select * from dept limit 4) as dept\n" + "on emp.deptno = dept.deptno"; @@ -2794,7 +2794,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountJoinFiniteEmpty() { + @Test void testNodeTypeCountJoinFiniteEmpty() { final String sql = "select * from (select * from emp limit 7) as emp\n" + "inner join (select * from dept limit 0) as dept\n" + "on emp.deptno = dept.deptno"; @@ -2806,7 +2806,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountJoinEmptyEmpty() { + @Test void testNodeTypeCountJoinEmptyEmpty() { final String sql = "select * from (select * from emp limit 0) as emp\n" + "inner join (select * from dept limit 0) as dept\n" + "on emp.deptno = dept.deptno"; @@ -2818,7 +2818,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountUnion() { + @Test void testNodeTypeCountUnion() { final String sql = "select ename from emp\n" + "union all\n" + "select name from dept"; @@ -2829,7 +2829,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountUnionOnFinite() { + @Test void testNodeTypeCountUnionOnFinite() { final String sql = "select ename from (select * from emp limit 100)\n" + "union all\n" + "select name from (select * from dept limit 40)"; @@ -2841,7 +2841,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountMinusOnFinite() { + @Test void testNodeTypeCountMinusOnFinite() { final String sql = "select ename from (select * from emp limit 100)\n" + "except\n" + "select name from (select * from dept limit 40)"; @@ -2853,7 +2853,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountFilter() { + @Test void testNodeTypeCountFilter() { final String sql = "select * from emp where ename='Mathilda'"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2862,7 +2862,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountSort() { + @Test void testNodeTypeCountSort() { final String sql = "select * from emp order by ename"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2871,7 +2871,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountSortLimit() { + @Test void testNodeTypeCountSortLimit() { final String sql = "select * from emp order by ename limit 10"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2880,7 +2880,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountSortLimitOffset() { + @Test void testNodeTypeCountSortLimitOffset() { final String sql = "select * from emp order by ename limit 10 offset 5"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2889,7 +2889,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountSortLimitOffsetOnFinite() { + @Test void testNodeTypeCountSortLimitOffsetOnFinite() { final String sql = "select * from (select * from emp limit 12)\n" + "order by ename limit 20 offset 5"; final Map, Integer> expected = new HashMap<>(); @@ -2899,7 +2899,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountAggregate() { + @Test void testNodeTypeCountAggregate() { final String sql = "select deptno from emp group by deptno"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2908,7 +2908,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountAggregateGroupingSets() { + @Test void testNodeTypeCountAggregateGroupingSets() { final String sql = "select deptno from emp\n" + "group by grouping sets ((deptno), (ename, deptno))"; final Map, Integer> expected = new HashMap<>(); @@ -2918,7 +2918,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountAggregateEmptyKeyOnEmptyTable() { + @Test void testNodeTypeCountAggregateEmptyKeyOnEmptyTable() { final String sql = "select count(*) from (select * from emp limit 0)"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2928,7 +2928,7 @@ private void checkNodeTypeCount(String sql, Map, Intege checkNodeTypeCount(sql, expected); } - @Test public void testNodeTypeCountFilterAggregateEmptyKey() { + @Test void testNodeTypeCountFilterAggregateEmptyKey() { final String sql = "select count(*) from emp where 1 = 0"; final Map, Integer> expected = new HashMap<>(); expected.put(TableScan.class, 1); @@ -2952,7 +2952,7 @@ private void checkNodeTypeCount(String sql, Map, Intege /** Tests calling {@link RelMetadataQuery#getTableOrigin} for * an aggregate with no columns. Previously threw. */ - @Test public void testEmptyAggregateTableOrigin() { + @Test void testEmptyAggregateTableOrigin() { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); RelMetadataQuery mq = builder.getCluster().getMetadataQuery(); @@ -2964,7 +2964,7 @@ private void checkNodeTypeCount(String sql, Map, Intege assertThat(tableOrigin, nullValue()); } - @Test public void testGetPredicatesForJoin() throws Exception { + @Test void testGetPredicatesForJoin() throws Exception { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); RelNode join = builder @@ -2990,7 +2990,7 @@ private void checkNodeTypeCount(String sql, Map, Intege is("=($0, $8)")); } - @Test public void testGetPredicatesForFilter() throws Exception { + @Test void testGetPredicatesForFilter() throws Exception { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); RelNode filter = builder diff --git a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java index bb077de8eea5..c1c56354833d 100644 --- a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java +++ b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java @@ -221,7 +221,7 @@ *

  • Run the test one last time; this time it should pass. * */ -public class RelOptRulesTest extends RelOptTestBase { +class RelOptRulesTest extends RelOptTestBase { //~ Methods ---------------------------------------------------------------- private final PushProjector.ExprCondition skipItem = expr -> @@ -232,7 +232,7 @@ protected DiffRepository getDiffRepos() { return DiffRepository.lookup(RelOptRulesTest.class); } - @Test public void testReduceNot() { + @Test void testReduceNot() { HepProgram preProgram = new HepProgramBuilder() .build(); @@ -249,7 +249,7 @@ protected DiffRepository getDiffRepos() { .checkUnchanged(); } - @Test public void testReduceNestedCaseWhen() { + @Test void testReduceNestedCaseWhen() { HepProgram preProgram = new HepProgramBuilder() .build(); @@ -268,7 +268,7 @@ protected DiffRepository getDiffRepos() { .check(); } - @Test public void testDigestOfApproximateDistinctAggregateCall() { + @Test void testDigestOfApproximateDistinctAggregateCall() { HepProgram preProgram = new HepProgramBuilder() .build(); @@ -291,7 +291,7 @@ protected DiffRepository getDiffRepos() { * [CALCITE-1479] * AssertionError in ReduceExpressionsRule on multi-column IN * sub-query. */ - @Test public void testReduceCompositeInSubQuery() { + @Test void testReduceCompositeInSubQuery() { final HepProgram hepProgram = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .build(); @@ -311,7 +311,7 @@ protected DiffRepository getDiffRepos() { /** Test case for * [CALCITE-2865] * FilterProjectTransposeRule generates wrong traitSet when copyFilter/Project is true. */ - @Test public void testFilterProjectTransposeRule() { + @Test void testFilterProjectTransposeRule() { List rules = Arrays.asList( FilterProjectTransposeRule.INSTANCE, // default: copyFilter=true, copyProject=true new FilterProjectTransposeRule(Filter.class, Project.class, @@ -344,7 +344,7 @@ protected DiffRepository getDiffRepos() { } } - @Test public void testReduceOrCaseWhen() { + @Test void testReduceOrCaseWhen() { HepProgram preProgram = new HepProgramBuilder() .build(); @@ -362,7 +362,7 @@ protected DiffRepository getDiffRepos() { .check(); } - @Test public void testReduceNullableCase() { + @Test void testReduceNullableCase() { HepProgramBuilder builder = new HepProgramBuilder(); builder.addRuleClass(ReduceExpressionsRule.class); HepPlanner hepPlanner = new HepPlanner(builder.build()); @@ -374,7 +374,7 @@ protected DiffRepository getDiffRepos() { sql(sql).with(hepPlanner).checkUnchanged(); } - @Test public void testReduceNullableCase2() { + @Test void testReduceNullableCase2() { HepProgramBuilder builder = new HepProgramBuilder(); builder.addRuleClass(ReduceExpressionsRule.class); HepPlanner hepPlanner = new HepPlanner(builder.build()); @@ -386,7 +386,7 @@ protected DiffRepository getDiffRepos() { sql(sql).with(hepPlanner).checkUnchanged(); } - @Test public void testProjectToWindowRuleForMultipleWindows() { + @Test void testProjectToWindowRuleForMultipleWindows() { HepProgram preProgram = new HepProgramBuilder() .build(); @@ -406,29 +406,29 @@ protected DiffRepository getDiffRepos() { .check(); } - @Test public void testUnionToDistinctRule() { + @Test void testUnionToDistinctRule() { final String sql = "select * from dept union select * from dept"; sql(sql).withRule(UnionToDistinctRule.INSTANCE).check(); } - @Test public void testExtractJoinFilterRule() { + @Test void testExtractJoinFilterRule() { final String sql = "select 1 from emp inner join dept on emp.deptno=dept.deptno"; sql(sql).withRule(JoinExtractFilterRule.INSTANCE).check(); } - @Test public void testNotPushExpression() { + @Test void testNotPushExpression() { final String sql = "select 1 from emp inner join dept\n" + "on emp.deptno=dept.deptno and emp.ename is not null"; sql(sql).withRule(JoinPushExpressionsRule.INSTANCE) .checkUnchanged(); } - @Test public void testAddRedundantSemiJoinRule() { + @Test void testAddRedundantSemiJoinRule() { final String sql = "select 1 from emp inner join dept on emp.deptno = dept.deptno"; sql(sql).withRule(JoinAddRedundantSemiJoinRule.INSTANCE).check(); } - @Test public void testStrengthenJoinType() { + @Test void testStrengthenJoinType() { // The "Filter(... , right.c IS NOT NULL)" above a left join is pushed into // the join, makes it an inner join, and then disappears because c is NOT // NULL. @@ -455,7 +455,7 @@ protected DiffRepository getDiffRepos() { /** Test case for * [CALCITE-3170] * ANTI join on conditions push down generates wrong plan. */ - @Test public void testCanNotPushAntiJoinConditionsToLeft() { + @Test void testCanNotPushAntiJoinConditionsToLeft() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: // select * from emp @@ -489,7 +489,7 @@ protected DiffRepository getDiffRepos() { SqlToRelTestBase.assertValid(output); } - @Test public void testCanNotPushAntiJoinConditionsToRight() { + @Test void testCanNotPushAntiJoinConditionsToRight() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: // select * from emp @@ -523,7 +523,7 @@ protected DiffRepository getDiffRepos() { /** Test case for * [CALCITE-3171] * SemiJoin on conditions push down throws IndexOutOfBoundsException. */ - @Test public void testPushSemiJoinConditionsToLeft() { + @Test void testPushSemiJoinConditionsToLeft() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: // select * from emp @@ -557,42 +557,42 @@ protected DiffRepository getDiffRepos() { SqlToRelTestBase.assertValid(output); } - @Test public void testFullOuterJoinSimplificationToLeftOuter() { + @Test void testFullOuterJoinSimplificationToLeftOuter() { final String sql = "select 1 from sales.dept d full outer join sales.emp e\n" + "on d.deptno = e.deptno\n" + "where d.name = 'Charlie'"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN).check(); } - @Test public void testFullOuterJoinSimplificationToRightOuter() { + @Test void testFullOuterJoinSimplificationToRightOuter() { final String sql = "select 1 from sales.dept d full outer join sales.emp e\n" + "on d.deptno = e.deptno\n" + "where e.sal > 100"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN).check(); } - @Test public void testFullOuterJoinSimplificationToInner() { + @Test void testFullOuterJoinSimplificationToInner() { final String sql = "select 1 from sales.dept d full outer join sales.emp e\n" + "on d.deptno = e.deptno\n" + "where d.name = 'Charlie' and e.sal > 100"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN).check(); } - @Test public void testLeftOuterJoinSimplificationToInner() { + @Test void testLeftOuterJoinSimplificationToInner() { final String sql = "select 1 from sales.dept d left outer join sales.emp e\n" + "on d.deptno = e.deptno\n" + "where e.sal > 100"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN).check(); } - @Test public void testRightOuterJoinSimplificationToInner() { + @Test void testRightOuterJoinSimplificationToInner() { final String sql = "select 1 from sales.dept d right outer join sales.emp e\n" + "on d.deptno = e.deptno\n" + "where d.name = 'Charlie'"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN).check(); } - @Test public void testPushAboveFiltersIntoInnerJoinCondition() { + @Test void testPushAboveFiltersIntoInnerJoinCondition() { final String sql = "" + "select * from sales.dept d inner join sales.emp e\n" + "on d.deptno = e.deptno and d.deptno > e.mgr\n" @@ -603,7 +603,7 @@ protected DiffRepository getDiffRepos() { /** Test case for * [CALCITE-3225] * JoinToMultiJoinRule should not match SEMI/ANTI LogicalJoin. */ - @Test public void testJoinToMultiJoinDoesNotMatchSemiJoin() { + @Test void testJoinToMultiJoinDoesNotMatchSemiJoin() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: // select * from @@ -643,7 +643,7 @@ protected DiffRepository getDiffRepos() { /** Test case for * [CALCITE-3225] * JoinToMultiJoinRule should not match SEMI/ANTI LogicalJoin. */ - @Test public void testJoinToMultiJoinDoesNotMatchAntiJoin() { + @Test void testJoinToMultiJoinDoesNotMatchAntiJoin() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: // select * from @@ -680,7 +680,7 @@ protected DiffRepository getDiffRepos() { SqlToRelTestBase.assertValid(output); } - @Test public void testPushFilterPastAgg() { + @Test void testPushFilterPastAgg() { final String sql = "select dname, c from\n" + "(select name dname, count(*) as c from dept group by name) t\n" + " where dname = 'Charlie'"; @@ -707,18 +707,18 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } } - @Test public void testPushFilterPastAggWithGroupingSets1() throws Exception { + @Test void testPushFilterPastAggWithGroupingSets1() throws Exception { basePushFilterPastAggWithGroupingSets(true); } - @Test public void testPushFilterPastAggWithGroupingSets2() throws Exception { + @Test void testPushFilterPastAggWithGroupingSets2() throws Exception { basePushFilterPastAggWithGroupingSets(false); } /** Test case for * [CALCITE-434] * FilterAggregateTransposeRule loses conditions that cannot be pushed. */ - @Test public void testPushFilterPastAggTwo() { + @Test void testPushFilterPastAggTwo() { final String sql = "select dept1.c1 from (\n" + "select dept.name as c1, count(*) as c2\n" + "from dept where dept.name > 'b' group by dept.name) dept1\n" @@ -729,7 +729,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-799] * Incorrect result for {@code HAVING count(*) > 1}. */ - @Test public void testPushFilterPastAggThree() { + @Test void testPushFilterPastAggThree() { final String sql = "select deptno from emp\n" + "group by deptno having count(*) > 1"; sql(sql).withRule(FilterAggregateTransposeRule.INSTANCE) @@ -739,7 +739,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-1109] * FilterAggregateTransposeRule pushes down incorrect condition. */ - @Test public void testPushFilterPastAggFour() { + @Test void testPushFilterPastAggFour() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -760,7 +760,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-448] * FilterIntoJoinRule creates filters containing invalid RexInputRef. */ - @Test public void testPushFilterPastProject() { + @Test void testPushFilterPastProject() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -789,7 +789,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testJoinProjectTranspose1() { + @Test void testJoinProjectTranspose1() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(ProjectJoinTransposeRule.INSTANCE) @@ -816,7 +816,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-1338] * JoinProjectTransposeRule should not pull a literal above the * null-generating side of a join. */ - @Test public void testJoinProjectTranspose2() { + @Test void testJoinProjectTranspose2() { final String sql = "select *\n" + "from dept a\n" + "left join (select name, 1 from dept) as b\n" @@ -828,7 +828,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testJoinProjectTranspose2()}; * should not transpose since the left project of right join has literal. */ - @Test public void testJoinProjectTranspose3() { + @Test void testJoinProjectTranspose3() { final String sql = "select *\n" + "from (select name, 1 from dept) as a\n" + "right join dept b\n" @@ -841,7 +841,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testJoinProjectTranspose2()}; * should not transpose since the right project of left join has not-strong * expression {@code y is not null}. */ - @Test public void testJoinProjectTranspose4() { + @Test void testJoinProjectTranspose4() { final String sql = "select *\n" + "from dept a\n" + "left join (select x name, y is not null from\n" @@ -855,7 +855,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testJoinProjectTranspose2()}; * should not transpose since the right project of left join has not-strong * expression {@code 1 + 1}. */ - @Test public void testJoinProjectTranspose5() { + @Test void testJoinProjectTranspose5() { final String sql = "select *\n" + "from dept a\n" + "left join (select name, 1 + 1 from dept) as b\n" @@ -868,7 +868,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testJoinProjectTranspose2()}; * should not transpose since both the left project and right project have * literal. */ - @Test public void testJoinProjectTranspose6() { + @Test void testJoinProjectTranspose6() { final String sql = "select *\n" + "from (select name, 1 from dept) a\n" + "full join (select name, 1 from dept) as b\n" @@ -881,7 +881,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testJoinProjectTranspose2()}; * Should transpose since all expressions in the right project of left join * are strong. */ - @Test public void testJoinProjectTranspose7() { + @Test void testJoinProjectTranspose7() { final String sql = "select *\n" + "from dept a\n" + "left join (select name from dept) as b\n" @@ -895,7 +895,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * should transpose since all expressions including * {@code deptno > 10 and cast(null as boolean)} in the right project of left * join are strong. */ - @Test public void testJoinProjectTranspose8() { + @Test void testJoinProjectTranspose8() { final String sql = "select *\n" + "from dept a\n" + "left join (\n" @@ -907,7 +907,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testJoinProjectTransposeWindow() { + @Test void testJoinProjectTransposeWindow() { final String sql = "select *\n" + "from dept a\n" + "join (select rank() over (order by name) as r, 1 + 1 from dept) as b\n" @@ -922,7 +922,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-3353] * ProjectJoinTransposeRule caused AssertionError when creating a new Join. */ - @Test public void testProjectJoinTransposeWithMergeJoin() { + @Test void testProjectJoinTransposeWithMergeJoin() { ProjectJoinTransposeRule testRule = new ProjectJoinTransposeRule( Project.class, Join.class, expr -> !(expr instanceof RexOver), RelFactories.LOGICAL_BUILDER); @@ -965,7 +965,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-889] * Implement SortUnionTransposeRule. */ - @Test public void testSortUnionTranspose() { + @Test void testSortUnionTranspose() { final HepProgram program = HepProgram.builder() .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) @@ -981,7 +981,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-889] * Implement SortUnionTransposeRule. */ - @Test public void testSortUnionTranspose2() { + @Test void testSortUnionTranspose2() { final HepProgram program = HepProgram.builder() .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) @@ -997,7 +997,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-987] * Push limit 0 will result in an infinite loop. */ - @Test public void testSortUnionTranspose3() { + @Test void testSortUnionTranspose3() { final HepProgram program = HepProgram.builder() .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) @@ -1010,7 +1010,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testSortRemovalAllKeysConstant() { + @Test void testSortRemovalAllKeysConstant() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(SortRemoveConstantKeysRule.INSTANCE) .build(); @@ -1022,7 +1022,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testSortRemovalOneKeyConstant() { + @Test void testSortRemovalOneKeyConstant() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(SortRemoveConstantKeysRule.INSTANCE) .build(); @@ -1034,7 +1034,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testSemiJoinRuleExists() { + @Test void testSemiJoinRuleExists() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) @@ -1057,7 +1057,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testSemiJoinRule() { + @Test void testSemiJoinRule() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) @@ -1082,7 +1082,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-1495] * SemiJoinRule should not apply to RIGHT and FULL JOIN. */ - @Test public void testSemiJoinRuleRight() { + @Test void testSemiJoinRuleRight() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) @@ -1105,7 +1105,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } /** Similar to {@link #testSemiJoinRuleRight()} but FULL. */ - @Test public void testSemiJoinRuleFull() { + @Test void testSemiJoinRuleFull() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) @@ -1128,7 +1128,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } /** Similar to {@link #testSemiJoinRule()} but LEFT. */ - @Test public void testSemiJoinRuleLeft() { + @Test void testSemiJoinRuleLeft() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) @@ -1153,7 +1153,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-438] * Push predicates through SemiJoin. */ - @Test public void testPushFilterThroughSemiJoin() { + @Test void testPushFilterThroughSemiJoin() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(SemiJoinRule.PROJECT) @@ -1181,7 +1181,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-571] * ReduceExpressionsRule tries to reduce SemiJoin condition to non-equi * condition. */ - @Test public void testSemiJoinReduceConstants() { + @Test void testSemiJoinReduceConstants() { final HepProgram preProgram = HepProgram.builder() .addRuleInstance(SemiJoinRule.PROJECT) .build(); @@ -1200,7 +1200,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testSemiJoinTrim() throws Exception { + @Test void testSemiJoinTrim() throws Exception { final DiffRepository diffRepos = getDiffRepos(); String sql = diffRepos.expand(null, "${sql}"); @@ -1245,7 +1245,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testReduceAverage() { + @Test void testReduceAverage() { final String sql = "select name, max(name), avg(deptno), min(name)\n" + "from sales.dept group by name"; sql(sql).withRule(AggregateReduceFunctionsRule.INSTANCE).check(); @@ -1254,7 +1254,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-1621] * Adding a cast around the null literal in aggregate rules. */ - @Test public void testCastInAggregateReduceFunctions() { + @Test void testCastInAggregateReduceFunctions() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateReduceFunctionsRule.INSTANCE) @@ -1265,7 +1265,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountWithoutGroupBy() { + @Test void testDistinctCountWithoutGroupBy() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1275,7 +1275,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCount1() { + @Test void testDistinctCount1() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1285,7 +1285,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCount2() { + @Test void testDistinctCount2() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1299,7 +1299,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-1293] * Bad code generated when argument to COUNT(DISTINCT) is a # GROUP BY * column. */ - @Test public void testDistinctCount3() { + @Test void testDistinctCount3() { final String sql = "select count(distinct deptno), sum(sal)" + " from sales.emp group by deptno"; final HepProgram program = HepProgram.builder() @@ -1309,7 +1309,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } /** Tests implementing multiple distinct count the old way, using a join. */ - @Test public void testDistinctCountMultipleViaJoin() { + @Test void testDistinctCountMultipleViaJoin() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1322,7 +1322,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests implementing multiple distinct count the new way, using GROUPING * SETS. */ - @Test public void testDistinctCountMultiple() { + @Test void testDistinctCountMultiple() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1332,7 +1332,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountMultipleNoGroup() { + @Test void testDistinctCountMultipleNoGroup() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1342,7 +1342,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountMixedJoin() { + @Test void testDistinctCountMixedJoin() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1353,7 +1353,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountMixed() { + @Test void testDistinctCountMixed() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -1363,7 +1363,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountMixed2() { + @Test void testDistinctCountMixed2() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(AggregateProjectMergeRule.INSTANCE) @@ -1377,7 +1377,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountGroupingSets1() { + @Test void testDistinctCountGroupingSets1() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -1387,7 +1387,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctCountGroupingSets2() { + @Test void testDistinctCountGroupingSets2() { final HepProgram program = HepProgram.builder() .addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -1397,7 +1397,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctNonDistinctAggregates() { + @Test void testDistinctNonDistinctAggregates() { final String sql = "select emp.empno, count(*), avg(distinct dept.deptno)\n" + "from sales.emp emp inner join sales.dept dept\n" + "on emp.deptno = dept.deptno\n" @@ -1411,7 +1411,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-1621] * Adding a cast around the null literal in aggregate rules. */ - @Test public void testCastInAggregateExpandDistinctAggregatesRule() { + @Test void testCastInAggregateExpandDistinctAggregatesRule() { final String sql = "select name, sum(distinct cn), sum(distinct sm)\n" + "from (\n" + " select name, count(dept.deptno) as cn,sum(dept.deptno) as sm\n" @@ -1427,7 +1427,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-1558] * AggregateExpandDistinctAggregatesRule gets field mapping wrong if groupKey * is used in aggregate function. */ - @Test public void testDistinctNonDistinctAggregatesWithGrouping1() { + @Test void testDistinctNonDistinctAggregatesWithGrouping1() { final String sql = "SELECT deptno,\n" + " SUM(deptno), SUM(DISTINCT sal), MAX(deptno), MAX(comm)\n" + "FROM emp\n" @@ -1438,7 +1438,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctNonDistinctAggregatesWithGrouping2() { + @Test void testDistinctNonDistinctAggregatesWithGrouping2() { final String sql = "SELECT deptno, COUNT(deptno), SUM(DISTINCT sal)\n" + "FROM emp\n" + "GROUP BY deptno"; @@ -1448,7 +1448,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctNonDistinctTwoAggregatesWithGrouping() { + @Test void testDistinctNonDistinctTwoAggregatesWithGrouping() { final String sql = "SELECT deptno, SUM(comm), MIN(comm), SUM(DISTINCT sal)\n" + "FROM emp\n" + "GROUP BY deptno"; @@ -1458,7 +1458,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctWithGrouping() { + @Test void testDistinctWithGrouping() { final String sql = "SELECT sal, SUM(comm), MIN(comm), SUM(DISTINCT sal)\n" + "FROM emp\n" + "GROUP BY sal"; @@ -1468,7 +1468,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testRemoveDistinctOnAgg() { + @Test void testRemoveDistinctOnAgg() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -1480,7 +1480,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testMultipleDistinctWithGrouping() { + @Test void testMultipleDistinctWithGrouping() { final String sql = "SELECT sal, SUM(comm), AVG(DISTINCT comm), SUM(DISTINCT sal)\n" + "FROM emp\n" + "GROUP BY sal"; @@ -1490,7 +1490,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctWithMultipleInputs() { + @Test void testDistinctWithMultipleInputs() { final String sql = "SELECT deptno, SUM(comm), MIN(comm), COUNT(DISTINCT sal, comm)\n" + "FROM emp\n" + "GROUP BY deptno"; @@ -1500,7 +1500,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctWithMultipleInputsAndGroupby() { + @Test void testDistinctWithMultipleInputsAndGroupby() { final String sql = "SELECT deptno, SUM(comm), MIN(comm), COUNT(DISTINCT sal, deptno, comm)\n" + "FROM emp\n" + "GROUP BY deptno"; @@ -1510,7 +1510,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctWithFilterWithoutGroupBy() { + @Test void testDistinctWithFilterWithoutGroupBy() { final String sql = "SELECT SUM(comm), COUNT(DISTINCT sal) FILTER (WHERE sal > 1000)\n" + "FROM emp"; HepProgram program = new HepProgramBuilder() @@ -1519,7 +1519,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctWithDiffFiltersAndSameGroupSet() { + @Test void testDistinctWithDiffFiltersAndSameGroupSet() { final String sql = "SELECT COUNT(DISTINCT c) FILTER (WHERE d),\n" + "COUNT(DISTINCT d) FILTER (WHERE c)\n" + "FROM (select sal > 1000 is true as c, sal < 500 is true as d, comm from emp)"; @@ -1529,7 +1529,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testDistinctWithFilterAndGroupBy() { + @Test void testDistinctWithFilterAndGroupBy() { final String sql = "SELECT deptno, SUM(comm), COUNT(DISTINCT sal) FILTER (WHERE sal > 1000)\n" + "FROM emp\n" + "GROUP BY deptno"; @@ -1539,7 +1539,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testPushProjectPastFilter() { + @Test void testPushProjectPastFilter() { final String sql = "select empno + deptno from emp where sal = 10 * comm\n" + "and upper(ename) = 'FOO'"; sql(sql).withRule(ProjectFilterTransposeRule.INSTANCE).check(); @@ -1549,14 +1549,14 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-1778] * Query with "WHERE CASE" throws AssertionError "Cast for just nullability * not allowed". */ - @Test public void testPushProjectPastFilter2() { + @Test void testPushProjectPastFilter2() { final String sql = "select count(*)\n" + "from emp\n" + "where case when mgr < 10 then true else false end"; sql(sql).withRule(ProjectFilterTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastJoin() { + @Test void testPushProjectPastJoin() { final String sql = "select e.sal + b.comm from emp e inner join bonus b\n" + "on e.ename = b.ename and e.deptno = 10"; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); @@ -1566,13 +1566,13 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-3004] * Should not push over past union but its operands can since setop * will affect row count. */ - @Test public void testProjectSetOpTranspose() { + @Test void testProjectSetOpTranspose() { final String sql = "select job, sum(sal + 100) over (partition by deptno) from\n" + "(select * from emp e1 union all select * from emp e2)"; sql(sql).withRule(ProjectSetOpTransposeRule.INSTANCE).check(); } - @Test public void testProjectCorrelateTransposeDynamic() { + @Test void testProjectCorrelateTransposeDynamic() { ProjectCorrelateTransposeRule customPCTrans = new ProjectCorrelateTransposeRule(skipItem, RelFactories.LOGICAL_BUILDER); @@ -1587,7 +1587,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .checkUnchanged(); } - @Test public void testProjectCorrelateTransposeRuleLeftCorrelate() { + @Test void testProjectCorrelateTransposeRuleLeftCorrelate() { final String sql = "SELECT e1.empno\n" + "FROM emp e1 " + "where exists (select empno, deptno from dept d2 where e1.deptno = d2.deptno)"; @@ -1603,7 +1603,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testProjectCorrelateTransposeRuleSemiCorrelate() { + @Test void testProjectCorrelateTransposeRuleSemiCorrelate() { RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); RelNode left = relBuilder .values(new String[]{"f", "f2"}, "1", "2").build(); @@ -1642,7 +1642,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) SqlToRelTestBase.assertValid(output); } - @Test public void testProjectCorrelateTransposeRuleAntiCorrelate() { + @Test void testProjectCorrelateTransposeRuleAntiCorrelate() { RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); RelNode left = relBuilder .values(new String[]{"f", "f2"}, "1", "2").build(); @@ -1679,7 +1679,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) SqlToRelTestBase.assertValid(output); } - @Test public void testProjectCorrelateTransposeWithExprCond() { + @Test void testProjectCorrelateTransposeWithExprCond() { ProjectCorrelateTransposeRule customPCTrans = new ProjectCorrelateTransposeRule(skipItem, RelFactories.LOGICAL_BUILDER); @@ -1689,7 +1689,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).withRule(customPCTrans).check(); } - @Test public void testProjectCorrelateTranspose() { + @Test void testProjectCorrelateTranspose() { ProjectCorrelateTransposeRule customPCTrans = new ProjectCorrelateTransposeRule(expr -> true, RelFactories.LOGICAL_BUILDER); @@ -1702,7 +1702,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testProjectSetOpTranspose()}; * should not push over past correlate but its operands can since correlate * will affect row count. */ - @Test public void testProjectCorrelateTransposeWithOver() { + @Test void testProjectCorrelateTransposeWithOver() { final String sql = "select sum(t1.deptno + 1) over (partition by t1.name),\n" + "count(t2.empno) over ()\n" + "from DEPT_NESTED as t1,\n" @@ -1714,7 +1714,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * does not push a Filter that contains a correlating variable. * * @see #testFilterProjectTranspose() */ - @Test public void testFilterProjectTransposePreventedByCorrelation() { + @Test void testFilterProjectTransposePreventedByCorrelation() { final String sql = "SELECT e.empno\n" + "FROM emp as e\n" + "WHERE exists (\n" @@ -1735,7 +1735,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests a variant of {@link FilterProjectTransposeRule} * that pushes a Filter that contains a correlating variable. */ - @Test public void testFilterProjectTranspose() { + @Test void testFilterProjectTranspose() { final String sql = "SELECT e.empno\n" + "FROM emp as e\n" + "WHERE exists (\n" @@ -1768,49 +1768,49 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-1753] * PushProjector should only preserve expressions if the expression is strong * when pushing into the nullable-side of outer join. */ - @Test public void testPushProjectPastInnerJoin() { + @Test void testPushProjectPastInnerJoin() { final String sql = "select count(*), " + NOT_STRONG_EXPR + "\n" + "from emp e inner join bonus b on e.ename = b.ename\n" + "group by " + NOT_STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastInnerJoinStrong() { + @Test void testPushProjectPastInnerJoinStrong() { final String sql = "select count(*), " + STRONG_EXPR + "\n" + "from emp e inner join bonus b on e.ename = b.ename\n" + "group by " + STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastLeftJoin() { + @Test void testPushProjectPastLeftJoin() { final String sql = "select count(*), " + NOT_STRONG_EXPR + "\n" + "from emp e left outer join bonus b on e.ename = b.ename\n" + "group by case when e.sal < 11 then 11 else -1 * e.sal end"; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastLeftJoinSwap() { + @Test void testPushProjectPastLeftJoinSwap() { final String sql = "select count(*), " + NOT_STRONG_EXPR + "\n" + "from bonus b left outer join emp e on e.ename = b.ename\n" + "group by " + NOT_STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastLeftJoinSwapStrong() { + @Test void testPushProjectPastLeftJoinSwapStrong() { final String sql = "select count(*), " + STRONG_EXPR + "\n" + "from bonus b left outer join emp e on e.ename = b.ename\n" + "group by " + STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastRightJoin() { + @Test void testPushProjectPastRightJoin() { final String sql = "select count(*), " + NOT_STRONG_EXPR + "\n" + "from emp e right outer join bonus b on e.ename = b.ename\n" + "group by " + NOT_STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastRightJoinStrong() { + @Test void testPushProjectPastRightJoinStrong() { final String sql = "select count(*),\n" + " case when e.sal < 11 then -1 * e.sal else e.sal end\n" + "from emp e right outer join bonus b on e.ename = b.ename\n" @@ -1818,28 +1818,28 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastRightJoinSwap() { + @Test void testPushProjectPastRightJoinSwap() { final String sql = "select count(*), " + NOT_STRONG_EXPR + "\n" + "from bonus b right outer join emp e on e.ename = b.ename\n" + "group by " + NOT_STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastRightJoinSwapStrong() { + @Test void testPushProjectPastRightJoinSwapStrong() { final String sql = "select count(*), " + STRONG_EXPR + "\n" + "from bonus b right outer join emp e on e.ename = b.ename\n" + "group by " + STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastFullJoin() { + @Test void testPushProjectPastFullJoin() { final String sql = "select count(*), " + NOT_STRONG_EXPR + "\n" + "from emp e full outer join bonus b on e.ename = b.ename\n" + "group by " + NOT_STRONG_EXPR; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastFullJoinStrong() { + @Test void testPushProjectPastFullJoinStrong() { final String sql = "select count(*), " + STRONG_EXPR + "\n" + "from emp e full outer join bonus b on e.ename = b.ename\n" + "group by " + STRONG_EXPR; @@ -1850,7 +1850,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) * [CALCITE-2343] * Should not push over whose columns are all from left child past join since * join will affect row count.. */ - @Test public void testPushProjectWithOverPastJoin1() { + @Test void testPushProjectWithOverPastJoin1() { final String sql = "select e.sal + b.comm,\n" + "count(e.empno) over (partition by e.deptno)\n" + "from emp e join bonus b\n" @@ -1861,7 +1861,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testPushProjectWithOverPastJoin1()}; * should not push over whose columns are all from right child past join since * join will affect row count. */ - @Test public void testPushProjectWithOverPastJoin2() { + @Test void testPushProjectWithOverPastJoin2() { final String sql = "select e.sal + b.comm,\n" + "count(b.sal) over (partition by b.job)\n" + "from emp e join bonus b\n" @@ -1872,7 +1872,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** As {@link #testPushProjectWithOverPastJoin2()}; * should not push over past join but should push the operands of over past * join. */ - @Test public void testPushProjectWithOverPastJoin3() { + @Test void testPushProjectWithOverPastJoin3() { final String sql = "select e.sal + b.comm,\n" + "sum(b.sal + b.sal + 100) over (partition by b.job)\n" + "from emp e join bonus b\n" @@ -1880,27 +1880,27 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testPushProjectPastSetOp() { + @Test void testPushProjectPastSetOp() { final String sql = "select sal from\n" + "(select * from emp e1 union all select * from emp e2)"; sql(sql).withRule(ProjectSetOpTransposeRule.INSTANCE).check(); } - @Test public void testPushJoinThroughUnionOnLeft() { + @Test void testPushJoinThroughUnionOnLeft() { final String sql = "select r1.sal from\n" + "(select * from emp e1 union all select * from emp e2) r1,\n" + "emp r2"; sql(sql).withRule(JoinUnionTransposeRule.LEFT_UNION).check(); } - @Test public void testPushJoinThroughUnionOnRight() { + @Test void testPushJoinThroughUnionOnRight() { final String sql = "select r1.sal from\n" + "emp r1,\n" + "(select * from emp e1 union all select * from emp e2) r2"; sql(sql).withRule(JoinUnionTransposeRule.RIGHT_UNION).check(); } - @Test public void testPushJoinThroughUnionOnRightDoesNotMatchSemiJoin() { + @Test void testPushJoinThroughUnionOnRightDoesNotMatchSemiJoin() { final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: @@ -1947,7 +1947,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) SqlToRelTestBase.assertValid(output); } - @Test public void testPushJoinThroughUnionOnRightDoesNotMatchAntiJoin() { + @Test void testPushJoinThroughUnionOnRightDoesNotMatchAntiJoin() { final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: @@ -1994,7 +1994,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) SqlToRelTestBase.assertValid(output); } - @Test public void testMergeFilterWithJoinCondition() throws Exception { + @Test void testMergeFilterWithJoinCondition() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(JoinExtractFilterRule.INSTANCE) .addRuleInstance(FilterToCalcRule.INSTANCE) @@ -2010,7 +2010,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } /** Tests that filters are combined if they are identical. */ - @Test public void testMergeFilter() throws Exception { + @Test void testMergeFilter() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) .addRuleInstance(FilterMergeRule.INSTANCE) @@ -2025,7 +2025,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } /** Tests to see if the final branch of union is missed */ - @Test public void testUnionMergeRule() throws Exception { + @Test void testUnionMergeRule() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) .addRuleInstance(ProjectRemoveRule.INSTANCE) @@ -2049,7 +2049,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testMinusMergeRule() throws Exception { + @Test void testMinusMergeRule() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) .addRuleInstance(ProjectRemoveRule.INSTANCE) @@ -2080,7 +2080,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests that a filters is combined are combined if they are identical, * even if one of them originates in an ON clause of a JOIN. */ - @Test public void testMergeJoinFilter() throws Exception { + @Test void testMergeJoinFilter() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) .addRuleInstance(FilterMergeRule.INSTANCE) @@ -2099,7 +2099,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests {@link UnionMergeRule}, which merges 2 {@link Union} operators into * a single {@code Union} with 3 inputs. */ - @Test public void testMergeUnionAll() throws Exception { + @Test void testMergeUnionAll() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INSTANCE) .build(); @@ -2115,7 +2115,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests {@link UnionMergeRule}, which merges 2 {@link Union} * {@code DISTINCT} (not {@code ALL}) operators into a single * {@code Union} with 3 inputs. */ - @Test public void testMergeUnionDistinct() throws Exception { + @Test void testMergeUnionDistinct() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INSTANCE) .build(); @@ -2130,7 +2130,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests that {@link UnionMergeRule} does nothing if its arguments have * different {@code ALL} settings. */ - @Test public void testMergeUnionMixed() throws Exception { + @Test void testMergeUnionMixed() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INSTANCE) .build(); @@ -2146,7 +2146,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests that {@link UnionMergeRule} converts all inputs to DISTINCT * if the top one is DISTINCT. * (Since UNION is left-associative, the "top one" is the rightmost.) */ - @Test public void testMergeUnionMixed2() throws Exception { + @Test void testMergeUnionMixed2() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INSTANCE) .build(); @@ -2161,7 +2161,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests that {@link UnionMergeRule} does nothing if its arguments have * are different set operators, {@link Union} and {@link Intersect}. */ - @Test public void testMergeSetOpMixed() throws Exception { + @Test void testMergeSetOpMixed() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INSTANCE) .addRuleInstance(UnionMergeRule.INTERSECT_INSTANCE) @@ -2178,7 +2178,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests {@link UnionMergeRule#INTERSECT_INSTANCE}, which merges 2 * {@link Intersect} operators into a single {@code Intersect} with 3 * inputs. */ - @Test public void testMergeIntersect() throws Exception { + @Test void testMergeIntersect() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INTERSECT_INSTANCE) .build(); @@ -2193,7 +2193,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests {@link org.apache.calcite.rel.rules.IntersectToDistinctRule}, * which rewrites an {@link Intersect} operator with 3 inputs. */ - @Test public void testIntersectToDistinct() throws Exception { + @Test void testIntersectToDistinct() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INTERSECT_INSTANCE) .addRuleInstance(IntersectToDistinctRule.INSTANCE) @@ -2210,7 +2210,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests that {@link org.apache.calcite.rel.rules.IntersectToDistinctRule} * correctly ignores an {@code INTERSECT ALL}. It can only handle * {@code INTERSECT DISTINCT}. */ - @Test public void testIntersectToDistinctAll() throws Exception { + @Test void testIntersectToDistinctAll() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.INTERSECT_INSTANCE) .addRuleInstance(IntersectToDistinctRule.INSTANCE) @@ -2227,7 +2227,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests {@link UnionMergeRule#MINUS_INSTANCE}, which merges 2 * {@link Minus} operators into a single {@code Minus} with 3 * inputs. */ - @Test public void testMergeMinus() throws Exception { + @Test void testMergeMinus() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.MINUS_INSTANCE) .build(); @@ -2243,7 +2243,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Tests {@link UnionMergeRule#MINUS_INSTANCE} * does not merge {@code Minus(a, Minus(b, c))} * into {@code Minus(a, b, c)}, which would be incorrect. */ - @Test public void testMergeMinusRightDeep() throws Exception { + @Test void testMergeMinusRightDeep() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(UnionMergeRule.MINUS_INSTANCE) .build(); @@ -2257,7 +2257,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).checkUnchanged(); } - @Test public void testHeterogeneousConversion() throws Exception { + @Test void testHeterogeneousConversion() throws Exception { // This one tests the planner's ability to correctly // apply different converters on top of a common // sub-expression. The common sub-expression is the @@ -2276,7 +2276,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testPushSemiJoinPastJoinRuleLeft() throws Exception { + @Test void testPushSemiJoinPastJoinRuleLeft() throws Exception { // tests the case where the semijoin is pushed to the left final String sql = "select e1.ename from emp e1, dept d, emp e2\n" + "where e1.deptno = d.deptno and e1.empno = e2.empno"; @@ -2286,7 +2286,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testPushSemiJoinPastJoinRuleRight() throws Exception { + @Test void testPushSemiJoinPastJoinRuleRight() throws Exception { // tests the case where the semijoin is pushed to the right final String sql = "select e1.ename from emp e1, dept d, emp e2\n" + "where e1.deptno = d.deptno and d.deptno = e2.deptno"; @@ -2296,7 +2296,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testPushSemiJoinPastFilter() throws Exception { + @Test void testPushSemiJoinPastFilter() throws Exception { final String sql = "select e.ename from emp e, dept d\n" + "where e.deptno = d.deptno and e.ename = 'foo'"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN, @@ -2305,7 +2305,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testConvertMultiJoinRule() throws Exception { + @Test void testConvertMultiJoinRule() throws Exception { final String sql = "select e1.ename from emp e1, dept d, emp e2\n" + "where e1.deptno = d.deptno and d.deptno = e2.deptno"; HepProgram program = new HepProgramBuilder() @@ -2316,7 +2316,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testManyFiltersOnTopOfMultiJoinShouldCollapse() throws Exception { + @Test void testManyFiltersOnTopOfMultiJoinShouldCollapse() throws Exception { HepProgram program = new HepProgramBuilder() .addMatchOrder(HepMatchOrder.BOTTOM_UP) .addRuleInstance(JoinToMultiJoinRule.INSTANCE) @@ -2329,7 +2329,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testReduceConstants() throws Exception { + @Test void testReduceConstants() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE) .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) @@ -2356,7 +2356,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-570] * ReduceExpressionsRule throws "duplicate key" exception. */ - @Test public void testReduceConstantsDup() throws Exception { + @Test void testReduceConstantsDup() throws Exception { final String sql = "select d.deptno" + " from dept d" + " where d.deptno=7 and d.deptno=8"; @@ -2366,7 +2366,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-935] * Improve how ReduceExpressionsRule handles duplicate constraints. */ - @Test public void testReduceConstantsDup2() throws Exception { + @Test void testReduceConstantsDup2() throws Exception { final String sql = "select *\n" + "from emp\n" + "where deptno=7 and deptno=8\n" @@ -2379,7 +2379,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testReduceConstantsDup3() throws Exception { + @Test void testReduceConstantsDup3() throws Exception { final String sql = "select d.deptno" + " from dept d" + " where d.deptno<>7 or d.deptno<>8"; @@ -2390,7 +2390,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testReduceConstantsDup3Null() throws Exception { + @Test void testReduceConstantsDup3Null() throws Exception { final String sql = "select e.empno" + " from emp e" + " where e.mgr<>7 or e.mgr<>8"; @@ -2400,7 +2400,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testReduceConstantsDupNot() throws Exception { + @Test void testReduceConstantsDupNot() throws Exception { final String sql = "select d.deptno" + " from dept d" + " where not(d.deptno=7 and d.deptno=8)"; @@ -2410,7 +2410,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testReduceConstantsDupNotNull() throws Exception { + @Test void testReduceConstantsDupNotNull() throws Exception { final String sql = "select e.empno" + " from emp e" + " where not(e.mgr=7 and e.mgr=8)"; @@ -2420,7 +2420,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testReduceConstantsDupNot2() throws Exception { + @Test void testReduceConstantsDupNot2() throws Exception { final String sql = "select d.deptno" + " from dept d" + " where not(d.deptno=7 and d.name='foo' and d.deptno=8)"; @@ -2431,14 +2431,14 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-3198] * Enhance RexSimplify to handle (x<>a or x<>b). */ - @Test public void testReduceConstantsDupNot2Null() throws Exception { + @Test void testReduceConstantsDupNot2Null() throws Exception { final String sql = "select e.empno" + " from emp e" + " where not(e.mgr=7 and e.deptno=8 and e.mgr=8)"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } - @Test public void testPullNull() throws Exception { + @Test void testPullNull() throws Exception { final String sql = "select *\n" + "from emp\n" + "where deptno=7\n" @@ -2449,7 +2449,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testOrAlwaysTrue() { + @Test void testOrAlwaysTrue() { final String sql = "select * from EMPNULLABLES_20\n" + "where sal is null or sal is not null"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, @@ -2458,7 +2458,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testOrAlwaysTrue2() { + @Test void testOrAlwaysTrue2() { final String sql = "select * from EMPNULLABLES_20\n" + "where sal is not null or sal is null"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, @@ -2467,7 +2467,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testReduceConstants2() throws Exception { + @Test void testReduceConstants2() throws Exception { final String sql = "select p1 is not distinct from p0\n" + "from (values (2, cast(null as integer))) as t(p0, p1)"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, @@ -2476,7 +2476,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .checkUnchanged(); } - @Test public void testReduceConstants3() throws Exception { + @Test void testReduceConstants3() throws Exception { final String sql = "select e.mgr is not distinct from f.mgr " + "from emp e join emp f on (e.mgr=f.mgr) where e.mgr is null"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, @@ -2488,7 +2488,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-902] * Match nullability when reducing expressions in a Project. */ - @Test public void testReduceConstantsProjectNullable() throws Exception { + @Test void testReduceConstantsProjectNullable() throws Exception { final String sql = "select mgr from emp where mgr=10"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, ReduceExpressionsRule.FILTER_INSTANCE, @@ -2497,7 +2497,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } // see HIVE-9645 - @Test public void testReduceConstantsNullEqualsOne() throws Exception { + @Test void testReduceConstantsNullEqualsOne() throws Exception { final String sql = "select count(1) from emp where cast(null as integer) = 1"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, ReduceExpressionsRule.FILTER_INSTANCE, @@ -2506,7 +2506,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) } // see HIVE-9644 - @Test public void testReduceConstantsCaseEquals() throws Exception { + @Test void testReduceConstantsCaseEquals() throws Exception { final String sql = "select count(1) from emp\n" + "where case deptno\n" + " when 20 then 2\n" @@ -2519,7 +2519,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testReduceConstantsCaseEquals2() throws Exception { + @Test void testReduceConstantsCaseEquals2() throws Exception { final String sql = "select count(1) from emp\n" + "where case deptno\n" + " when 20 then 2\n" @@ -2535,7 +2535,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testReduceConstantsCaseEquals3() throws Exception { + @Test void testReduceConstantsCaseEquals3() throws Exception { final String sql = "select count(1) from emp\n" + "where case deptno\n" + " when 30 then 1\n" @@ -2551,7 +2551,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testSkipReduceConstantsCaseEquals() throws Exception { + @Test void testSkipReduceConstantsCaseEquals() throws Exception { final String sql = "select * from emp e1, emp e2\n" + "where coalesce(e1.mgr, -1) = coalesce(e2.mgr, -1)"; sql(sql).withRule(ReduceExpressionsRule.PROJECT_INSTANCE, @@ -2560,7 +2560,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testReduceConstantsEliminatesFilter() throws Exception { + @Test void testReduceConstantsEliminatesFilter() throws Exception { final String sql = "select * from (values (1,2)) where 1 + 2 > 3 + CAST(NULL AS INTEGER)"; // WHERE NULL is the same as WHERE FALSE, so get empty result @@ -2570,7 +2570,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-1860] * Duplicate null predicates cause NullPointerException in RexUtil. */ - @Test public void testReduceConstantsNull() throws Exception { + @Test void testReduceConstantsNull() throws Exception { final String sql = "select * from (\n" + " select *\n" + " from (\n" @@ -2584,7 +2584,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) /** Test case for * [CALCITE-566] * ReduceExpressionsRule requires planner to have an Executor. */ - @Test public void testReduceConstantsRequiresExecutor() throws Exception { + @Test void testReduceConstantsRequiresExecutor() throws Exception { // Remove the executor tester.convertSqlToRel("values 1").rel.getCluster().getPlanner() .setExecutor(null); @@ -2595,13 +2595,13 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } - @Test public void testAlreadyFalseEliminatesFilter() throws Exception { + @Test void testAlreadyFalseEliminatesFilter() throws Exception { final String sql = "select * from (values (1,2)) where false"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } - @Test public void testReduceConstantsCalc() throws Exception { + @Test void testReduceConstantsCalc() throws Exception { // This reduction does not work using // ReduceExpressionsRule.PROJECT_INSTANCE or FILTER_INSTANCE, // only CALC_INSTANCE, because we need to pull the project expression @@ -2641,7 +2641,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) sql(sql).with(program).check(); } - @Test public void testRemoveSemiJoin() throws Exception { + @Test void testRemoveSemiJoin() throws Exception { final String sql = "select e.ename from emp e, dept d\n" + "where e.deptno = d.deptno"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN, @@ -2650,7 +2650,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testRemoveSemiJoinWithFilter() throws Exception { + @Test void testRemoveSemiJoinWithFilter() throws Exception { final String sql = "select e.ename from emp e, dept d\n" + "where e.deptno = d.deptno and e.ename = 'foo'"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN, @@ -2660,7 +2660,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testRemoveSemiJoinRight() throws Exception { + @Test void testRemoveSemiJoinRight() throws Exception { final String sql = "select e1.ename from emp e1, dept d, emp e2\n" + "where e1.deptno = d.deptno and d.deptno = e2.deptno"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN, @@ -2670,7 +2670,7 @@ private void basePushFilterPastAggWithGroupingSets(boolean unchanged) .check(); } - @Test public void testRemoveSemiJoinRightWithFilter() throws Exception { + @Test void testRemoveSemiJoinRightWithFilter() throws Exception { final String sql = "select e1.ename from emp e1, dept d, emp e2\n" + "where e1.deptno = d.deptno and d.deptno = e2.deptno\n" + "and d.name = 'foo'"; @@ -2714,7 +2714,7 @@ private void checkPlanning(String query) throws Exception { .check(); } - @Test public void testConvertMultiJoinRuleOuterJoins() throws Exception { + @Test void testConvertMultiJoinRuleOuterJoins() throws Exception { checkPlanning("select * from " + " (select * from " + " (select * from " @@ -2734,25 +2734,25 @@ private void checkPlanning(String query) throws Exception { + " on a = i and h = j"); } - @Test public void testConvertMultiJoinRuleOuterJoins2() throws Exception { + @Test void testConvertMultiJoinRuleOuterJoins2() throws Exception { // in (A right join B) join C, pushing C is not allowed; // therefore there should be 2 MultiJoin checkPlanning("select * from A right join B on a = b join C on b = c"); } - @Test public void testConvertMultiJoinRuleOuterJoins3() throws Exception { + @Test void testConvertMultiJoinRuleOuterJoins3() throws Exception { // in (A join B) left join C, pushing C is allowed; // therefore there should be 1 MultiJoin checkPlanning("select * from A join B on a = b left join C on b = c"); } - @Test public void testConvertMultiJoinRuleOuterJoins4() throws Exception { + @Test void testConvertMultiJoinRuleOuterJoins4() throws Exception { // in (A join B) right join C, pushing C is not allowed; // therefore there should be 2 MultiJoin checkPlanning("select * from A join B on a = b right join C on b = c"); } - @Test public void testPushSemiJoinPastProject() throws Exception { + @Test void testPushSemiJoinPastProject() throws Exception { final String sql = "select e.* from\n" + "(select ename, trim(job), sal * 2, deptno from emp) e, dept d\n" + "where e.deptno = d.deptno"; @@ -2762,7 +2762,7 @@ private void checkPlanning(String query) throws Exception { .check(); } - @Test public void testReduceValuesUnderFilter() throws Exception { + @Test void testReduceValuesUnderFilter() throws Exception { // Plan should be same as for // select a, b from (values (10,'x')) as t(a, b)"); final String sql = "select a, b from (values (10, 'x'), (20, 'y')) as t(a, b) where a < 15"; @@ -2771,7 +2771,7 @@ private void checkPlanning(String query) throws Exception { .check(); } - @Test public void testReduceValuesUnderProject() throws Exception { + @Test void testReduceValuesUnderProject() throws Exception { // Plan should be same as for // select a, b as x from (values (11), (23)) as t(x)"); final String sql = "select a + b from (values (10, 1), (20, 3)) as t(a, b)"; @@ -2780,7 +2780,7 @@ private void checkPlanning(String query) throws Exception { .check(); } - @Test public void testReduceValuesUnderProjectFilter() throws Exception { + @Test void testReduceValuesUnderProjectFilter() throws Exception { // Plan should be same as for // select * from (values (11, 1, 10), (23, 3, 20)) as t(x, b, a)"); final String sql = "select a + b as x, b, a\n" @@ -2795,7 +2795,7 @@ private void checkPlanning(String query) throws Exception { /** Test case for * [CALCITE-1439] * Handling errors during constant reduction. */ - @Test public void testReduceCase() throws Exception { + @Test void testReduceCase() throws Exception { final String sql = "select\n" + " case when false then cast(2.1 as float)\n" + " else cast(1 as integer) end as newcol\n" @@ -2816,12 +2816,12 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { /** Test case that reduces a nullable expression to a NOT NULL literal that * is cast to nullable. */ - @Test public void testReduceNullableToNotNull() throws Exception { + @Test void testReduceNullableToNotNull() throws Exception { checkReduceNullableToNotNull(ReduceExpressionsRule.PROJECT_INSTANCE); } /** Test case that reduces a nullable expression to a NOT NULL literal. */ - @Test public void testReduceNullableToNotNull2() throws Exception { + @Test void testReduceNullableToNotNull2() throws Exception { final ReduceExpressionsRule.ProjectReduceExpressionsRule rule = new ReduceExpressionsRule.ProjectReduceExpressionsRule( LogicalProject.class, false, @@ -2829,24 +2829,24 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { checkReduceNullableToNotNull(rule); } - @Test public void testReduceConstantsIsNull() throws Exception { + @Test void testReduceConstantsIsNull() throws Exception { final String sql = "select empno from emp where empno=10 and empno is null"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } - @Test public void testReduceConstantsIsNotNull() throws Exception { + @Test void testReduceConstantsIsNotNull() throws Exception { final String sql = "select empno from emp\n" + "where empno=10 and empno is not null"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } - @Test public void testReduceConstantsNegated() throws Exception { + @Test void testReduceConstantsNegated() throws Exception { final String sql = "select empno from emp\n" + "where empno=10 and not(empno=10)"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } - @Test public void testReduceConstantsNegatedInverted() throws Exception { + @Test void testReduceConstantsNegatedInverted() throws Exception { final String sql = "select empno from emp where empno>10 and empno<=10"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE).check(); } @@ -2855,7 +2855,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { * [CALCITE-2638] * Constant reducer must not duplicate calls to non-deterministic * functions. */ - @Test public void testReduceConstantsNonDeterministicFunction() { + @Test void testReduceConstantsNonDeterministicFunction() { final DiffRepository diffRepos = getDiffRepos(); final SqlOperator nonDeterministicOp = @@ -2902,7 +2902,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { /** Checks that constant reducer duplicates calls to dynamic functions, if * appropriate. CURRENT_TIMESTAMP is a dynamic function. */ - @Test public void testReduceConstantsDynamicFunction() { + @Test void testReduceConstantsDynamicFunction() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE) @@ -2914,7 +2914,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).checkUnchanged(); } - @Test public void testCasePushIsAlwaysWorking() throws Exception { + @Test void testCasePushIsAlwaysWorking() throws Exception { final String sql = "select empno from emp" + " where case when sal > 1000 then empno else sal end = 1"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE, @@ -2923,14 +2923,14 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { .check(); } - @Test public void testReduceValuesNull() throws Exception { + @Test void testReduceValuesNull() throws Exception { // The NULL literal presents pitfalls for value-reduction. Only // an INSERT statement contains un-CASTed NULL values. final String sql = "insert into EMPNULLABLES(EMPNO, ENAME, JOB) (select 0, 'null', NULL)"; sql(sql).withRule(ValuesReduceRule.PROJECT_INSTANCE).check(); } - @Test public void testReduceValuesToEmpty() throws Exception { + @Test void testReduceValuesToEmpty() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -2944,7 +2944,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testReduceConstantsWindow() { + @Test void testReduceConstantsWindow() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ProjectToWindowRule.PROJECT) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -2963,7 +2963,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testEmptyFilterProjectUnion() throws Exception { + @Test void testEmptyFilterProjectUnion() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterSetOpTransposeRule.INSTANCE) .addRuleInstance(FilterProjectTransposeRule.INSTANCE) @@ -2987,7 +2987,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { /** Test case for * [CALCITE-1488] * ValuesReduceRule should ignore empty Values. */ - @Test public void testEmptyProject() throws Exception { + @Test void testEmptyProject() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ValuesReduceRule.PROJECT_FILTER_INSTANCE) .addRuleInstance(ValuesReduceRule.FILTER_INSTANCE) @@ -3003,7 +3003,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { /** Same query as {@link #testEmptyProject()}, and {@link PruneEmptyRules} * is able to do the job that {@link ValuesReduceRule} cannot do. */ - @Test public void testEmptyProject2() throws Exception { + @Test void testEmptyProject2() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ValuesReduceRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3016,7 +3016,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testEmptyIntersect() throws Exception { + @Test void testEmptyIntersect() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ValuesReduceRule.PROJECT_FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3031,7 +3031,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testEmptyMinus() throws Exception { + @Test void testEmptyMinus() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ValuesReduceRule.PROJECT_FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3048,7 +3048,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testEmptyMinus2() throws Exception { + @Test void testEmptyMinus2() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ValuesReduceRule.PROJECT_FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3066,7 +3066,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testLeftEmptyInnerJoin() { + @Test void testLeftEmptyInnerJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3081,7 +3081,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testLeftEmptyLeftJoin() { + @Test void testLeftEmptyLeftJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3096,7 +3096,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testLeftEmptyRightJoin() { + @Test void testLeftEmptyRightJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3112,7 +3112,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testLeftEmptyFullJoin() { + @Test void testLeftEmptyFullJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3128,7 +3128,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testLeftEmptySemiJoin() { + @Test void testLeftEmptySemiJoin() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); final RelNode relNode = relBuilder .scan("EMP").empty() @@ -3159,7 +3159,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testLeftEmptyAntiJoin() { + @Test void testLeftEmptyAntiJoin() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); final RelNode relNode = relBuilder .scan("EMP").empty() @@ -3190,7 +3190,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testRightEmptyInnerJoin() { + @Test void testRightEmptyInnerJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3205,7 +3205,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testRightEmptyLeftJoin() { + @Test void testRightEmptyLeftJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3221,7 +3221,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testRightEmptyRightJoin() { + @Test void testRightEmptyRightJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3236,7 +3236,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testRightEmptyFullJoin() { + @Test void testRightEmptyFullJoin() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3252,7 +3252,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testRightEmptySemiJoin() { + @Test void testRightEmptySemiJoin() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); final RelNode relNode = relBuilder .scan("EMP") @@ -3283,7 +3283,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testRightEmptyAntiJoin() { + @Test void testRightEmptyAntiJoin() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); final RelNode relNode = relBuilder .scan("EMP") @@ -3314,7 +3314,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testRightEmptyAntiJoinNonEqui() { + @Test void testRightEmptyAntiJoinNonEqui() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); final RelNode relNode = relBuilder .scan("EMP") @@ -3349,7 +3349,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testEmptySort() { + @Test void testEmptySort() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.SORT_INSTANCE) @@ -3359,12 +3359,12 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testEmptySortLimitZero() { + @Test void testEmptySortLimitZero() { final String sql = "select * from emp order by deptno limit 0"; sql(sql).withRule(PruneEmptyRules.SORT_FETCH_ZERO_INSTANCE).check(); } - @Test public void testEmptyAggregate() { + @Test void testEmptyAggregate() { HepProgram preProgram = HepProgram.builder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3380,7 +3380,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).withPre(preProgram).with(program).check(); } - @Test public void testEmptyAggregateEmptyKey() { + @Test void testEmptyAggregateEmptyKey() { HepProgram preProgram = HepProgram.builder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE) @@ -3395,7 +3395,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { .checkUnchanged(); } - @Test public void testEmptyAggregateEmptyKeyWithAggregateValuesRule() { + @Test void testEmptyAggregateEmptyKeyWithAggregateValuesRule() { HepProgram preProgram = HepProgram .builder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) @@ -3409,7 +3409,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).withPre(preProgram).with(program).check(); } - @Test public void testReduceCasts() throws Exception { + @Test void testReduceCasts() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE) .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) @@ -3427,7 +3427,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { /** Tests that a cast from a TIME to a TIMESTAMP is not reduced. It is not * constant because the result depends upon the current date. */ - @Test public void testReduceCastTimeUnchanged() throws Exception { + @Test void testReduceCastTimeUnchanged() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE) .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) @@ -3439,7 +3439,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { .checkUnchanged(); } - @Test public void testReduceCastAndConsts() throws Exception { + @Test void testReduceCastAndConsts() throws Exception { // Make sure constant expressions inside the cast can be reduced // in addition to the casts. final String sql = "select * from emp\n" @@ -3462,7 +3462,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { .with(program).check(); } - @Test public void testReduceCastsNullable() throws Exception { + @Test void testReduceCastsNullable() throws Exception { HepProgram program = new HepProgramBuilder() // Simulate the way INSERT will insert casts to the target types @@ -3481,7 +3481,7 @@ private void checkReduceNullableToNotNull(ReduceExpressionsRule rule) { sql(sql).with(program).check(); } - @Test public void testReduceCaseWhenWithCast() { + @Test void testReduceCaseWhenWithCast() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); final RexBuilder rexBuilder = relBuilder.getRexBuilder(); final RelDataType type = rexBuilder.getTypeFactory().createSqlType(SqlTypeName.BIGINT); @@ -3535,95 +3535,95 @@ private void basePushAggThroughUnion() throws Exception { sql("${sql}").with(program).check(); } - @Test public void testPushSumConstantThroughUnion() throws Exception { + @Test void testPushSumConstantThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumNullConstantThroughUnion() throws Exception { + @Test void testPushSumNullConstantThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumNullableThroughUnion() throws Exception { + @Test void testPushSumNullableThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumNullableNOGBYThroughUnion() throws + @Test void testPushSumNullableNOGBYThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushCountStarThroughUnion() throws Exception { + @Test void testPushCountStarThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushCountNullableThroughUnion() throws Exception { + @Test void testPushCountNullableThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushMaxNullableThroughUnion() throws Exception { + @Test void testPushMaxNullableThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushMinThroughUnion() throws Exception { + @Test void testPushMinThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushAvgThroughUnion() throws Exception { + @Test void testPushAvgThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumCountStarThroughUnion() throws Exception { + @Test void testPushSumCountStarThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumConstantGroupingSetsThroughUnion() throws + @Test void testPushSumConstantGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumNullConstantGroupingSetsThroughUnion() throws + @Test void testPushSumNullConstantGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumNullableGroupingSetsThroughUnion() throws + @Test void testPushSumNullableGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushCountStarGroupingSetsThroughUnion() throws + @Test void testPushCountStarGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushCountNullableGroupingSetsThroughUnion() throws + @Test void testPushCountNullableGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushMaxNullableGroupingSetsThroughUnion() throws + @Test void testPushMaxNullableGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushMinGroupingSetsThroughUnion() throws Exception { + @Test void testPushMinGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushAvgGroupingSetsThroughUnion() throws Exception { + @Test void testPushAvgGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushSumCountStarGroupingSetsThroughUnion() throws + @Test void testPushSumCountStarGroupingSetsThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPushCountFilterThroughUnion() throws Exception { + @Test void testPushCountFilterThroughUnion() throws Exception { basePushAggThroughUnion(); } - @Test public void testPullFilterThroughAggregate() throws Exception { + @Test void testPullFilterThroughAggregate() throws Exception { HepProgram preProgram = HepProgram.builder() .addRuleInstance(ProjectMergeRule.INSTANCE) .addRuleInstance(ProjectFilterTransposeRule.INSTANCE) @@ -3639,7 +3639,7 @@ private void basePushAggThroughUnion() throws Exception { sql(sql).withPre(preProgram).with(program).check(); } - @Test public void testPullFilterThroughAggregateGroupingSets() + @Test void testPullFilterThroughAggregateGroupingSets() throws Exception { HepProgram preProgram = HepProgram.builder() .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -3665,47 +3665,47 @@ private void basePullConstantTroughAggregate() throws Exception { sql("${sql}").with(program).check(); } - @Test public void testPullConstantThroughConstLast() throws + @Test void testPullConstantThroughConstLast() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregateSimpleNonNullable() throws + @Test void testPullConstantThroughAggregateSimpleNonNullable() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregatePermuted() throws + @Test void testPullConstantThroughAggregatePermuted() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregatePermutedConstFirst() throws + @Test void testPullConstantThroughAggregatePermutedConstFirst() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregatePermutedConstGroupBy() + @Test void testPullConstantThroughAggregatePermutedConstGroupBy() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregateConstGroupBy() + @Test void testPullConstantThroughAggregateConstGroupBy() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregateAllConst() + @Test void testPullConstantThroughAggregateAllConst() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughAggregateAllLiterals() + @Test void testPullConstantThroughAggregateAllLiterals() throws Exception { basePullConstantTroughAggregate(); } - @Test public void testPullConstantThroughUnion() + @Test void testPullConstantThroughUnion() throws Exception { HepProgram program = HepProgram.builder() .addRuleInstance(UnionPullUpConstantsRule.INSTANCE) @@ -3720,7 +3720,7 @@ private void basePullConstantTroughAggregate() throws Exception { .check(); } - @Test public void testPullConstantThroughUnion2() + @Test void testPullConstantThroughUnion2() throws Exception { // Negative test: constants should not be pulled up HepProgram program = HepProgram.builder() @@ -3733,7 +3733,7 @@ private void basePullConstantTroughAggregate() throws Exception { sql(sql).with(program).checkUnchanged(); } - @Test public void testPullConstantThroughUnion3() + @Test void testPullConstantThroughUnion3() throws Exception { // We should leave at least a single column in each Union input HepProgram program = HepProgram.builder() @@ -3749,7 +3749,7 @@ private void basePullConstantTroughAggregate() throws Exception { .check(); } - @Test public void testAggregateProjectMerge() { + @Test void testAggregateProjectMerge() { final String sql = "select x, sum(z), y from (\n" + " select deptno as x, empno as y, sal as z, sal * 2 as zz\n" + " from emp)\n" @@ -3757,7 +3757,7 @@ private void basePullConstantTroughAggregate() throws Exception { sql(sql).withRule(AggregateProjectMergeRule.INSTANCE).check(); } - @Test public void testAggregateGroupingSetsProjectMerge() { + @Test void testAggregateGroupingSetsProjectMerge() { final String sql = "select x, sum(z), y from (\n" + " select deptno as x, empno as y, sal as z, sal * 2 as zz\n" + " from emp)\n" @@ -3765,7 +3765,7 @@ private void basePullConstantTroughAggregate() throws Exception { sql(sql).withRule(AggregateProjectMergeRule.INSTANCE).check(); } - @Test public void testAggregateExtractProjectRule() { + @Test void testAggregateExtractProjectRule() { final String sql = "select sum(sal)\n" + "from emp"; HepProgram pre = new HepProgramBuilder() @@ -3777,7 +3777,7 @@ private void basePullConstantTroughAggregate() throws Exception { sql(sql).withPre(pre).withRule(rule).check(); } - @Test public void testAggregateExtractProjectRuleWithGroupingSets() { + @Test void testAggregateExtractProjectRuleWithGroupingSets() { final String sql = "select empno, deptno, sum(sal)\n" + "from emp\n" + "group by grouping sets ((empno, deptno),(deptno),(empno))"; @@ -3793,7 +3793,7 @@ private void basePullConstantTroughAggregate() throws Exception { /** Test with column used in both grouping set and argument to aggregate * function. */ - @Test public void testAggregateExtractProjectRuleWithGroupingSets2() { + @Test void testAggregateExtractProjectRuleWithGroupingSets2() { final String sql = "select empno, deptno, sum(empno)\n" + "from emp\n" + "group by grouping sets ((empno, deptno),(deptno),(empno))"; @@ -3806,7 +3806,7 @@ private void basePullConstantTroughAggregate() throws Exception { sql(sql).withPre(pre).withRule(rule).check(); } - @Test public void testAggregateExtractProjectRuleWithFilter() { + @Test void testAggregateExtractProjectRuleWithFilter() { final String sql = "select sum(sal) filter (where empno = 40)\n" + "from emp"; HepProgram pre = new HepProgramBuilder() @@ -3830,7 +3830,7 @@ public boolean test(Project project) { sql(sql).withPre(pre).withRule(rule).checkUnchanged(); } - @Test public void testAggregateCaseToFilter() { + @Test void testAggregateCaseToFilter() { final String sql = "select\n" + " sum(sal) as sum_sal,\n" + " count(distinct case\n" @@ -3845,7 +3845,7 @@ public boolean test(Project project) { sql(sql).withRule(AggregateCaseToFilterRule.INSTANCE).check(); } - @Test public void testPullAggregateThroughUnion() { + @Test void testPullAggregateThroughUnion() { HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateUnionAggregateRule.INSTANCE) .build(); @@ -3860,7 +3860,7 @@ public boolean test(Project project) { sql(sql).with(program).check(); } - @Test public void testPullAggregateThroughUnion2() { + @Test void testPullAggregateThroughUnion2() { HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateUnionAggregateRule.AGG_ON_SECOND_INPUT) .addRuleInstance(AggregateUnionAggregateRule.AGG_ON_FIRST_INPUT) @@ -3880,7 +3880,7 @@ public boolean test(Project project) { * Once the bottom aggregate pulled through union, we need to add a Project * if the new input contains a different type from the union. */ - @Test public void testPullAggregateThroughUnionAndAddProjects() { + @Test void testPullAggregateThroughUnionAndAddProjects() { HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateUnionAggregateRule.INSTANCE) @@ -3900,7 +3900,7 @@ public boolean test(Project project) { * Make sure the union alias is preserved when the bottom aggregate is * pulled up through union. */ - @Test public void testPullAggregateThroughUnionWithAlias() { + @Test void testPullAggregateThroughUnionWithAlias() { HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateUnionAggregateRule.INSTANCE) @@ -3929,28 +3929,28 @@ private HepProgram getTransitiveProgram() { return program; } - @Test public void testTransitiveInferenceJoin() throws Exception { + @Test void testTransitiveInferenceJoin() throws Exception { final String sql = "select 1 from sales.emp d\n" + "inner join sales.emp e on d.deptno = e.deptno where e.deptno > 7"; sql(sql).withPre(getTransitiveProgram()) .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceProject() throws Exception { + @Test void testTransitiveInferenceProject() throws Exception { final String sql = "select 1 from (select * from sales.emp where deptno > 7) d\n" + "inner join sales.emp e on d.deptno = e.deptno"; sql(sql).withPre(getTransitiveProgram()) .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceAggregate() throws Exception { + @Test void testTransitiveInferenceAggregate() throws Exception { final String sql = "select 1 from (select deptno, count(*) from sales.emp where deptno > 7\n" + "group by deptno) d inner join sales.emp e on d.deptno = e.deptno"; sql(sql).withPre(getTransitiveProgram()) .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceUnion() throws Exception { + @Test void testTransitiveInferenceUnion() throws Exception { final String sql = "select 1 from\n" + "(select deptno from sales.emp where deptno > 7\n" + "union all select deptno from sales.emp where deptno > 10) d\n" @@ -3959,7 +3959,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceJoin3way() throws Exception { + @Test void testTransitiveInferenceJoin3way() throws Exception { final String sql = "select 1 from sales.emp d\n" + "inner join sales.emp e on d.deptno = e.deptno\n" + "inner join sales.emp f on e.deptno = f.deptno\n" @@ -3968,7 +3968,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceJoin3wayAgg() throws Exception { + @Test void testTransitiveInferenceJoin3wayAgg() throws Exception { final String sql = "select 1 from\n" + "(select deptno, count(*) from sales.emp where deptno > 7 group by deptno) d\n" + "inner join sales.emp e on d.deptno = e.deptno\n" @@ -3977,7 +3977,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceLeftOuterJoin() throws Exception { + @Test void testTransitiveInferenceLeftOuterJoin() throws Exception { final String sql = "select 1 from sales.emp d\n" + "left outer join sales.emp e on d.deptno = e.deptno\n" + "where d.deptno > 7 and e.deptno > 9"; @@ -3985,7 +3985,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceRightOuterJoin() throws Exception { + @Test void testTransitiveInferenceRightOuterJoin() throws Exception { final String sql = "select 1 from sales.emp d\n" + "right outer join sales.emp e on d.deptno = e.deptno\n" + "where d.deptno > 7 and e.deptno > 9"; @@ -3993,14 +3993,14 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceFullOuterJoin() throws Exception { + @Test void testTransitiveInferenceFullOuterJoin() throws Exception { final String sql = "select 1 from sales.emp d full outer join sales.emp e\n" + "on d.deptno = e.deptno where d.deptno > 7 and e.deptno > 9"; sql(sql).withPre(getTransitiveProgram()) .withRule(JoinPushTransitivePredicatesRule.INSTANCE).checkUnchanged(); } - @Test public void testTransitiveInferencePreventProjectPullUp() + @Test void testTransitiveInferencePreventProjectPullUp() throws Exception { final String sql = "select 1 from (select comm as deptno from sales.emp where deptno > 7) d\n" + "inner join sales.emp e on d.deptno = e.deptno"; @@ -4008,14 +4008,14 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).checkUnchanged(); } - @Test public void testTransitiveInferencePullUpThruAlias() throws Exception { + @Test void testTransitiveInferencePullUpThruAlias() throws Exception { final String sql = "select 1 from (select comm as deptno from sales.emp where comm > 7) d\n" + "inner join sales.emp e on d.deptno = e.deptno"; sql(sql).withPre(getTransitiveProgram()) .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceConjunctInPullUp() throws Exception { + @Test void testTransitiveInferenceConjunctInPullUp() throws Exception { final String sql = "select 1 from sales.emp d\n" + "inner join sales.emp e on d.deptno = e.deptno\n" + "where d.deptno in (7, 9) or d.deptno > 10"; @@ -4023,7 +4023,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceNoPullUpExprs() throws Exception { + @Test void testTransitiveInferenceNoPullUpExprs() throws Exception { final String sql = "select 1 from sales.emp d\n" + "inner join sales.emp e on d.deptno = e.deptno\n" + "where d.deptno in (7, 9) or d.comm > 10"; @@ -4031,7 +4031,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).checkUnchanged(); } - @Test public void testTransitiveInferenceUnion3way() throws Exception { + @Test void testTransitiveInferenceUnion3way() throws Exception { final String sql = "select 1 from\n" + "(select deptno from sales.emp where deptno > 7\n" + "union all\n" @@ -4043,7 +4043,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceUnion3wayOr() throws Exception { + @Test void testTransitiveInferenceUnion3wayOr() throws Exception { final String sql = "select 1 from\n" + "(select empno, deptno from sales.emp where deptno > 7 or empno < 10\n" + "union all\n" @@ -4058,7 +4058,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-443] * getPredicates from a union is not correct. */ - @Test public void testTransitiveInferenceUnionAlwaysTrue() throws Exception { + @Test void testTransitiveInferenceUnionAlwaysTrue() throws Exception { final String sql = "select d.deptno, e.deptno from\n" + "(select deptno from sales.emp where deptno < 4) d\n" + "inner join\n" @@ -4069,7 +4069,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testTransitiveInferenceConstantEquiPredicate() + @Test void testTransitiveInferenceConstantEquiPredicate() throws Exception { final String sql = "select 1 from sales.emp d\n" + "inner join sales.emp e on d.deptno = e.deptno where 1 = 1"; @@ -4077,7 +4077,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).checkUnchanged(); } - @Test public void testTransitiveInferenceComplexPredicate() throws Exception { + @Test void testTransitiveInferenceComplexPredicate() throws Exception { final String sql = "select 1 from sales.emp d\n" + "inner join sales.emp e on d.deptno = e.deptno\n" + "where d.deptno > 7 and e.sal = e.deptno and d.comm = d.deptno\n" @@ -4086,7 +4086,7 @@ private HepProgram getTransitiveProgram() { .withRule(JoinPushTransitivePredicatesRule.INSTANCE).check(); } - @Test public void testPullConstantIntoProject() throws Exception { + @Test void testPullConstantIntoProject() throws Exception { final String sql = "select deptno, deptno + 1, empno + deptno\n" + "from sales.emp where deptno = 10"; sql(sql).withPre(getTransitiveProgram()) @@ -4095,7 +4095,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPullConstantIntoFilter() throws Exception { + @Test void testPullConstantIntoFilter() throws Exception { final String sql = "select * from (select * from sales.emp where deptno = 10)\n" + "where deptno + 5 > empno"; sql(sql).withPre(getTransitiveProgram()) @@ -4108,7 +4108,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-1995] * Remove predicates from Filter if they can be proved to be always true or * false. */ - @Test public void testSimplifyFilter() throws Exception { + @Test void testSimplifyFilter() throws Exception { final String sql = "select * from (select * from sales.emp where deptno > 10)\n" + "where empno > 3 and deptno > 5"; sql(sql).withPre(getTransitiveProgram()) @@ -4117,7 +4117,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPullConstantIntoJoin() throws Exception { + @Test void testPullConstantIntoJoin() throws Exception { final String sql = "select * from (select * from sales.emp where empno = 10) as e\n" + "left join sales.dept as d on e.empno = d.deptno"; sql(sql).withPre(getTransitiveProgram()) @@ -4126,7 +4126,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPullConstantIntoJoin2() throws Exception { + @Test void testPullConstantIntoJoin2() throws Exception { final String sql = "select * from (select * from sales.emp where empno = 10) as e\n" + "join sales.dept as d on e.empno = d.deptno and e.deptno + e.empno = d.deptno + 5"; final HepProgram program = new HepProgramBuilder() @@ -4144,7 +4144,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-2110] * ArrayIndexOutOfBoundsException in RexSimplify when using * ReduceExpressionsRule.JOIN_INSTANCE. */ - @Test public void testCorrelationScalarAggAndFilter() { + @Test void testCorrelationScalarAggAndFilter() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -4167,7 +4167,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-3111] * Allow custom implementations of Correlate in RelDecorrelator */ - @Test public void testCustomDecorrelate() { + @Test void testCustomDecorrelate() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -4205,14 +4205,14 @@ private HepProgram getTransitiveProgram() { logicalDecorrelatedPlan, customDecorrelatedPlan); } - @Test public void testProjectWindowTransposeRule() { + @Test void testProjectWindowTransposeRule() { final String sql = "select count(empno) over(), deptno from emp"; sql(sql).withRule(ProjectToWindowRule.PROJECT, ProjectWindowTransposeRule.INSTANCE) .check(); } - @Test public void testProjectWindowTransposeRuleWithConstants() { + @Test void testProjectWindowTransposeRuleWithConstants() { HepProgram program = new HepProgramBuilder() .addRuleInstance(ProjectToWindowRule.PROJECT) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -4231,7 +4231,7 @@ private HepProgram getTransitiveProgram() { /** While it's probably valid relational algebra for a Project to contain * a RexOver inside a RexOver, ProjectMergeRule should not bring it about. */ - @Test public void testProjectMergeShouldIgnoreOver() { + @Test void testProjectMergeShouldIgnoreOver() { final String sql = "select row_number() over (order by deptno), col1\n" + "from (\n" + " select deptno,\n" @@ -4240,14 +4240,14 @@ private HepProgram getTransitiveProgram() { sql(sql).withRule(ProjectMergeRule.INSTANCE).checkUnchanged(); } - @Test public void testAggregateProjectPullUpConstants() { + @Test void testAggregateProjectPullUpConstants() { final String sql = "select job, empno, sal, sum(sal) as s\n" + "from emp where empno = 10\n" + "group by job, empno, sal"; sql(sql).withRule(AggregateProjectPullUpConstantsRule.INSTANCE2).check(); } - @Test public void testAggregateProjectPullUpConstants2() { + @Test void testAggregateProjectPullUpConstants2() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4259,7 +4259,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPushFilterWithRank() throws Exception { + @Test void testPushFilterWithRank() throws Exception { final String sql = "select e1.ename, r\n" + "from (\n" + " select ename, " @@ -4270,7 +4270,7 @@ private HepProgram getTransitiveProgram() { .checkUnchanged(); } - @Test public void testPushFilterWithRankExpr() throws Exception { + @Test void testPushFilterWithRankExpr() throws Exception { final String sql = "select e1.ename, r\n" + "from (\n" + " select ename,\n" @@ -4284,7 +4284,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-841] * Redundant windows when window function arguments are expressions. */ - @Test public void testExpressionInWindowFunction() { + @Test void testExpressionInWindowFunction() { HepProgramBuilder builder = new HepProgramBuilder(); builder.addRuleClass(ProjectToWindowRule.class); @@ -4303,7 +4303,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-888] * Overlay window loses PARTITION BY list. */ - @Test public void testWindowInParenthesis() { + @Test void testWindowInParenthesis() { HepProgramBuilder builder = new HepProgramBuilder(); builder.addRuleClass(ProjectToWindowRule.class); HepPlanner hepPlanner = new HepPlanner(builder.build()); @@ -4320,7 +4320,7 @@ private HepProgram getTransitiveProgram() { /** Test case for DX-11490 * Make sure the planner doesn't fail over wrong push down * of is null */ - @Test public void testIsNullPushDown() { + @Test void testIsNullPushDown() { HepProgramBuilder preBuilder = new HepProgramBuilder(); preBuilder.addRuleInstance(ProjectToWindowRule.PROJECT); @@ -4340,7 +4340,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testIsNullPushDown2() { + @Test void testIsNullPushDown2() { HepProgramBuilder preBuilder = new HepProgramBuilder(); preBuilder.addRuleInstance(ProjectToWindowRule.PROJECT); @@ -4362,7 +4362,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-750] * Allow windowed aggregate on top of regular aggregate. */ - @Test public void testNestedAggregates() { + @Test void testNestedAggregates() { final String sql = "SELECT\n" + " avg(sum(sal) + 2 * min(empno) + 3 * avg(empno))\n" + " over (partition by deptno)\n" @@ -4374,7 +4374,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-2078] * Aggregate functions in OVER clause. */ - @Test public void testWindowFunctionOnAggregations() { + @Test void testWindowFunctionOnAggregations() { final String sql = "SELECT\n" + " min(empno),\n" + " sum(sal),\n" @@ -4385,7 +4385,7 @@ private HepProgram getTransitiveProgram() { sql(sql).withRule(ProjectToWindowRule.PROJECT).check(); } - @Test public void testPushAggregateThroughJoin1() { + @Test void testPushAggregateThroughJoin1() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4400,7 +4400,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by on non-join keys, group by on non-null generating side only */ - @Test public void testPushAggregateThroughOuterJoin1() { + @Test void testPushAggregateThroughOuterJoin1() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4415,7 +4415,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by on non-join keys, on null generating side only */ - @Test public void testPushAggregateThroughOuterJoin2() { + @Test void testPushAggregateThroughOuterJoin2() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4430,7 +4430,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by on both side on non-join keys */ - @Test public void testPushAggregateThroughOuterJoin3() { + @Test void testPushAggregateThroughOuterJoin3() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4445,7 +4445,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by on key same as join key, group by on non-null generating side */ - @Test public void testPushAggregateThroughOuterJoin4() { + @Test void testPushAggregateThroughOuterJoin4() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4460,7 +4460,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by on key same as join key, group by on null generating side */ - @Test public void testPushAggregateThroughOuterJoin5() { + @Test void testPushAggregateThroughOuterJoin5() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4475,7 +4475,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by on key same as join key, group by on both side */ - @Test public void testPushAggregateThroughOuterJoin6() { + @Test void testPushAggregateThroughOuterJoin6() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4490,7 +4490,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by key is susbset of join keys, group by on non-null generating side */ - @Test public void testPushAggregateThroughOuterJoin7() { + @Test void testPushAggregateThroughOuterJoin7() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4506,7 +4506,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by key is susbset of join keys, group by on null generating side */ - @Test public void testPushAggregateThroughOuterJoin8() { + @Test void testPushAggregateThroughOuterJoin8() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4522,7 +4522,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, group by key is susbset of join keys, group by on both sides */ - @Test public void testPushAggregateThroughOuterJoin9() { + @Test void testPushAggregateThroughOuterJoin9() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4538,7 +4538,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * outer join, with aggregate functions */ - @Test public void testPushAggregateThroughOuterJoin10() { + @Test void testPushAggregateThroughOuterJoin10() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4553,7 +4553,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * non-equi outer join */ - @Test public void testPushAggregateThroughOuterJoin11() { + @Test void testPushAggregateThroughOuterJoin11() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4568,7 +4568,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * right outer join, group by on key same as join key, group by on (left)null generating side */ - @Test public void testPushAggregateThroughOuterJoin12() { + @Test void testPushAggregateThroughOuterJoin12() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4583,7 +4583,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * full outer join, group by on key same as join key, group by on one side */ - @Test public void testPushAggregateThroughOuterJoin13() { + @Test void testPushAggregateThroughOuterJoin13() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4598,7 +4598,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * full outer join, group by on key same as join key, group by on both side */ - @Test public void testPushAggregateThroughOuterJoin14() { + @Test void testPushAggregateThroughOuterJoin14() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4613,7 +4613,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * full outer join, group by on both side on non-join keys */ - @Test public void testPushAggregateThroughOuterJoin15() { + @Test void testPushAggregateThroughOuterJoin15() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4628,7 +4628,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * full outer join, group by key is susbset of join keys */ - @Test public void testPushAggregateThroughOuterJoin16() { + @Test void testPushAggregateThroughOuterJoin16() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4642,7 +4642,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPushAggregateThroughJoin2() { + @Test void testPushAggregateThroughJoin2() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4656,7 +4656,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPushAggregateThroughJoin3() { + @Test void testPushAggregateThroughJoin3() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4672,7 +4672,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-1544] * AggregateJoinTransposeRule fails to preserve row type. */ - @Test public void testPushAggregateThroughJoin4() { + @Test void testPushAggregateThroughJoin4() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4684,7 +4684,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testPushAggregateThroughJoin5() { + @Test void testPushAggregateThroughJoin5() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4699,7 +4699,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-2200] * Infinite loop for JoinPushTransitivePredicatesRule. */ - @Test public void testJoinPushTransitivePredicatesRule() { + @Test void testJoinPushTransitivePredicatesRule() { HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN) .addRuleInstance(FilterJoinRule.JOIN) @@ -4717,7 +4717,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-2205] * One more infinite loop for JoinPushTransitivePredicatesRule. */ - @Test public void testJoinPushTransitivePredicatesRule2() { + @Test void testJoinPushTransitivePredicatesRule2() { HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN) .addRuleInstance(FilterJoinRule.JOIN) @@ -4735,7 +4735,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-2275] * JoinPushTransitivePredicatesRule wrongly pushes down NOT condition. */ - @Test public void testInferringPredicatesWithNotOperatorInJoinCondition() { + @Test void testInferringPredicatesWithNotOperatorInJoinCondition() { HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN) .addRuleInstance(FilterJoinRule.JOIN) @@ -4749,7 +4749,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-2195] * AggregateJoinTransposeRule fails to aggregate over unique column. */ - @Test public void testPushAggregateThroughJoin6() { + @Test void testPushAggregateThroughJoin6() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4767,7 +4767,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-2278] * AggregateJoinTransposeRule fails to split aggregate call if input contains * an aggregate call and has distinct rows. */ - @Test public void testPushAggregateThroughJoinWithUniqueInput() { + @Test void testPushAggregateThroughJoinWithUniqueInput() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4784,7 +4784,7 @@ private HepProgram getTransitiveProgram() { } /** SUM is the easiest aggregate function to split. */ - @Test public void testPushAggregateSumThroughJoin() { + @Test void testPushAggregateSumThroughJoin() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4801,7 +4801,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-2105] * AggregateJoinTransposeRule incorrectly makes a SUM NOT NULL when Aggregate * has no group keys. */ - @Test public void testPushAggregateSumWithoutGroupKeyThroughJoin() { + @Test void testPushAggregateSumWithoutGroupKeyThroughJoin() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4820,7 +4820,7 @@ private HepProgram getTransitiveProgram() { * *

    Similar to {@link #testPushAggregateSumThroughJoin()}, * but also uses {@link AggregateReduceFunctionsRule}. */ - @Test public void testPushAggregateSumThroughJoinAfterAggregateReduce() { + @Test void testPushAggregateSumThroughJoinAfterAggregateReduce() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4837,7 +4837,7 @@ private HepProgram getTransitiveProgram() { } /** Push a variety of aggregate functions. */ - @Test public void testPushAggregateFunctionsThroughJoin() { + @Test void testPushAggregateFunctionsThroughJoin() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4856,7 +4856,7 @@ private HepProgram getTransitiveProgram() { /** Push a aggregate functions into a relation that is unique on the join * key. */ - @Test public void testPushAggregateThroughJoinDistinct() { + @Test void testPushAggregateThroughJoinDistinct() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4872,7 +4872,7 @@ private HepProgram getTransitiveProgram() { } /** Push count(*) through join, no GROUP BY. */ - @Test public void testPushAggregateSumNoGroup() { + @Test void testPushAggregateSumNoGroup() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); @@ -4887,7 +4887,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-3076] * AggregateJoinTransposeRule throws error for unique under aggregate keys when * generating merged calls.*/ - @Test public void testPushAggregateThroughJoinOnEmptyLogicalValues() { + @Test void testPushAggregateThroughJoinOnEmptyLogicalValues() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ReduceExpressionsRule.FilterReduceExpressionsRule.FILTER_INSTANCE) @@ -4907,7 +4907,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-2249] * AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode contains * distinct aggregate function.. */ - @Test public void testPushDistinctAggregateIntoJoin() throws Exception { + @Test void testPushDistinctAggregateIntoJoin() throws Exception { final String sql = "select count(distinct sal) from sales.emp join sales.dept on job = name"; sql(sql).withRule(AggregateJoinTransposeRule.EXTENDED) @@ -4918,7 +4918,7 @@ private HepProgram getTransitiveProgram() { * Test case for AggregateMergeRule, should merge 2 aggregates * into a single aggregate. */ - @Test public void testAggregateMerge1() { + @Test void testAggregateMerge1() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -4942,7 +4942,7 @@ private HepProgram getTransitiveProgram() { * Test case for AggregateMergeRule, should merge 2 aggregates * into a single aggregate, top aggregate is not simple aggregate. */ - @Test public void testAggregateMerge2() { + @Test void testAggregateMerge2() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -4966,7 +4966,7 @@ private HepProgram getTransitiveProgram() { * Test case for AggregateMergeRule, should not merge 2 aggregates * into a single aggregate, since lower aggregate is not simple aggregate. */ - @Test public void testAggregateMerge3() { + @Test void testAggregateMerge3() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -4988,7 +4988,7 @@ private HepProgram getTransitiveProgram() { * into a single aggregate, since it contains distinct aggregate * function. */ - @Test public void testAggregateMerge4() { + @Test void testAggregateMerge4() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5009,7 +5009,7 @@ private HepProgram getTransitiveProgram() { * Test case for AggregateMergeRule, should not merge 2 aggregates * into a single aggregate, since AVG doesn't support splitting. */ - @Test public void testAggregateMerge5() { + @Test void testAggregateMerge5() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5031,7 +5031,7 @@ private HepProgram getTransitiveProgram() { * into a single aggregate, since top agg has no group key, and * lower agg function is COUNT. */ - @Test public void testAggregateMerge6() { + @Test void testAggregateMerge6() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5052,7 +5052,7 @@ private HepProgram getTransitiveProgram() { * into a single aggregate, since top agg contains empty grouping set, * and lower agg function is COUNT. */ - @Test public void testAggregateMerge7() { + @Test void testAggregateMerge7() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5074,7 +5074,7 @@ private HepProgram getTransitiveProgram() { * into a single aggregate, since both top and bottom aggregates * contains empty grouping set and they are mergable. */ - @Test public void testAggregateMerge8() { + @Test void testAggregateMerge8() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5094,7 +5094,7 @@ private HepProgram getTransitiveProgram() { * Test case for AggregateRemoveRule, should remove aggregates since * empno is unique and all aggregate functions are splittable. */ - @Test public void testAggregateRemove1() { + @Test void testAggregateRemove1() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5110,7 +5110,7 @@ private HepProgram getTransitiveProgram() { * Test case for AggregateRemoveRule, should remove aggregates since * empno is unique and there are no aggregate functions. */ - @Test public void testAggregateRemove2() { + @Test void testAggregateRemove2() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5126,7 +5126,7 @@ private HepProgram getTransitiveProgram() { * aggregate function should be transformed to CASE function call * because mgr is nullable. */ - @Test public void testAggregateRemove3() { + @Test void testAggregateRemove3() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5141,7 +5141,7 @@ private HepProgram getTransitiveProgram() { * Negative test case for AggregateRemoveRule, should not * remove aggregate because avg is not splittable. */ - @Test public void testAggregateRemove4() { + @Test void testAggregateRemove4() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5156,7 +5156,7 @@ private HepProgram getTransitiveProgram() { * Negative test case for AggregateRemoveRule, should not * remove non-simple aggregates. */ - @Test public void testAggregateRemove5() { + @Test void testAggregateRemove5() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5171,7 +5171,7 @@ private HepProgram getTransitiveProgram() { * Negative test case for AggregateRemoveRule, should not * remove aggregate because deptno is not unique. */ - @Test public void testAggregateRemove6() { + @Test void testAggregateRemove6() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5186,7 +5186,7 @@ private HepProgram getTransitiveProgram() { * The top Aggregate should be removed -- given "deptno=100", * the input of top Aggregate must be already distinct by "mgr" */ - @Test public void testAggregateRemove7() { + @Test void testAggregateRemove7() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateRemoveRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) @@ -5208,7 +5208,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-2712] * Should remove the left join since the aggregate has no call and * only uses column in the left input of the bottom join as group key.. */ - @Test public void testAggregateJoinRemove1() { + @Test void testAggregateJoinRemove1() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinRemoveRule.INSTANCE) @@ -5222,7 +5222,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()} but has aggregate * call with distinct. */ - @Test public void testAggregateJoinRemove2() { + @Test void testAggregateJoinRemove2() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinRemoveRule.INSTANCE) @@ -5238,7 +5238,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()} but should not * remove the left join since the aggregate uses column in the right * input of the bottom join. */ - @Test public void testAggregateJoinRemove3() { + @Test void testAggregateJoinRemove3() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinRemoveRule.INSTANCE) @@ -5252,7 +5252,7 @@ private HepProgram getTransitiveProgram() { } /** Similar to {@link #testAggregateJoinRemove1()} but right join. */ - @Test public void testAggregateJoinRemove4() { + @Test void testAggregateJoinRemove4() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinRemoveRule.INSTANCE) @@ -5265,7 +5265,7 @@ private HepProgram getTransitiveProgram() { } /** Similar to {@link #testAggregateJoinRemove2()} but right join. */ - @Test public void testAggregateJoinRemove5() { + @Test void testAggregateJoinRemove5() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinRemoveRule.INSTANCE) @@ -5279,7 +5279,7 @@ private HepProgram getTransitiveProgram() { } /** Similar to {@link #testAggregateJoinRemove3()} but right join. */ - @Test public void testAggregateJoinRemove6() { + @Test void testAggregateJoinRemove6() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinRemoveRule.INSTANCE) @@ -5295,7 +5295,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should remove the bottom join since the aggregate has no aggregate * call. */ - @Test public void testAggregateJoinRemove7() { + @Test void testAggregateJoinRemove7() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinJoinRemoveRule.INSTANCE) @@ -5311,7 +5311,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove7()} but has aggregate * call. */ - @Test public void testAggregateJoinRemove8() { + @Test void testAggregateJoinRemove8() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinJoinRemoveRule.INSTANCE) @@ -5327,7 +5327,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove7()} but use columns in * the right input of the top join. */ - @Test public void testAggregateJoinRemove9() { + @Test void testAggregateJoinRemove9() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinJoinRemoveRule.INSTANCE) @@ -5343,7 +5343,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the bottom join since the aggregate uses column in the * right input of bottom join. */ - @Test public void testAggregateJoinRemove10() { + @Test void testAggregateJoinRemove10() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .addRuleInstance(AggregateJoinJoinRemoveRule.INSTANCE) @@ -5360,7 +5360,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should remove the bottom join since the project uses column in the * right input of bottom join. */ - @Test public void testProjectJoinRemove1() { + @Test void testProjectJoinRemove1() { final String sql = "SELECT e.deptno, d2.deptno\n" + "FROM sales.emp e\n" + "LEFT JOIN sales.dept d1 ON e.deptno = d1.deptno\n" @@ -5372,7 +5372,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the bottom join since the project uses column in the * left input of bottom join. */ - @Test public void testProjectJoinRemove2() { + @Test void testProjectJoinRemove2() { final String sql = "SELECT e.deptno, d1.deptno\n" + "FROM sales.emp e\n" + "LEFT JOIN sales.dept d1 ON e.deptno = d1.deptno\n" @@ -5384,7 +5384,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the bottom join since the right join keys of bottom * join are not unique. */ - @Test public void testProjectJoinRemove3() { + @Test void testProjectJoinRemove3() { final String sql = "SELECT e1.deptno, d.deptno\n" + "FROM sales.emp e1\n" + "LEFT JOIN sales.emp e2 ON e1.deptno = e2.deptno\n" @@ -5396,7 +5396,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should remove the left join since the join key of the right input is * unique. */ - @Test public void testProjectJoinRemove4() { + @Test void testProjectJoinRemove4() { final String sql = "SELECT e.deptno\n" + "FROM sales.emp e\n" + "LEFT JOIN sales.dept d ON e.deptno = d.deptno"; @@ -5407,7 +5407,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the left join since the join key of the right input is * not unique. */ - @Test public void testProjectJoinRemove5() { + @Test void testProjectJoinRemove5() { final String sql = "SELECT e1.deptno\n" + "FROM sales.emp e1\n" + "LEFT JOIN sales.emp e2 ON e1.deptno = e2.deptno"; @@ -5418,7 +5418,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the left join since the project use columns in the right * input of the join. */ - @Test public void testProjectJoinRemove6() { + @Test void testProjectJoinRemove6() { final String sql = "SELECT e.deptno, d.name\n" + "FROM sales.emp e\n" + "LEFT JOIN sales.dept d ON e.deptno = d.deptno"; @@ -5429,7 +5429,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should remove the right join since the join key of the left input is * unique. */ - @Test public void testProjectJoinRemove7() { + @Test void testProjectJoinRemove7() { final String sql = "SELECT e.deptno\n" + "FROM sales.dept d\n" + "RIGHT JOIN sales.emp e ON e.deptno = d.deptno"; @@ -5440,7 +5440,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the right join since the join key of the left input is * not unique. */ - @Test public void testProjectJoinRemove8() { + @Test void testProjectJoinRemove8() { final String sql = "SELECT e2.deptno\n" + "FROM sales.emp e1\n" + "RIGHT JOIN sales.emp e2 ON e1.deptno = e2.deptno"; @@ -5451,7 +5451,7 @@ private HepProgram getTransitiveProgram() { /** Similar to {@link #testAggregateJoinRemove1()}; * Should not remove the right join since the project uses columns in the * left input of the join. */ - @Test public void testProjectJoinRemove9() { + @Test void testProjectJoinRemove9() { final String sql = "SELECT e.deptno, d.name\n" + "FROM sales.dept d\n" + "RIGHT JOIN sales.emp e ON e.deptno = d.deptno"; @@ -5459,7 +5459,7 @@ private HepProgram getTransitiveProgram() { .checkUnchanged(); } - @Test public void testSwapOuterJoin() { + @Test void testSwapOuterJoin() { final HepProgram program = new HepProgramBuilder() .addMatchLimit(1) .addRuleInstance(JoinCommuteRule.SWAP_OUTER) @@ -5469,7 +5469,7 @@ private HepProgram getTransitiveProgram() { sql(sql).with(program).check(); } - @Test public void testPushJoinCondDownToProject() { + @Test void testPushJoinCondDownToProject() { final String sql = "select d.deptno, e.deptno from sales.dept d, sales.emp e\n" + " where d.deptno + 10 = e.deptno * 2"; sql(sql).withRule(FilterJoinRule.FILTER_ON_JOIN, @@ -5477,7 +5477,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testSortJoinTranspose1() { + @Test void testSortJoinTranspose1() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -5489,7 +5489,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testSortJoinTranspose2() { + @Test void testSortJoinTranspose2() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -5501,7 +5501,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testSortJoinTranspose3() { + @Test void testSortJoinTranspose3() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -5517,7 +5517,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-931] * Wrong collation trait in SortJoinTransposeRule for right joins. */ - @Test public void testSortJoinTranspose4() { + @Test void testSortJoinTranspose4() { // Create a customized test with RelCollation trait in the test cluster. Tester tester = new TesterImpl(getDiffRepos(), true, true, false, false, true, null, null) { @@ -5549,7 +5549,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-1498] * Avoid LIMIT with trivial ORDER BY being pushed through JOIN endlessly. */ - @Test public void testSortJoinTranspose5() { + @Test void testSortJoinTranspose5() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .addRuleInstance(SortJoinTransposeRule.INSTANCE) @@ -5571,7 +5571,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-1507] * OFFSET cannot be pushed through a JOIN if the non-preserved side of outer * join is not count-preserving. */ - @Test public void testSortJoinTranspose6() { + @Test void testSortJoinTranspose6() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -5589,7 +5589,7 @@ private HepProgram getTransitiveProgram() { * [CALCITE-1507] * OFFSET cannot be pushed through a JOIN if the non-preserved side of outer * join is not count-preserving. */ - @Test public void testSortJoinTranspose7() { + @Test void testSortJoinTranspose7() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -5602,7 +5602,7 @@ private HepProgram getTransitiveProgram() { .checkUnchanged(); } - @Test public void testSortProjectTranspose1() { + @Test void testSortProjectTranspose1() { // This one can be pushed down final String sql = "select d.deptno from sales.dept d\n" + "order by cast(d.deptno as integer) offset 1"; @@ -5610,7 +5610,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testSortProjectTranspose2() { + @Test void testSortProjectTranspose2() { // This one can be pushed down final String sql = "select d.deptno from sales.dept d\n" + "order by cast(d.deptno as double) offset 1"; @@ -5618,7 +5618,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testSortProjectTranspose3() { + @Test void testSortProjectTranspose3() { // This one cannot be pushed down final String sql = "select d.deptno from sales.dept d\n" + "order by cast(d.deptno as varchar(10)) offset 1"; @@ -5629,7 +5629,7 @@ private HepProgram getTransitiveProgram() { /** Test case for * [CALCITE-1023] * Planner rule that removes Aggregate keys that are constant. */ - @Test public void testAggregateConstantKeyRule() { + @Test void testAggregateConstantKeyRule() { final String sql = "select count(*) as c\n" + "from sales.emp\n" + "where deptno = 10\n" @@ -5640,7 +5640,7 @@ private HepProgram getTransitiveProgram() { /** Tests {@link AggregateProjectPullUpConstantsRule} where reduction is not * possible because "deptno" is the only key. */ - @Test public void testAggregateConstantKeyRule2() { + @Test void testAggregateConstantKeyRule2() { final String sql = "select count(*) as c\n" + "from sales.emp\n" + "where deptno = 10\n" @@ -5651,7 +5651,7 @@ private HepProgram getTransitiveProgram() { /** Tests {@link AggregateProjectPullUpConstantsRule} where both keys are * constants but only one can be removed. */ - @Test public void testAggregateConstantKeyRule3() { + @Test void testAggregateConstantKeyRule3() { final String sql = "select job\n" + "from sales.emp\n" + "where sal is null and job = 'Clerk'\n" @@ -5665,7 +5665,7 @@ private HepProgram getTransitiveProgram() { * there are group keys of type * {@link org.apache.calcite.sql.fun.SqlAbstractTimeFunction} * that can not be removed. */ - @Test public void testAggregateDynamicFunction() { + @Test void testAggregateDynamicFunction() { final String sql = "select hiredate\n" + "from sales.emp\n" + "where sal is null and hiredate = current_timestamp\n" @@ -5675,7 +5675,7 @@ private HepProgram getTransitiveProgram() { .check(); } - @Test public void testReduceExpressionsNot() { + @Test void testReduceExpressionsNot() { final String sql = "select * from (values (false),(true)) as q (col1) where not(col1)"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE) .checkUnchanged(); @@ -5690,14 +5690,14 @@ private Sql checkSubQuery(String sql) { /** Tests expanding a sub-query, specifically an uncorrelated scalar * sub-query in a project (SELECT clause). */ - @Test public void testExpandProjectScalar() throws Exception { + @Test void testExpandProjectScalar() throws Exception { final String sql = "select empno,\n" + " (select deptno from sales.emp where empno < 20) as d\n" + "from sales.emp"; checkSubQuery(sql).check(); } - @Test public void testSelectNotInCorrelated() { + @Test void testSelectNotInCorrelated() { final String sql = "select sal,\n" + " empno NOT IN (\n" + " select deptno from dept\n" @@ -5709,7 +5709,7 @@ private Sql checkSubQuery(String sql) { /** Test case for * [CALCITE-1493] * Wrong plan for NOT IN correlated queries. */ - @Test public void testWhereNotInCorrelated() { + @Test void testWhereNotInCorrelated() { final String sql = "select sal from emp\n" + "where empno NOT IN (\n" + " select deptno from dept\n" @@ -5717,7 +5717,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testWhereNotInCorrelated2() { + @Test void testWhereNotInCorrelated2() { final String sql = "select * from emp e1\n" + " where e1.empno NOT IN\n" + " (select empno from (select ename, empno, sal as r from emp) e2\n" @@ -5725,13 +5725,13 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testAll() { + @Test void testAll() { final String sql = "select * from emp e1\n" + " where e1.empno > ALL (select deptno from dept)"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testSome() { + @Test void testSome() { final String sql = "select * from emp e1\n" + " where e1.empno > SOME (select deptno from dept)"; checkSubQuery(sql).withLateDecorrelation(true).check(); @@ -5739,7 +5739,7 @@ private Sql checkSubQuery(String sql) { /** Test case for testing type created by SubQueryRemoveRule: an * ANY sub-query is non-nullable therefore plan should have cast. */ - @Test public void testAnyInProjectNonNullable() { + @Test void testAnyInProjectNonNullable() { final String sql = "select name, deptno > ANY (\n" + " select deptno from emp)\n" + "from dept"; @@ -5748,34 +5748,34 @@ private Sql checkSubQuery(String sql) { /** Test case for testing type created by SubQueryRemoveRule; an * ANY sub-query is nullable therefore plan should not have cast. */ - @Test public void testAnyInProjectNullable() { + @Test void testAnyInProjectNullable() { final String sql = "select deptno, name = ANY (\n" + " select mgr from emp)\n" + "from dept"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testSelectAnyCorrelated() { + @Test void testSelectAnyCorrelated() { final String sql = "select empno > ANY (\n" + " select deptno from dept where emp.job = dept.name)\n" + "from emp\n"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testWhereAnyCorrelatedInSelect() { + @Test void testWhereAnyCorrelatedInSelect() { final String sql = "select * from emp where empno > ANY (\n" + " select deptno from dept where emp.job = dept.name)\n"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testSomeWithEquality() { + @Test void testSomeWithEquality() { final String sql = "select * from emp e1\n" + " where e1.deptno = SOME (select deptno from dept)"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testSomeWithEquality2() { + @Test void testSomeWithEquality2() { final String sql = "select * from emp e1\n" + " where e1.ename= SOME (select name from dept)"; checkSubQuery(sql).withLateDecorrelation(true).check(); @@ -5784,14 +5784,14 @@ private Sql checkSubQuery(String sql) { /** Test case for * [CALCITE-1546] * Sub-queries connected by OR. */ - @Test public void testWhereOrSubQuery() { + @Test void testWhereOrSubQuery() { final String sql = "select * from emp\n" + "where sal = 4\n" + "or empno NOT IN (select deptno from dept)"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testExpandProjectIn() throws Exception { + @Test void testExpandProjectIn() throws Exception { final String sql = "select empno,\n" + " deptno in (select deptno from sales.emp where empno < 20) as d\n" + "from sales.emp"; @@ -5800,7 +5800,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testExpandProjectInNullable() throws Exception { + @Test void testExpandProjectInNullable() throws Exception { final String sql = "with e2 as (\n" + " select empno, case when true then deptno else null end as deptno\n" + " from sales.emp)\n" @@ -5812,7 +5812,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testExpandProjectInComposite() throws Exception { + @Test void testExpandProjectInComposite() throws Exception { final String sql = "select empno, (empno, deptno) in (\n" + " select empno, deptno from sales.emp where empno < 20) as d\n" + "from sales.emp"; @@ -5821,7 +5821,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testExpandProjectExists() throws Exception { + @Test void testExpandProjectExists() throws Exception { final String sql = "select empno,\n" + " exists (select deptno from sales.emp where empno < 20) as d\n" + "from sales.emp"; @@ -5830,7 +5830,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testExpandFilterScalar() throws Exception { + @Test void testExpandFilterScalar() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where (select deptno from sales.emp where empno < 20)\n" @@ -5839,7 +5839,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).check(); } - @Test public void testExpandFilterIn() throws Exception { + @Test void testExpandFilterIn() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where deptno in (select deptno from sales.emp where empno < 20)\n" @@ -5847,7 +5847,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).check(); } - @Test public void testExpandFilterInComposite() throws Exception { + @Test void testExpandFilterInComposite() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where (empno, deptno) in (\n" @@ -5857,7 +5857,7 @@ private Sql checkSubQuery(String sql) { } /** An IN filter that requires full 3-value logic (true, false, unknown). */ - @Test public void testExpandFilterIn3Value() throws Exception { + @Test void testExpandFilterIn3Value() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where empno\n" @@ -5873,7 +5873,7 @@ private Sql checkSubQuery(String sql) { } /** An EXISTS filter that can be converted into true/false. */ - @Test public void testExpandFilterExists() throws Exception { + @Test void testExpandFilterExists() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where exists (select deptno from sales.emp where empno < 20)\n" @@ -5882,7 +5882,7 @@ private Sql checkSubQuery(String sql) { } /** An EXISTS filter that can be converted into a semi-join. */ - @Test public void testExpandFilterExistsSimple() throws Exception { + @Test void testExpandFilterExistsSimple() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where exists (select deptno from sales.emp where empno < 20)"; @@ -5890,7 +5890,7 @@ private Sql checkSubQuery(String sql) { } /** An EXISTS filter that can be converted into a semi-join. */ - @Test public void testExpandFilterExistsSimpleAnd() throws Exception { + @Test void testExpandFilterExistsSimpleAnd() throws Exception { final String sql = "select empno\n" + "from sales.emp\n" + "where exists (select deptno from sales.emp where empno < 20)\n" @@ -5898,7 +5898,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).check(); } - @Test public void testExpandJoinScalar() throws Exception { + @Test void testExpandJoinScalar() throws Exception { final String sql = "select empno\n" + "from sales.emp left join sales.dept\n" + "on (select deptno from sales.emp where empno < 20)\n" @@ -5909,7 +5909,7 @@ private Sql checkSubQuery(String sql) { /** Test case for * [CALCITE-3121] * VolcanoPlanner hangs due to sub-query with dynamic star. */ - @Test public void testSubQueryWithDynamicStarHang() { + @Test void testSubQueryWithDynamicStarHang() { String sql = "select n.n_regionkey from (select * from " + "(select * from sales.customer) t) n where n.n_nationkey >1"; @@ -5960,7 +5960,7 @@ private Sql checkSubQuery(String sql) { /** Test case for * [CALCITE-3188] * IndexOutOfBoundsException in ProjectFilterTransposeRule when executing SELECT COUNT(*). */ - @Test public void testProjectFilterTransposeRuleOnEmptyRowType() { + @Test void testProjectFilterTransposeRuleOnEmptyRowType() { final RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build()); // build a rel equivalent to sql: // select `empty` from emp @@ -5988,7 +5988,7 @@ private Sql checkSubQuery(String sql) { } @Disabled("[CALCITE-1045]") - @Test public void testExpandJoinIn() throws Exception { + @Test void testExpandJoinIn() throws Exception { final String sql = "select empno\n" + "from sales.emp left join sales.dept\n" + "on emp.deptno in (select deptno from sales.emp where empno < 20)"; @@ -5996,7 +5996,7 @@ private Sql checkSubQuery(String sql) { } @Disabled("[CALCITE-1045]") - @Test public void testExpandJoinInComposite() throws Exception { + @Test void testExpandJoinInComposite() throws Exception { final String sql = "select empno\n" + "from sales.emp left join sales.dept\n" + "on (emp.empno, dept.deptno) in (\n" @@ -6004,14 +6004,14 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).check(); } - @Test public void testExpandJoinExists() throws Exception { + @Test void testExpandJoinExists() throws Exception { final String sql = "select empno\n" + "from sales.emp left join sales.dept\n" + "on exists (select deptno from sales.emp where empno < 20)"; checkSubQuery(sql).check(); } - @Test public void testDecorrelateExists() throws Exception { + @Test void testDecorrelateExists() throws Exception { final String sql = "select * from sales.emp\n" + "where EXISTS (\n" + " select * from emp e where emp.deptno = e.deptno)"; @@ -6022,7 +6022,7 @@ private Sql checkSubQuery(String sql) { * [CALCITE-1511] * AssertionError while decorrelating query with two EXISTS * sub-queries. */ - @Test public void testDecorrelateTwoExists() throws Exception { + @Test void testDecorrelateTwoExists() throws Exception { final String sql = "select * from sales.emp\n" + "where EXISTS (\n" + " select * from emp e where emp.deptno = e.deptno)\n" @@ -6035,7 +6035,7 @@ private Sql checkSubQuery(String sql) { * [CALCITE-2028] * Un-correlated IN sub-query should be converted into a Join, * rather than a Correlate without correlation variables . */ - @Test public void testDecorrelateUncorrelatedInAndCorrelatedExists() throws Exception { + @Test void testDecorrelateUncorrelatedInAndCorrelatedExists() throws Exception { final String sql = "select * from sales.emp\n" + "WHERE job in (\n" + " select job from emp ee where ee.sal=34)" @@ -6047,7 +6047,7 @@ private Sql checkSubQuery(String sql) { /** Test case for * [CALCITE-1537] * Unnecessary project expression in multi-sub-query plan. */ - @Test public void testDecorrelateTwoIn() throws Exception { + @Test void testDecorrelateTwoIn() throws Exception { final String sql = "select sal\n" + "from sales.emp\n" + "where empno IN (\n" @@ -6062,7 +6062,7 @@ private Sql checkSubQuery(String sql) { * Decorrelate sub-queries in Project and Join, with the added * complication that there are two sub-queries. */ @Disabled("[CALCITE-1045]") - @Test public void testDecorrelateTwoScalar() throws Exception { + @Test void testDecorrelateTwoScalar() throws Exception { final String sql = "select deptno,\n" + " (select min(1) from emp where empno > d.deptno) as i0,\n" + " (select min(0) from emp\n" @@ -6071,7 +6071,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testWhereInJoinCorrelated() { + @Test void testWhereInJoinCorrelated() { final String sql = "select empno from emp as e\n" + "join dept as d using (deptno)\n" + "where e.sal in (\n" @@ -6084,13 +6084,13 @@ private Sql checkSubQuery(String sql) { * Inefficient plan for correlated sub-queries. In "planAfter", there * must be only one scan each of emp and dept. We don't need a separate * value-generator for emp.job. */ - @Test public void testWhereInCorrelated() { + @Test void testWhereInCorrelated() { final String sql = "select sal from emp where empno IN (\n" + " select deptno from dept where emp.job = dept.name)"; checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testWhereExpressionInCorrelated() { + @Test void testWhereExpressionInCorrelated() { final String sql = "select ename from (\n" + " select ename, deptno, sal + 1 as salPlus from emp) as e\n" + "where deptno in (\n" @@ -6098,7 +6098,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testWhereExpressionInCorrelated2() { + @Test void testWhereExpressionInCorrelated2() { final String sql = "select name from (\n" + " select name, deptno, deptno - 10 as deptnoMinus from dept) as d\n" + "where deptno in (\n" @@ -6106,7 +6106,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).withLateDecorrelation(true).check(); } - @Test public void testExpandWhereComparisonCorrelated() throws Exception { + @Test void testExpandWhereComparisonCorrelated() throws Exception { final String sql = "select empno\n" + "from sales.emp as e\n" + "where sal = (\n" @@ -6114,7 +6114,7 @@ private Sql checkSubQuery(String sql) { checkSubQuery(sql).check(); } - @Test public void testCustomColumnResolvingInNonCorrelatedSubQuery() { + @Test void testCustomColumnResolvingInNonCorrelatedSubQuery() { final String sql = "select *\n" + "from struct.t t1\n" + "where c0 in (\n" @@ -6131,7 +6131,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testCustomColumnResolvingInCorrelatedSubQuery() { + @Test void testCustomColumnResolvingInCorrelatedSubQuery() { final String sql = "select *\n" + "from struct.t t1\n" + "where c0 = (\n" @@ -6148,7 +6148,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testCustomColumnResolvingInCorrelatedSubQuery2() { + @Test void testCustomColumnResolvingInCorrelatedSubQuery2() { final String sql = "select *\n" + "from struct.t t1\n" + "where c0 in (\n" @@ -6168,7 +6168,7 @@ private Sql checkSubQuery(String sql) { /** Test case for * [CALCITE-2744] * RelDecorrelator use wrong output map for LogicalAggregate decorrelate. */ - @Test public void testDecorrelateAggWithConstantGroupKey() { + @Test void testDecorrelateAggWithConstantGroupKey() { final String sql = "SELECT * FROM emp A where sal in\n" + "(SELECT max(sal) FROM emp B where A.mgr = B.empno group by deptno, 'abc')"; sql(sql) @@ -6180,7 +6180,7 @@ private Sql checkSubQuery(String sql) { /** Test case for CALCITE-2744 for aggregate decorrelate with multi-param agg call * but without group key. */ - @Test public void testDecorrelateAggWithMultiParamsAggCall() { + @Test void testDecorrelateAggWithMultiParamsAggCall() { final String sql = "SELECT * FROM (SELECT MYAGG(sal, 1) AS c FROM emp) as m,\n" + " LATERAL TABLE(ramp(m.c)) AS T(s)"; sql(sql) @@ -6192,7 +6192,7 @@ private Sql checkSubQuery(String sql) { /** Same as {@link #testDecorrelateAggWithMultiParamsAggCall} * but with a constant group key. */ - @Test public void testDecorrelateAggWithMultiParamsAggCall2() { + @Test void testDecorrelateAggWithMultiParamsAggCall2() { final String sql = "SELECT * FROM " + "(SELECT MYAGG(sal, 1) AS c FROM emp group by empno, 'abc') as m,\n" + " LATERAL TABLE(ramp(m.c)) AS T(s)"; @@ -6208,7 +6208,7 @@ private Sql checkSubQuery(String sql) { * Converting predicates on date dimension columns into date ranges, * specifically a rule that converts {@code EXTRACT(YEAR FROM ...) = constant} * to a range. */ - @Test public void testExtractYearToRange() { + @Test void testExtractYearToRange() { final String sql = "select *\n" + "from sales.emp_b as e\n" + "where extract(year from birthdate) = 2014"; @@ -6219,7 +6219,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testExtractYearMonthToRange() { + @Test void testExtractYearMonthToRange() { final String sql = "select *\n" + "from sales.emp_b as e\n" + "where extract(year from birthdate) = 2014" @@ -6231,7 +6231,7 @@ private Sql checkSubQuery(String sql) { .check(); } - @Test public void testFilterRemoveIsNotDistinctFromRule() { + @Test void testFilterRemoveIsNotDistinctFromRule() { final DiffRepository diffRepos = getDiffRepos(); final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build()); RelNode root = builder @@ -6259,7 +6259,7 @@ private Sql checkSubQuery(String sql) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testOversimplifiedCaseStatement() { + @Test void testOversimplifiedCaseStatement() { String sql = "select * from emp " + "where MGR > 0 and " + "case when MGR > 0 then deptno / MGR else null end > 1"; @@ -6271,14 +6271,14 @@ private Sql checkSubQuery(String sql) { * [CALCITE-2726] * ReduceExpressionRule may oversimplify filter conditions containing nulls. */ - @Test public void testNoOversimplificationBelowIsNull() { + @Test void testNoOversimplificationBelowIsNull() { String sql = "select * from emp where ( (empno=1 and mgr=1) or (empno=null and mgr=1) ) is null"; sql(sql).withRule(ReduceExpressionsRule.FILTER_INSTANCE) .check(); } - @Test public void testExchangeRemoveConstantKeysRule() { + @Test void testExchangeRemoveConstantKeysRule() { final DiffRepository diffRepos = getDiffRepos(); final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build()); RelNode root = builder @@ -6311,7 +6311,7 @@ private Sql checkSubQuery(String sql) { diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testReduceAverageWithNoReduceSum() { + @Test void testReduceAverageWithNoReduceSum() { final EnumSet functionsToReduce = EnumSet.of(SqlKind.AVG); final RelOptRule rule = new AggregateReduceFunctionsRule(LogicalAggregate.class, RelFactories.LOGICAL_BUILDER, functionsToReduce); @@ -6320,7 +6320,7 @@ private Sql checkSubQuery(String sql) { sql(sql).withRule(rule).check(); } - @Test public void testNoReduceAverage() { + @Test void testNoReduceAverage() { final EnumSet functionsToReduce = EnumSet.noneOf(SqlKind.class); final RelOptRule rule = new AggregateReduceFunctionsRule(LogicalAggregate.class, RelFactories.LOGICAL_BUILDER, functionsToReduce); @@ -6329,7 +6329,7 @@ private Sql checkSubQuery(String sql) { sql(sql).withRule(rule).checkUnchanged(); } - @Test public void testNoReduceSum() { + @Test void testNoReduceSum() { final EnumSet functionsToReduce = EnumSet.noneOf(SqlKind.class); final RelOptRule rule = new AggregateReduceFunctionsRule(LogicalAggregate.class, RelFactories.LOGICAL_BUILDER, functionsToReduce); @@ -6338,7 +6338,7 @@ private Sql checkSubQuery(String sql) { sql(sql).withRule(rule).checkUnchanged(); } - @Test public void testReduceAverageAndVarWithNoReduceStddev() { + @Test void testReduceAverageAndVarWithNoReduceStddev() { // configure rule to reduce AVG and VAR_POP functions // other functions like SUM, STDDEV won't be reduced final EnumSet functionsToReduce = EnumSet.of(SqlKind.AVG, SqlKind.VAR_POP); @@ -6350,7 +6350,7 @@ private Sql checkSubQuery(String sql) { sql(sql).withRule(rule).check(); } - @Test public void testReduceAverageAndSumWithNoReduceStddevAndVar() { + @Test void testReduceAverageAndSumWithNoReduceStddevAndVar() { // configure rule to reduce AVG and SUM functions // other functions like VAR_POP, STDDEV_POP won't be reduced final EnumSet functionsToReduce = EnumSet.of(SqlKind.AVG, SqlKind.SUM); @@ -6362,7 +6362,7 @@ private Sql checkSubQuery(String sql) { sql(sql).withRule(rule).check(); } - @Test public void testReduceAllAggregateFunctions() { + @Test void testReduceAllAggregateFunctions() { // configure rule to reduce all used functions final EnumSet functionsToReduce = EnumSet.of(SqlKind.AVG, SqlKind.SUM, SqlKind.STDDEV_POP, SqlKind.STDDEV_SAMP, SqlKind.VAR_POP, SqlKind.VAR_SAMP); @@ -6378,13 +6378,13 @@ private Sql checkSubQuery(String sql) { * [CALCITE-2803] * Identify expanded IS NOT DISTINCT FROM expression when pushing project past join. */ - @Test public void testPushProjectWithIsNotDistinctFromPastJoin() { + @Test void testPushProjectWithIsNotDistinctFromPastJoin() { final String sql = "select e.sal + b.comm from emp e inner join bonus b\n" + "on (e.ename || e.job) IS NOT DISTINCT FROM (b.ename || b.job) and e.deptno = 10"; sql(sql).withRule(ProjectJoinTransposeRule.INSTANCE).check(); } - @Test public void testDynamicStarWithUnion() { + @Test void testDynamicStarWithUnion() { String sql = "(select n_nationkey from SALES.CUSTOMER) union all\n" + "(select n_name from CUSTOMER_MODIFIABLEVIEW)"; @@ -6418,7 +6418,7 @@ private Sql checkSubQuery(String sql) { getDiffRepos().assertEquals("planAfter", "${planAfter}", planAfter); } - @Test public void testFilterAndProjectWithMultiJoin() throws Exception { + @Test void testFilterAndProjectWithMultiJoin() throws Exception { final HepProgram preProgram = new HepProgramBuilder() .addRuleCollection(Arrays.asList(MyFilterRule.INSTANCE, MyProjectRule.INSTANCE)) .build(); @@ -6445,7 +6445,7 @@ private Sql checkSubQuery(String sql) { * [CALCITE-3151] * RexCall's Monotonicity is not considered in determining a Calc's collation */ - @Test public void testMonotonicityUDF() throws Exception { + @Test void testMonotonicityUDF() throws Exception { final SqlFunction monotonicityFun = new SqlFunction("MONOFUN", SqlKind.OTHER_FUNCTION, ReturnTypes.BIGINT, null, OperandTypes.NILADIC, SqlFunctionCategory.USER_DEFINED_FUNCTION) { @@ -6488,7 +6488,7 @@ private Sql checkSubQuery(String sql) { assertEquals(collationBefore, collationAfter); } - @Test public void testPushFiltertWithIsNotDistinctFromPastJoin() { + @Test void testPushFiltertWithIsNotDistinctFromPastJoin() { String query = "SELECT * FROM " + "emp t1 INNER JOIN " + "emp t2 " @@ -6586,7 +6586,7 @@ private MyProjectRule(Class clazz, } } - @Test public void testSortJoinCopyInnerJoinOrderBy() { + @Test void testSortJoinCopyInnerJoinOrderBy() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -6597,7 +6597,7 @@ private MyProjectRule(Class clazz, .check(); } - @Test public void testSortJoinCopyInnerJoinOrderByLimit() { + @Test void testSortJoinCopyInnerJoinOrderByLimit() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -6609,7 +6609,7 @@ private MyProjectRule(Class clazz, .check(); } - @Test public void testSortJoinCopyInnerJoinOrderByTwoFields() { + @Test void testSortJoinCopyInnerJoinOrderByTwoFields() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); @@ -6623,7 +6623,7 @@ private MyProjectRule(Class clazz, .check(); } - @Test public void testSortJoinCopySemiJoinOrderBy() { + @Test void testSortJoinCopySemiJoinOrderBy() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SemiJoinRule.PROJECT) .build(); @@ -6634,7 +6634,7 @@ private MyProjectRule(Class clazz, .check(); } - @Test public void testSortJoinCopySemiJoinOrderByLimitOffset() { + @Test void testSortJoinCopySemiJoinOrderByLimitOffset() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SemiJoinRule.PROJECT) .build(); @@ -6646,7 +6646,7 @@ private MyProjectRule(Class clazz, .check(); } - @Test public void testSortJoinCopySemiJoinOrderByOffset() { + @Test void testSortJoinCopySemiJoinOrderByOffset() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SemiJoinRule.PROJECT) .build(); @@ -6663,7 +6663,7 @@ private MyProjectRule(Class clazz, * Decorrelator gives empty result * after decorrelating sort rel with null offset and fetch */ - @Test public void testDecorrelationWithSort() { + @Test void testDecorrelationWithSort() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -6680,7 +6680,7 @@ private MyProjectRule(Class clazz, * [CALCITE-3319] * AssertionError for ReduceDecimalsRule */ - @Test public void testReduceDecimal() { + @Test void testReduceDecimal() { final HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterToCalcRule.INSTANCE) .addRuleInstance(ReduceDecimalsRule.INSTANCE) @@ -6689,7 +6689,7 @@ private MyProjectRule(Class clazz, sql(sql).with(program).check(); } - @Test public void testEnumerableCalcRule() { + @Test void testEnumerableCalcRule() { final String sql = "select FNAME, LNAME from SALES.CUSTOMER where CONTACTNO > 10"; VolcanoPlanner planner = new VolcanoPlanner(null, null); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); @@ -6730,31 +6730,31 @@ private MyProjectRule(Class clazz, * in AggregateExpandDistinctAggregatesRule * when all the other agg expressions are distinct and have same arguments */ - @Test public void testMaxReuseDistinctAttrWithMixedOptionality() { + @Test void testMaxReuseDistinctAttrWithMixedOptionality() { final String sql = "select sum(distinct deptno), count(distinct deptno), " + "max(deptno) from emp"; sql(sql).withRule(AggregateExpandDistinctAggregatesRule.INSTANCE).check(); } - @Test public void testMinReuseDistinctAttrWithMixedOptionality() { + @Test void testMinReuseDistinctAttrWithMixedOptionality() { final String sql = "select sum(distinct deptno), count(distinct deptno), " + "min(deptno) from emp"; sql(sql).withRule(AggregateExpandDistinctAggregatesRule.INSTANCE).check(); } - @Test public void testBitAndReuseDistinctAttrWithMixedOptionality() { + @Test void testBitAndReuseDistinctAttrWithMixedOptionality() { final String sql = "select sum(distinct deptno), count(distinct deptno), " + "bit_and(deptno) from emp"; sql(sql).withRule(AggregateExpandDistinctAggregatesRule.INSTANCE).check(); } - @Test public void testBitOrReuseDistinctAttrWithMixedOptionality() { + @Test void testBitOrReuseDistinctAttrWithMixedOptionality() { final String sql = "select sum(distinct deptno), count(distinct deptno), " + "bit_or(deptno) from emp"; sql(sql).withRule(AggregateExpandDistinctAggregatesRule.INSTANCE).check(); } - @Test public void testProjectJoinTransposeItem() { + @Test void testProjectJoinTransposeItem() { ProjectJoinTransposeRule projectJoinTransposeRule = new ProjectJoinTransposeRule(Project.class, Join.class, skipItem, RelFactories .LOGICAL_BUILDER); @@ -6766,7 +6766,7 @@ private MyProjectRule(Class clazz, sql(query).withTester(t -> createDynamicTester()).withRule(projectJoinTransposeRule).check(); } - @Test public void testSimplifyItemIsNotNull() { + @Test void testSimplifyItemIsNotNull() { String query = "select * from sales.customer as t1 where t1.c_nationkey[0] is not null"; sql(query) @@ -6775,7 +6775,7 @@ private MyProjectRule(Class clazz, .checkUnchanged(); } - @Test public void testSimplifyItemIsNull() { + @Test void testSimplifyItemIsNull() { String query = "select * from sales.customer as t1 where t1.c_nationkey[0] is null"; sql(query) diff --git a/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java b/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java index 45ee93895f92..4241444dfdd4 100644 --- a/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java +++ b/core/src/test/java/org/apache/calcite/test/RexImplicationCheckerTest.java @@ -65,7 +65,7 @@ public class RexImplicationCheckerTest { //~ Methods ---------------------------------------------------------------- // Simple Tests for Operators - @Test public void testSimpleGreaterCond() { + @Test void testSimpleGreaterCond() { final Fixture f = new Fixture(); final RexNode iGt10 = f.gt(f.i, f.literal(10)); final RexNode iGt30 = f.gt(f.i, f.literal(30)); @@ -87,7 +87,7 @@ public class RexImplicationCheckerTest { f.checkImplies(iGe30, iGe30); } - @Test public void testSimpleLesserCond() { + @Test void testSimpleLesserCond() { final Fixture f = new Fixture(); final RexNode iLt10 = f.lt(f.i, f.literal(10)); final RexNode iLt30 = f.lt(f.i, f.literal(30)); @@ -110,7 +110,7 @@ public class RexImplicationCheckerTest { f.checkImplies(iLe30, iLe30); } - @Test public void testSimpleEq() { + @Test void testSimpleEq() { final Fixture f = new Fixture(); final RexNode iEq30 = f.eq(f.i, f.literal(30)); final RexNode iNe10 = f.ne(f.i, f.literal(10)); @@ -124,7 +124,7 @@ public class RexImplicationCheckerTest { } // Simple Tests for DataTypes - @Test public void testSimpleDec() { + @Test void testSimpleDec() { final Fixture f = new Fixture(); final RexNode node1 = f.lt(f.dec, f.floatLiteral(30.9)); final RexNode node2 = f.lt(f.dec, f.floatLiteral(40.33)); @@ -133,7 +133,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(node2, node1); } - @Test public void testSimpleBoolean() { + @Test void testSimpleBoolean() { final Fixture f = new Fixture(); final RexNode bEqTrue = f.eq(f.bl, f.rexBuilder.makeLiteral(true)); final RexNode bEqFalse = f.eq(f.bl, f.rexBuilder.makeLiteral(false)); @@ -143,7 +143,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(bEqTrue, bEqFalse); } - @Test public void testSimpleLong() { + @Test void testSimpleLong() { final Fixture f = new Fixture(); final RexNode xGeBig = f.ge(f.lg, f.longLiteral(324324L)); final RexNode xGtBigger = f.gt(f.lg, f.longLiteral(324325L)); @@ -155,7 +155,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(xGeBig, xGtBigger); } - @Test public void testSimpleShort() { + @Test void testSimpleShort() { final Fixture f = new Fixture(); final RexNode xGe10 = f.ge(f.sh, f.shortLiteral((short) 10)); final RexNode xGe11 = f.ge(f.sh, f.shortLiteral((short) 11)); @@ -164,7 +164,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(xGe10, xGe11); } - @Test public void testSimpleChar() { + @Test void testSimpleChar() { final Fixture f = new Fixture(); final RexNode xGeB = f.ge(f.ch, f.charLiteral("b")); final RexNode xGeA = f.ge(f.ch, f.charLiteral("a")); @@ -173,14 +173,14 @@ public class RexImplicationCheckerTest { f.checkNotImplies(xGeA, xGeB); } - @Test public void testSimpleString() { + @Test void testSimpleString() { final Fixture f = new Fixture(); final RexNode node1 = f.eq(f.str, f.rexBuilder.makeLiteral("en")); f.checkImplies(node1, node1); } - @Test public void testSimpleDate() { + @Test void testSimpleDate() { final Fixture f = new Fixture(); final DateString d = DateString.fromCalendarFields(Util.calendar()); final RexNode node1 = f.ge(f.d, f.dateLiteral(d)); @@ -196,7 +196,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(nodeBe2, nodeBe1); } - @Test public void testSimpleTimeStamp() { + @Test void testSimpleTimeStamp() { final Fixture f = new Fixture(); final TimestampString ts = TimestampString.fromCalendarFields(Util.calendar()); @@ -215,7 +215,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(nodeBe2, nodeBe1); } - @Test public void testSimpleTime() { + @Test void testSimpleTime() { final Fixture f = new Fixture(); final TimeString t = TimeString.fromCalendarFields(Util.calendar()); final RexNode node1 = f.lt(f.t, f.timeLiteral(t)); @@ -224,7 +224,7 @@ public class RexImplicationCheckerTest { f.checkNotImplies(node2, node1); } - @Test public void testSimpleBetween() { + @Test void testSimpleBetween() { final Fixture f = new Fixture(); final RexNode iGe30 = f.ge(f.i, f.literal(30)); final RexNode iLt70 = f.lt(f.i, f.literal(70)); @@ -243,7 +243,7 @@ public class RexImplicationCheckerTest { f.checkImplies(iGe50AndLt60, iGe30); } - @Test public void testSimpleBetweenCornerCases() { + @Test void testSimpleBetweenCornerCases() { final Fixture f = new Fixture(); final RexNode node1 = f.gt(f.i, f.literal(30)); final RexNode node2 = f.gt(f.i, f.literal(50)); @@ -263,7 +263,7 @@ public class RexImplicationCheckerTest { * {@code x > 1 OR (y > 2 AND z > 4)} * implies * {@code (y > 3 AND z > 5)}. */ - @Test public void testOr() { + @Test void testOr() { final Fixture f = new Fixture(); final RexNode xGt1 = f.gt(f.i, f.literal(1)); final RexNode yGt2 = f.gt(f.dec, f.literal(2)); @@ -277,7 +277,7 @@ public class RexImplicationCheckerTest { f.checkImplies(yGt3AndZGt5, or); } - @Test public void testNotNull() { + @Test void testNotNull() { final Fixture f = new Fixture(); final RexNode node1 = f.eq(f.str, f.rexBuilder.makeLiteral("en")); final RexNode node2 = f.notNull(f.str); @@ -288,7 +288,7 @@ public class RexImplicationCheckerTest { f.checkImplies(node2, node2); } - @Test public void testIsNull() { + @Test void testIsNull() { final Fixture f = new Fixture(); final RexNode sEqEn = f.eq(f.str, f.charLiteral("en")); final RexNode sIsNotNull = f.notNull(f.str); @@ -341,7 +341,7 @@ public class RexImplicationCheckerTest { * NOT NULL and match nullability. * * @see RexSimplify#simplifyPreservingType(RexNode, RexUnknownAs, boolean) */ - @Test public void testSimplifyCastMatchNullability() { + @Test void testSimplifyCastMatchNullability() { final Fixture f = new Fixture(); // The cast is nullable, while the literal is not nullable. When we simplify @@ -376,7 +376,7 @@ public class RexImplicationCheckerTest { } /** Test case for simplifier of ceil/floor. */ - @Test public void testSimplifyCeilFloor() { + @Test void testSimplifyCeilFloor() { // We can add more time units here once they are supported in // RexInterpreter, e.g., TimeUnitRange.HOUR, TimeUnitRange.MINUTE, // TimeUnitRange.SECOND. diff --git a/core/src/test/java/org/apache/calcite/test/RexShuttleTest.java b/core/src/test/java/org/apache/calcite/test/RexShuttleTest.java index 4f181211762d..7ec9a295d217 100644 --- a/core/src/test/java/org/apache/calcite/test/RexShuttleTest.java +++ b/core/src/test/java/org/apache/calcite/test/RexShuttleTest.java @@ -40,12 +40,12 @@ /** * Unit tests for {@link RexShuttle} */ -public class RexShuttleTest { +class RexShuttleTest { /** Test case for * [CALCITE-3165] * Project#accept(RexShuttle shuttle) does not update rowType. */ - @Test public void testProjectUpdatesRowType() { + @Test void testProjectUpdatesRowType() { final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build()); // Equivalent SQL: SELECT deptno, sal FROM emp @@ -79,7 +79,7 @@ public class RexShuttleTest { assertThat(type, is(type2)); } - @Test public void testCalcUpdatesRowType() { + @Test void testCalcUpdatesRowType() { final RelBuilder builder = RelBuilder.create(RelBuilderTest.config().build()); // Equivalent SQL: SELECT deptno, sal, sal + 20 FROM emp diff --git a/core/src/test/java/org/apache/calcite/test/RexTransformerTest.java b/core/src/test/java/org/apache/calcite/test/RexTransformerTest.java index ea85f208a3f3..ed9b0b42d535 100644 --- a/core/src/test/java/org/apache/calcite/test/RexTransformerTest.java +++ b/core/src/test/java/org/apache/calcite/test/RexTransformerTest.java @@ -52,7 +52,7 @@ /** * Tests transformations on rex nodes. */ -public class RexTransformerTest { +class RexTransformerTest { //~ Instance fields -------------------------------------------------------- RexBuilder rexBuilder = null; @@ -175,7 +175,7 @@ private RexNode isTrue(RexNode node) { return rexBuilder.makeCall(SqlStdOperatorTable.IS_TRUE, node); } - @Test public void testPreTests() { + @Test void testPreTests() { // can make variable nullable? RexNode node = new RexInputRef( @@ -195,7 +195,7 @@ private RexNode isTrue(RexNode node) { assertFalse(node.getType().isNullable()); } - @Test public void testNonBooleans() { + @Test void testNonBooleans() { RexNode node = plus(x, y); String expected = node.toString(); check(Boolean.TRUE, node, expected); @@ -209,7 +209,7 @@ private RexNode isTrue(RexNode node) { * like (x IS NOT NULL) AND (y IS NOT NULL) AND (x OR y) an incorrect result * could be produced */ - @Test public void testOrUnchanged() { + @Test void testOrUnchanged() { RexNode node = or(x, y); String expected = node.toString(); check(Boolean.TRUE, node, expected); @@ -217,7 +217,7 @@ private RexNode isTrue(RexNode node) { check(null, node, expected); } - @Test public void testSimpleAnd() { + @Test void testSimpleAnd() { RexNode node = and(x, y); check( Boolean.FALSE, @@ -225,7 +225,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), AND($0, $1))"); } - @Test public void testSimpleEquals() { + @Test void testSimpleEquals() { RexNode node = equals(x, y); check( Boolean.TRUE, @@ -233,7 +233,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), =($0, $1))"); } - @Test public void testSimpleNotEquals() { + @Test void testSimpleNotEquals() { RexNode node = notEquals(x, y); check( Boolean.FALSE, @@ -241,7 +241,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), <>($0, $1))"); } - @Test public void testSimpleGreaterThan() { + @Test void testSimpleGreaterThan() { RexNode node = greaterThan(x, y); check( Boolean.TRUE, @@ -249,7 +249,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), >($0, $1))"); } - @Test public void testSimpleGreaterEquals() { + @Test void testSimpleGreaterEquals() { RexNode node = greaterThanOrEqual(x, y); check( Boolean.FALSE, @@ -257,7 +257,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), >=($0, $1))"); } - @Test public void testSimpleLessThan() { + @Test void testSimpleLessThan() { RexNode node = lessThan(x, y); check( Boolean.TRUE, @@ -265,7 +265,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), <($0, $1))"); } - @Test public void testSimpleLessEqual() { + @Test void testSimpleLessEqual() { RexNode node = lessThanOrEqual(x, y); check( Boolean.FALSE, @@ -273,19 +273,19 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), IS NOT NULL($1)), <=($0, $1))"); } - @Test public void testOptimizeNonNullLiterals() { + @Test void testOptimizeNonNullLiterals() { RexNode node = lessThanOrEqual(x, trueRex); check(Boolean.TRUE, node, "AND(IS NOT NULL($0), <=($0, true))"); node = lessThanOrEqual(trueRex, x); check(Boolean.FALSE, node, "AND(IS NOT NULL($0), <=(true, $0))"); } - @Test public void testSimpleIdentifier() { + @Test void testSimpleIdentifier() { RexNode node = rexBuilder.makeInputRef(boolRelDataType, 0); check(Boolean.TRUE, node, "=(IS TRUE($0), true)"); } - @Test public void testMixed1() { + @Test void testMixed1() { // x=true AND y RexNode op1 = equals(x, trueRex); RexNode and = and(op1, y); @@ -295,7 +295,7 @@ private RexNode isTrue(RexNode node) { "AND(IS NOT NULL($1), AND(AND(IS NOT NULL($0), =($0, true)), $1))"); } - @Test public void testMixed2() { + @Test void testMixed2() { // x!=true AND y>z RexNode op1 = notEquals(x, trueRex); RexNode op2 = greaterThan(y, z); @@ -306,7 +306,7 @@ private RexNode isTrue(RexNode node) { "AND(AND(IS NOT NULL($0), <>($0, true)), AND(AND(IS NOT NULL($1), IS NOT NULL($2)), >($1, $2)))"); } - @Test public void testMixed3() { + @Test void testMixed3() { // x=y AND false>z RexNode op1 = equals(x, y); RexNode op2 = greaterThan(falseRex, z); @@ -323,7 +323,7 @@ private RexNode isTrue(RexNode node) { * and * [CALCITE-1344] * Incorrect inferred precision when BigDecimal value is less than 1. */ - @Test public void testExactLiteral() { + @Test void testExactLiteral() { final RexLiteral literal = rexBuilder.makeExactLiteral(new BigDecimal("-1234.56")); assertThat(literal.getType().getFullTypeString(), @@ -353,7 +353,7 @@ private RexNode isTrue(RexNode node) { * [CALCITE-833] * RelOptUtil.splitJoinCondition attempts to split a Join-Condition which * has a remaining condition. */ - @Test public void testSplitJoinCondition() { + @Test void testSplitJoinCondition() { final String sql = "select *\n" + "from emp a\n" + "INNER JOIN dept b\n" @@ -380,7 +380,7 @@ private RexNode isTrue(RexNode node) { } /** Test case for {@link org.apache.calcite.rex.LogicVisitor}. */ - @Test public void testLogic() { + @Test void testLogic() { // x > FALSE AND ((y = z) IS NOT NULL) final RexNode node = and(greaterThan(x, falseRex), isNotNull(equals(y, z))); assertThat(deduceLogic(node, x, Logic.TRUE_FALSE), diff --git a/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java b/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java index 528b8031a0eb..02b17388416f 100644 --- a/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java +++ b/core/src/test/java/org/apache/calcite/test/ScannableTableTest.java @@ -67,7 +67,7 @@ * Unit test for {@link org.apache.calcite.schema.ScannableTable}. */ public class ScannableTableTest { - @Test public void testTens() throws SQLException { + @Test void testTens() throws SQLException { final Enumerator cursor = tens(); assertTrue(cursor.moveNext()); assertThat(cursor.current()[0], equalTo((Object) 0)); @@ -82,7 +82,7 @@ public class ScannableTableTest { } /** A table with one column. */ - @Test public void testSimple() throws Exception { + @Test void testSimple() throws Exception { CalciteAssert.that() .with(newSchema("s", Pair.of("simple", new SimpleTable()))) .query("select * from \"s\".\"simple\"") @@ -90,7 +90,7 @@ public class ScannableTableTest { } /** A table with two columns. */ - @Test public void testSimple2() throws Exception { + @Test void testSimple2() throws Exception { CalciteAssert.that() .with(newSchema("s", Pair.of("beatles", new BeatlesTable()))) .query("select * from \"s\".\"beatles\"") @@ -101,7 +101,7 @@ public class ScannableTableTest { } /** A filter on a {@link FilterableTable} with two columns (cooperative). */ - @Test public void testFilterableTableCooperative() throws Exception { + @Test void testFilterableTableCooperative() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesFilterableTable(buf, true); final String explain = "PLAN=" @@ -119,7 +119,7 @@ public class ScannableTableTest { } /** A filter on a {@link FilterableTable} with two columns (noncooperative). */ - @Test public void testFilterableTableNonCooperative() throws Exception { + @Test void testFilterableTableNonCooperative() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesFilterableTable(buf, false); final String explain = "PLAN=" @@ -136,7 +136,7 @@ public class ScannableTableTest { /** A filter on a {@link org.apache.calcite.schema.ProjectableFilterableTable} * with two columns (cooperative). */ - @Test public void testProjectableFilterableCooperative() throws Exception { + @Test void testProjectableFilterableCooperative() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, true); final String explain = "PLAN=" @@ -153,7 +153,7 @@ public class ScannableTableTest { assertThat(buf.toString(), is("returnCount=2, filter=4, projects=[1]")); } - @Test public void testProjectableFilterableNonCooperative() throws Exception { + @Test void testProjectableFilterableNonCooperative() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, false); final String explain = "PLAN=" @@ -170,7 +170,7 @@ public class ScannableTableTest { /** A filter on a {@link org.apache.calcite.schema.ProjectableFilterableTable} * with two columns, and a project in the query. (Cooperative)*/ - @Test public void testProjectableFilterableWithProjectAndFilter() throws Exception { + @Test void testProjectableFilterableWithProjectAndFilter() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, true); final String explain = "PLAN=" @@ -188,7 +188,7 @@ public class ScannableTableTest { /** A filter on a {@link org.apache.calcite.schema.ProjectableFilterableTable} * with two columns, and a project in the query (NonCooperative). */ - @Test public void testProjectableFilterableWithProjectFilterNonCooperative() + @Test void testProjectableFilterableWithProjectFilterNonCooperative() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, false); @@ -210,7 +210,7 @@ public class ScannableTableTest { * {@link org.apache.calcite.schema.ProjectableFilterableTable}. The table * refuses to execute the filter, so Calcite should add a pull up and * transform the filter (projecting the column needed by the filter). */ - @Test public void testPFTableRefusesFilterCooperative() throws Exception { + @Test void testPFTableRefusesFilterCooperative() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, false); final String explain = "PLAN=EnumerableInterpreter\n" @@ -225,7 +225,7 @@ public class ScannableTableTest { is("returnCount=4, projects=[2, 0]")); } - @Test public void testPFPushDownProjectFilterInAggregateNoGroup() { + @Test void testPFPushDownProjectFilterInAggregateNoGroup() { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, false); final String explain = "PLAN=EnumerableAggregate(group=[{}], M=[MAX($0)])\n" @@ -238,7 +238,7 @@ public class ScannableTableTest { .returnsUnordered("M=1943"); } - @Test public void testPFPushDownProjectFilterAggregateGroup() { + @Test void testPFPushDownProjectFilterAggregateGroup() { final String sql = "select \"i\", count(*) as c\n" + "from \"s\".\"beatles\"\n" + "where \"k\" > 1900\n" @@ -259,7 +259,7 @@ public class ScannableTableTest { "i=6; C=1"); } - @Test public void testPFPushDownProjectFilterAggregateNested() { + @Test void testPFPushDownProjectFilterAggregateNested() { final StringBuilder buf = new StringBuilder(); final String sql = "select \"k\", count(*) as c\n" + "from (\n" @@ -302,7 +302,7 @@ private static Integer getFilter(boolean cooperative, List filters) { * [CALCITE-458] * ArrayIndexOutOfBoundsException when using just a single column in * interpreter. */ - @Test public void testPFTableRefusesFilterSingleColumn() throws Exception { + @Test void testPFTableRefusesFilterSingleColumn() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, false); final String explain = "PLAN=" @@ -320,7 +320,7 @@ private static Integer getFilter(boolean cooperative, List filters) { /** Test case for * [CALCITE-3405] * Prune columns for ProjectableFilterable when project is not simple mapping. */ - @Test public void testPushNonSimpleMappingProject() throws Exception { + @Test void testPushNonSimpleMappingProject() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, true); final String explain = "PLAN=" @@ -343,7 +343,7 @@ private static Integer getFilter(boolean cooperative, List filters) { /** Test case for * [CALCITE-3405] * Prune columns for ProjectableFilterable when project is not simple mapping. */ - @Test public void testPushSimpleMappingProject() throws Exception { + @Test void testPushSimpleMappingProject() throws Exception { final StringBuilder buf = new StringBuilder(); final Table table = new BeatlesProjectableFilterableTable(buf, true); // Note that no redundant Project on EnumerableInterpreter @@ -367,7 +367,7 @@ private static Integer getFilter(boolean cooperative, List filters) { * Stack overflow error thrown when running join query * Test two ProjectableFilterableTable can join and produce right plan. */ - @Test public void testProjectableFilterableTableJoin() throws Exception { + @Test void testProjectableFilterableTableJoin() throws Exception { final StringBuilder buf = new StringBuilder(); final String explain = "PLAN=" + "EnumerableNestedLoopJoin(condition=[true], joinType=[inner])\n" @@ -389,7 +389,7 @@ private static Integer getFilter(boolean cooperative, List filters) { /** Test case for * [CALCITE-1031] * In prepared statement, CsvScannableTable.scan is called twice. */ - @Test public void testPrepared2() throws SQLException { + @Test void testPrepared2() throws SQLException { final Properties properties = new Properties(); properties.setProperty("caseSensitive", "true"); try (Connection connection = @@ -545,7 +545,7 @@ public static class BeatlesProjectableFilterableTable private final StringBuilder buf; private final boolean cooperative; - public BeatlesProjectableFilterableTable(StringBuilder buf, + BeatlesProjectableFilterableTable(StringBuilder buf, boolean cooperative) { this.buf = buf; this.cooperative = cooperative; diff --git a/core/src/test/java/org/apache/calcite/test/SqlAdvisorJdbcTest.java b/core/src/test/java/org/apache/calcite/test/SqlAdvisorJdbcTest.java index 6b6fead29f9f..ea163c28a076 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlAdvisorJdbcTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlAdvisorJdbcTest.java @@ -38,7 +38,7 @@ /** * Tests for {@link org.apache.calcite.sql.advise.SqlAdvisor}. */ -public class SqlAdvisorJdbcTest { +class SqlAdvisorJdbcTest { private void adviseSql(int apiVersion, String sql, Consumer checker) throws SQLException { @@ -78,7 +78,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) connection.close(); } - @Test public void testSqlAdvisorGetHintsFunction() + @Test void testSqlAdvisorGetHintsFunction() throws SQLException, ClassNotFoundException { adviseSql(1, "select e.e^ from \"emps\" e", CalciteAssert.checkResultUnordered( @@ -86,7 +86,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) "id=empid; names=[empid]; type=COLUMN")); } - @Test public void testSqlAdvisorGetHintsFunction2() + @Test void testSqlAdvisorGetHintsFunction2() throws SQLException, ClassNotFoundException { adviseSql(2, "select [e].e^ from [emps] e", CalciteAssert.checkResultUnordered( @@ -94,7 +94,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) "id=empid; names=[empid]; type=COLUMN; replacement=empid")); } - @Test public void testSqlAdvisorNonExistingColumn() + @Test void testSqlAdvisorNonExistingColumn() throws SQLException, ClassNotFoundException { adviseSql(1, "select e.empdid_wrong_name.^ from \"hr\".\"emps\" e", CalciteAssert.checkResultUnordered( @@ -102,7 +102,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) "id=; names=null; type=MATCH")); } - @Test public void testSqlAdvisorNonStructColumn() + @Test void testSqlAdvisorNonStructColumn() throws SQLException, ClassNotFoundException { adviseSql(1, "select e.\"empid\".^ from \"hr\".\"emps\" e", CalciteAssert.checkResultUnordered( @@ -110,7 +110,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) "id=; names=null; type=MATCH")); } - @Test public void testSqlAdvisorSubSchema() + @Test void testSqlAdvisorSubSchema() throws SQLException, ClassNotFoundException { adviseSql(1, "select * from \"hr\".^.test_test_test", CalciteAssert.checkResultUnordered( @@ -122,7 +122,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) "id=hr; names=[hr]; type=SCHEMA")); } - @Test public void testSqlAdvisorSubSchema2() + @Test void testSqlAdvisorSubSchema2() throws SQLException, ClassNotFoundException { adviseSql(2, "select * from [hr].^.test_test_test", CalciteAssert.checkResultUnordered( @@ -134,7 +134,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) "id=hr; names=[hr]; type=SCHEMA; replacement=hr")); } - @Test public void testSqlAdvisorTableInSchema() + @Test void testSqlAdvisorTableInSchema() throws SQLException, ClassNotFoundException { adviseSql(1, "select * from \"hr\".^", CalciteAssert.checkResultUnordered( @@ -149,7 +149,7 @@ private void adviseSql(int apiVersion, String sql, Consumer checker) /** * Tests {@link org.apache.calcite.sql.advise.SqlAdvisorGetHintsFunction}. */ - @Test public void testSqlAdvisorSchemaNames() + @Test void testSqlAdvisorSchemaNames() throws SQLException, ClassNotFoundException { adviseSql(1, "select empid from \"emps\" e, ^", CalciteAssert.checkResultUnordered( diff --git a/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java b/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java index fb140079246f..75779b1e03c3 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java @@ -68,12 +68,12 @@ *

    Developers, please use {@link org.hamcrest.MatcherAssert#assertThat assertThat} * rather than {@code assertEquals}. */ -public class SqlFunctionsTest { - @Test public void testCharLength() { +class SqlFunctionsTest { + @Test void testCharLength() { assertThat(charLength("xyz"), is(3)); } - @Test public void testToString() { + @Test void testToString() { assertThat(SqlFunctions.toString(0f), is("0E0")); assertThat(SqlFunctions.toString(1f), is("1")); assertThat(SqlFunctions.toString(1.5f), is("1.5")); @@ -102,7 +102,7 @@ public class SqlFunctionsTest { assertThat(SqlFunctions.toString(new BigDecimal("-5e-12")), is("-5E-12")); } - @Test public void testConcat() { + @Test void testConcat() { assertThat(concat("a b", "cd"), is("a bcd")); // The code generator will ensure that nulls are never passed in. If we // pass in null, it is treated like the string "null", as the following @@ -112,7 +112,7 @@ public class SqlFunctionsTest { assertThat(concat(null, "b"), is("nullb")); } - @Test public void testPosixRegex() { + @Test void testPosixRegex() { assertThat(posixRegex("abc", "abc", true), is(true)); assertThat(posixRegex("abc", "^a", true), is(true)); assertThat(posixRegex("abc", "(b|d)", true), is(true)); @@ -132,7 +132,7 @@ public class SqlFunctionsTest { assertThat(posixRegex("abcq", "[[:xdigit:]]", false), is(true)); } - @Test public void testRegexpReplace() { + @Test void testRegexpReplace() { assertThat(regexpReplace("a b c", "b", "X"), is("a X c")); assertThat(regexpReplace("abc def ghi", "[g-z]+", "X"), is("abc def X")); assertThat(regexpReplace("abc def ghi", "[a-z]+", "X"), is("X X X")); @@ -169,11 +169,11 @@ public class SqlFunctionsTest { } } - @Test public void testLower() { + @Test void testLower() { assertThat(lower("A bCd Iijk"), is("a bcd iijk")); } - @Test public void testFromBase64() { + @Test void testFromBase64() { final List expectedList = Arrays.asList("", "\0", "0", "a", " ", "\n", "\r\n", "\u03C0", "hello\tword"); @@ -186,7 +186,7 @@ public class SqlFunctionsTest { assertThat(fromBase64("-1"), nullValue()); } - @Test public void testToBase64() { + @Test void testToBase64() { final String s = "" + "This is a test String. check resulte out of 76This is a test String." + "This is a test String.This is a test String.This is a test String." @@ -209,11 +209,11 @@ public class SqlFunctionsTest { assertThat(toBase64(""), is("")); } - @Test public void testUpper() { + @Test void testUpper() { assertThat(upper("A bCd iIjk"), is("A BCD IIJK")); } - @Test public void testInitcap() { + @Test void testInitcap() { assertThat(initcap("aA"), is("Aa")); assertThat(initcap("zz"), is("Zz")); assertThat(initcap("AZ"), is("Az")); @@ -223,7 +223,7 @@ public class SqlFunctionsTest { assertThat(initcap(" b0123B"), is(" B0123b")); } - @Test public void testLesser() { + @Test void testLesser() { assertThat(lesser("a", "bc"), is("a")); assertThat(lesser("bc", "ac"), is("ac")); try { @@ -236,7 +236,7 @@ public class SqlFunctionsTest { assertThat(lesser((String) null, null), nullValue()); } - @Test public void testGreater() { + @Test void testGreater() { assertThat(greater("a", "bc"), is("bc")); assertThat(greater("bc", "ac"), is("bc")); try { @@ -250,7 +250,7 @@ public class SqlFunctionsTest { } /** Test for {@link SqlFunctions#rtrim}. */ - @Test public void testRtrim() { + @Test void testRtrim() { assertThat(rtrim(""), is("")); assertThat(rtrim(" "), is("")); assertThat(rtrim(" x "), is(" x")); @@ -261,7 +261,7 @@ public class SqlFunctionsTest { } /** Test for {@link SqlFunctions#ltrim}. */ - @Test public void testLtrim() { + @Test void testLtrim() { assertThat(ltrim(""), is("")); assertThat(ltrim(" "), is("")); assertThat(ltrim(" x "), is("x ")); @@ -272,7 +272,7 @@ public class SqlFunctionsTest { } /** Test for {@link SqlFunctions#trim}. */ - @Test public void testTrim() { + @Test void testTrim() { assertThat(trimSpacesBoth(""), is("")); assertThat(trimSpacesBoth(" "), is("")); assertThat(trimSpacesBoth(" x "), is("x")); @@ -286,7 +286,7 @@ static String trimSpacesBoth(String s) { return trim(true, true, " ", s); } - @Test public void testAddMonths() { + @Test void testAddMonths() { checkAddMonths(2016, 1, 1, 2016, 2, 1, 1); checkAddMonths(2016, 1, 1, 2017, 1, 1, 12); checkAddMonths(2016, 1, 1, 2017, 2, 1, 13); @@ -325,7 +325,7 @@ private long d2ts(int date, int millis) { return date * DateTimeUtils.MILLIS_PER_DAY + millis; } - @Test public void testFloor() { + @Test void testFloor() { checkFloor(0, 10, 0); checkFloor(27, 10, 20); checkFloor(30, 10, 30); @@ -343,7 +343,7 @@ private void checkFloor(int x, int y, int result) { is(BigDecimal.valueOf(result))); } - @Test public void testCeil() { + @Test void testCeil() { checkCeil(0, 10, 0); checkCeil(27, 10, 30); checkCeil(30, 10, 30); @@ -364,7 +364,7 @@ private void checkCeil(int x, int y, int result) { /** Unit test for * {@link Utilities#compare(java.util.List, java.util.List)}. */ - @Test public void testCompare() { + @Test void testCompare() { final List ac = Arrays.asList("a", "c"); final List abc = Arrays.asList("a", "b", "c"); final List a = Collections.singletonList("a"); @@ -379,7 +379,7 @@ private void checkCeil(int x, int y, int result) { assertThat(Utilities.compare(empty, empty), is(0)); } - @Test public void testTruncateLong() { + @Test void testTruncateLong() { assertThat(SqlFunctions.truncate(12345L, 1000L), is(12000L)); assertThat(SqlFunctions.truncate(12000L, 1000L), is(12000L)); assertThat(SqlFunctions.truncate(12001L, 1000L), is(12000L)); @@ -391,7 +391,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.truncate(-11999L, 1000L), is(-12000L)); } - @Test public void testTruncateInt() { + @Test void testTruncateInt() { assertThat(SqlFunctions.truncate(12345, 1000), is(12000)); assertThat(SqlFunctions.truncate(12000, 1000), is(12000)); assertThat(SqlFunctions.truncate(12001, 1000), is(12000)); @@ -408,7 +408,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.round(-12845, 1000), is(-13000)); } - @Test public void testSTruncateDouble() { + @Test void testSTruncateDouble() { assertThat(SqlFunctions.struncate(12.345d, 3), within(12.345d, 0.001)); assertThat(SqlFunctions.struncate(12.345d, 2), within(12.340d, 0.001)); assertThat(SqlFunctions.struncate(12.345d, 1), within(12.300d, 0.001)); @@ -433,7 +433,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.struncate(-12000d, -5), within(0d, 0.001)); } - @Test public void testSTruncateLong() { + @Test void testSTruncateLong() { assertThat(SqlFunctions.struncate(12345L, -3), within(12000d, 0.001)); assertThat(SqlFunctions.struncate(12000L, -3), within(12000d, 0.001)); assertThat(SqlFunctions.struncate(12001L, -3), within(12000d, 0.001)); @@ -448,7 +448,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.struncate(-12000L, -5), within(0d, 0.001)); } - @Test public void testSTruncateInt() { + @Test void testSTruncateInt() { assertThat(SqlFunctions.struncate(12345, -3), within(12000d, 0.001)); assertThat(SqlFunctions.struncate(12000, -3), within(12000d, 0.001)); assertThat(SqlFunctions.struncate(12001, -3), within(12000d, 0.001)); @@ -463,7 +463,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.struncate(-12000, -5), within(0d, 0.001)); } - @Test public void testSRoundDouble() { + @Test void testSRoundDouble() { assertThat(SqlFunctions.sround(12.345d, 3), within(12.345d, 0.001)); assertThat(SqlFunctions.sround(12.345d, 2), within(12.350d, 0.001)); assertThat(SqlFunctions.sround(12.345d, 1), within(12.300d, 0.001)); @@ -496,7 +496,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.sround(-12000d, -5), within(0d, 0.001)); } - @Test public void testSRoundLong() { + @Test void testSRoundLong() { assertThat(SqlFunctions.sround(12345L, -1), within(12350d, 0.001)); assertThat(SqlFunctions.sround(12345L, -2), within(12300d, 0.001)); assertThat(SqlFunctions.sround(12345L, -3), within(12000d, 0.001)); @@ -515,7 +515,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.sround(-12000L, -5), within(0d, 0.001)); } - @Test public void testSRoundInt() { + @Test void testSRoundInt() { assertThat(SqlFunctions.sround(12345, -1), within(12350d, 0.001)); assertThat(SqlFunctions.sround(12345, -2), within(12300d, 0.001)); assertThat(SqlFunctions.sround(12345, -3), within(12000d, 0.001)); @@ -534,7 +534,7 @@ private void checkCeil(int x, int y, int result) { assertThat(SqlFunctions.sround(-12000, -5), within(0d, 0.001)); } - @Test public void testByteString() { + @Test void testByteString() { final byte[] bytes = {(byte) 0xAB, (byte) 0xFF}; final ByteString byteString = new ByteString(bytes); assertThat(byteString.length(), is(2)); @@ -609,7 +609,7 @@ private void thereAndBack(byte[] bytes) { assertThat(byteString, equalTo(byteString1)); } - @Test public void testEqWithAny() { + @Test void testEqWithAny() { // Non-numeric same type equality check assertThat(SqlFunctions.eqAny("hello", "hello"), is(true)); @@ -627,7 +627,7 @@ private void thereAndBack(byte[] bytes) { assertThat(SqlFunctions.eqAny("2", 2), is(false)); } - @Test public void testNeWithAny() { + @Test void testNeWithAny() { // Non-numeric same type inequality check assertThat(SqlFunctions.neAny("hello", "world"), is(true)); @@ -645,7 +645,7 @@ private void thereAndBack(byte[] bytes) { assertThat(SqlFunctions.neAny("2", 2), is(true)); } - @Test public void testLtWithAny() { + @Test void testLtWithAny() { // Non-numeric same type "less then" check assertThat(SqlFunctions.ltAny("apple", "banana"), is(true)); @@ -671,7 +671,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testLeWithAny() { + @Test void testLeWithAny() { // Non-numeric same type "less or equal" check assertThat(SqlFunctions.leAny("apple", "banana"), is(true)); assertThat(SqlFunctions.leAny("apple", "apple"), is(true)); @@ -706,7 +706,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testGtWithAny() { + @Test void testGtWithAny() { // Non-numeric same type "greater then" check assertThat(SqlFunctions.gtAny("banana", "apple"), is(true)); @@ -732,7 +732,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testGeWithAny() { + @Test void testGeWithAny() { // Non-numeric same type "greater or equal" check assertThat(SqlFunctions.geAny("banana", "apple"), is(true)); assertThat(SqlFunctions.geAny("apple", "apple"), is(true)); @@ -767,7 +767,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testPlusAny() { + @Test void testPlusAny() { // null parameters assertThat(SqlFunctions.plusAny(null, null), nullValue()); assertThat(SqlFunctions.plusAny(null, 1), nullValue()); @@ -797,7 +797,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testMinusAny() { + @Test void testMinusAny() { // null parameters assertThat(SqlFunctions.minusAny(null, null), nullValue()); assertThat(SqlFunctions.minusAny(null, 1), nullValue()); @@ -827,7 +827,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testMultiplyAny() { + @Test void testMultiplyAny() { // null parameters assertThat(SqlFunctions.multiplyAny(null, null), nullValue()); assertThat(SqlFunctions.multiplyAny(null, 1), nullValue()); @@ -859,7 +859,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testDivideAny() { + @Test void testDivideAny() { // null parameters assertThat(SqlFunctions.divideAny(null, null), nullValue()); assertThat(SqlFunctions.divideAny(null, 1), nullValue()); @@ -892,7 +892,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testMultiset() { + @Test void testMultiset() { final List abacee = Arrays.asList("a", "b", "a", "c", "e", "e"); final List adaa = Arrays.asList("a", "d", "a", "a"); final List addc = Arrays.asList("a", "d", "c", "d", "c"); @@ -945,7 +945,7 @@ private void thereAndBack(byte[] bytes) { is(Arrays.asList("a", "c", "d"))); } - @Test public void testMd5() { + @Test void testMd5() { assertThat("d41d8cd98f00b204e9800998ecf8427e", is(md5(""))); assertThat("d41d8cd98f00b204e9800998ecf8427e", is(md5(ByteString.of("", 16)))); assertThat("902fbdd2b1df0c4f70b4a5d23525e932", is(md5("ABC"))); @@ -959,7 +959,7 @@ private void thereAndBack(byte[] bytes) { } } - @Test public void testSha1() { + @Test void testSha1() { assertThat("da39a3ee5e6b4b0d3255bfef95601890afd80709", is(sha1(""))); assertThat("da39a3ee5e6b4b0d3255bfef95601890afd80709", is(sha1(ByteString.of("", 16)))); assertThat("3c01bdbb26f358bab27f267924aa2c9a03fcfdb8", is(sha1("ABC"))); diff --git a/core/src/test/java/org/apache/calcite/test/SqlHintsConverterTest.java b/core/src/test/java/org/apache/calcite/test/SqlHintsConverterTest.java index d8c128499327..adc40b221ecb 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlHintsConverterTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlHintsConverterTest.java @@ -96,7 +96,7 @@ /** * Unit test for {@link org.apache.calcite.rel.hint.RelHint}. */ -public class SqlHintsConverterTest extends SqlToRelTestBase { +class SqlHintsConverterTest extends SqlToRelTestBase { protected DiffRepository getDiffRepos() { return DiffRepository.lookup(SqlHintsConverterTest.class); @@ -104,7 +104,7 @@ protected DiffRepository getDiffRepos() { //~ Tests ------------------------------------------------------------------ - @Test public void testQueryHint() { + @Test void testQueryHint() { final String sql = HintTools.withHint("select /*+ %s */ *\n" + "from emp e1\n" + "inner join dept d1 on e1.deptno = d1.deptno\n" @@ -112,40 +112,40 @@ protected DiffRepository getDiffRepos() { sql(sql).ok(); } - @Test public void testQueryHintWithLiteralOptions() { + @Test void testQueryHintWithLiteralOptions() { final String sql = "select /*+ time_zone(1, 1.23, 'a bc', -1.0) */ *\n" + "from emp"; sql(sql).ok(); } - @Test public void testNestedQueryHint() { + @Test void testNestedQueryHint() { final String sql = "select /*+ resource(parallelism='3'), repartition(10) */ empno\n" + "from (select /*+ resource(mem='20Mb')*/ empno, ename from emp)"; sql(sql).ok(); } - @Test public void testTwoLevelNestedQueryHint() { + @Test void testTwoLevelNestedQueryHint() { final String sql = "select /*+ resource(parallelism='3'), no_hash_join */ empno\n" + "from (select /*+ resource(mem='20Mb')*/ empno, ename\n" + "from emp left join dept on emp.deptno = dept.deptno)"; sql(sql).ok(); } - @Test public void testThreeLevelNestedQueryHint() { + @Test void testThreeLevelNestedQueryHint() { final String sql = "select /*+ index(idx1), no_hash_join */ * from emp /*+ index(empno) */\n" + "e1 join dept/*+ index(deptno) */ d1 on e1.deptno = d1.deptno\n" + "join emp e2 on d1.name = e2.job"; sql(sql).ok(); } - @Test public void testFourLevelNestedQueryHint() { + @Test void testFourLevelNestedQueryHint() { final String sql = "select /*+ index(idx1), no_hash_join */ * from emp /*+ index(empno) */\n" + "e1 join dept/*+ index(deptno) */ d1 on e1.deptno = d1.deptno join\n" + "(select max(sal) as sal from emp /*+ index(empno) */) e2 on e1.sal = e2.sal"; sql(sql).ok(); } - @Test public void testAggregateHints() { + @Test void testAggregateHints() { final String sql = "select /*+ AGG_STRATEGY(TWO_PHASE), RESOURCE(mem='1024') */\n" + "count(deptno), avg_sal from (\n" + "select /*+ AGG_STRATEGY(ONE_PHASE) */ avg(sal) as avg_sal, deptno\n" @@ -153,7 +153,7 @@ protected DiffRepository getDiffRepos() { sql(sql).ok(); } - @Test public void testHintsInSubQueryWithDecorrelation() { + @Test void testHintsInSubQueryWithDecorrelation() { final String sql = "select /*+ resource(parallelism='3'), AGG_STRATEGY(TWO_PHASE) */\n" + "sum(e1.empno) from emp e1, dept d1\n" + "where e1.deptno = d1.deptno\n" @@ -162,7 +162,7 @@ protected DiffRepository getDiffRepos() { sql(sql).withTester(t -> t.withDecorrelation(true)).ok(); } - @Test public void testHintsInSubQueryWithDecorrelation2() { + @Test void testHintsInSubQueryWithDecorrelation2() { final String sql = "select /*+ properties(k1='v1', k2='v2'), index(ename), no_hash_join */\n" + "sum(e1.empno) from emp e1, dept d1\n" + "where e1.deptno = d1.deptno\n" @@ -174,7 +174,7 @@ protected DiffRepository getDiffRepos() { sql(sql).withTester(t -> t.withDecorrelation(true)).ok(); } - @Test public void testHintsInSubQueryWithDecorrelation3() { + @Test void testHintsInSubQueryWithDecorrelation3() { final String sql = "select /*+ resource(parallelism='3'), index(ename), no_hash_join */\n" + "sum(e1.empno) from emp e1, dept d1\n" + "where e1.deptno = d1.deptno\n" @@ -186,7 +186,7 @@ protected DiffRepository getDiffRepos() { sql(sql).withTester(t -> t.withDecorrelation(true)).ok(); } - @Test public void testHintsInSubQueryWithoutDecorrelation() { + @Test void testHintsInSubQueryWithoutDecorrelation() { final String sql = "select /*+ resource(parallelism='3') */\n" + "sum(e1.empno) from emp e1, dept d1\n" + "where e1.deptno = d1.deptno\n" @@ -195,7 +195,7 @@ protected DiffRepository getDiffRepos() { sql(sql).ok(); } - @Test public void testInvalidQueryHint() { + @Test void testInvalidQueryHint() { final String sql = "select /*+ weird_hint */ empno\n" + "from (select /*+ resource(mem='20Mb')*/ empno, ename\n" + "from emp left join dept on emp.deptno = dept.deptno)"; @@ -223,7 +223,7 @@ protected DiffRepository getDiffRepos() { .fails(error2); } - @Test public void testTableHintsInJoin() { + @Test void testTableHintsInJoin() { final String sql = "select\n" + "ename, job, sal, dept.name\n" + "from emp /*+ index(idx1, idx2) */\n" @@ -232,12 +232,12 @@ protected DiffRepository getDiffRepos() { sql(sql).ok(); } - @Test public void testTableHintsInSelect() { + @Test void testTableHintsInSelect() { final String sql = HintTools.withHint("select * from emp /*+ %s */"); sql(sql).ok(); } - @Test public void testSameHintsWithDifferentInheritPath() { + @Test void testSameHintsWithDifferentInheritPath() { final String sql = "select /*+ properties(k1='v1', k2='v2') */\n" + "ename, job, sal, dept.name\n" + "from emp /*+ index(idx1, idx2) */\n" @@ -246,7 +246,7 @@ protected DiffRepository getDiffRepos() { sql(sql).ok(); } - @Test public void testTableHintsInInsert() throws Exception { + @Test void testTableHintsInInsert() throws Exception { final String sql = HintTools.withHint("insert into dept /*+ %s */ (deptno, name) " + "select deptno, name from dept"); final SqlInsert insert = (SqlInsert) tester.parseQuery(sql); @@ -262,7 +262,7 @@ protected DiffRepository getDiffRepos() { hints); } - @Test public void testTableHintsInUpdate() throws Exception { + @Test void testTableHintsInUpdate() throws Exception { final String sql = HintTools.withHint("update emp /*+ %s */ " + "set name = 'test' where deptno = 1"); final SqlUpdate sqlUpdate = (SqlUpdate) tester.parseQuery(sql); @@ -278,7 +278,7 @@ protected DiffRepository getDiffRepos() { hints); } - @Test public void testTableHintsInDelete() throws Exception { + @Test void testTableHintsInDelete() throws Exception { final String sql = HintTools.withHint("delete from emp /*+ %s */ where deptno = 1"); final SqlDelete sqlDelete = (SqlDelete) tester.parseQuery(sql); assert sqlDelete.getTargetTable() instanceof SqlTableRef; @@ -293,7 +293,7 @@ protected DiffRepository getDiffRepos() { hints); } - @Test public void testTableHintsInMerge() throws Exception { + @Test void testTableHintsInMerge() throws Exception { final String sql = "merge into emps\n" + "/*+ %s */ e\n" + "using tempemps as t\n" @@ -317,7 +317,7 @@ protected DiffRepository getDiffRepos() { hints); } - @Test public void testInvalidTableHints() { + @Test void testInvalidTableHints() { final String sql = "select\n" + "ename, job, sal, dept.name\n" + "from emp /*+ weird_hint(idx1, idx2) */\n" @@ -333,7 +333,7 @@ protected DiffRepository getDiffRepos() { sql(sql1).warns("Hint: WEIRD_KV_HINT should be registered in the HintStrategyTable"); } - @Test public void testJoinHintRequiresSpecificInputs() { + @Test void testJoinHintRequiresSpecificInputs() { final String sql = "select /*+ use_hash_join(r, s), use_hash_join(emp, dept) */\n" + "ename, job, sal, dept.name\n" + "from emp join dept on emp.deptno = dept.deptno"; @@ -341,7 +341,7 @@ protected DiffRepository getDiffRepos() { sql(sql).ok(); } - @Test public void testHintsForCalc() { + @Test void testHintsForCalc() { final String sql = "select /*+ resource(mem='1024MB')*/ ename, sal, deptno from emp"; final RelNode rel = tester.convertSqlToRel(sql).rel; final RelHint hint = RelHint.builder("RESOURCE") @@ -357,7 +357,7 @@ protected DiffRepository getDiffRepos() { new ValidateHintVisitor(hint, Calc.class).go(newRel); } - @Test public void testHintsPropagationInHepPlannerRules() { + @Test void testHintsPropagationInHepPlannerRules() { final String sql = "select /*+ use_hash_join(r, s), use_hash_join(emp, dept) */\n" + "ename, job, sal, dept.name\n" + "from emp join dept on emp.deptno = dept.deptno"; @@ -377,7 +377,7 @@ protected DiffRepository getDiffRepos() { new ValidateHintVisitor(hint, Join.class).go(newRel); } - @Test public void testHintsPropagationInVolcanoPlannerRules() { + @Test void testHintsPropagationInVolcanoPlannerRules() { final String sql = "select /*+ use_hash_join(r, s), use_hash_join(emp, dept) */\n" + "ename, job, sal, dept.name\n" + "from emp join dept on emp.deptno = dept.deptno"; @@ -414,7 +414,7 @@ protected DiffRepository getDiffRepos() { Collections.emptyList(), Collections.emptyList()); } - @Test public void testHintsPropagateWithDifferentKindOfRels() { + @Test void testHintsPropagateWithDifferentKindOfRels() { final String sql = "select /*+ AGG_STRATEGY(TWO_PHASE) */\n" + "ename, avg(sal)\n" + "from emp group by ename"; @@ -434,7 +434,7 @@ protected DiffRepository getDiffRepos() { new ValidateHintVisitor(hint, Aggregate.class).go(newRel); } - @Test public void testUseMergeJoin() { + @Test void testUseMergeJoin() { final String sql = "select /*+ use_merge_join(emp, dept) */\n" + "ename, job, sal, dept.name\n" + "from emp join dept on emp.deptno = dept.deptno"; diff --git a/core/src/test/java/org/apache/calcite/test/SqlJsonFunctionsTest.java b/core/src/test/java/org/apache/calcite/test/SqlJsonFunctionsTest.java index 1c51f4be44d2..ed11d274e48c 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlJsonFunctionsTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlJsonFunctionsTest.java @@ -54,14 +54,14 @@ /** * Unit test for the methods in {@link SqlFunctions} that implement JSON processing functions. */ -public class SqlJsonFunctionsTest { +class SqlJsonFunctionsTest { - @Test public void testJsonValueExpression() { + @Test void testJsonValueExpression() { assertJsonValueExpression("{}", is(JsonFunctions.JsonValueContext.withJavaObj(Collections.emptyMap()))); } - @Test public void testJsonApiCommonSyntax() { + @Test void testJsonApiCommonSyntax() { assertJsonApiCommonSyntax("{\"foo\": \"bar\"}", "lax $.foo", contextMatches( JsonFunctions.JsonPathContext.withJavaObj(JsonFunctions.PathMode.LAX, "bar"))); @@ -80,7 +80,7 @@ public class SqlJsonFunctionsTest { JsonFunctions.JsonPathContext.withJavaObj(JsonFunctions.PathMode.LAX, 100))); } - @Test public void testJsonExists() { + @Test void testJsonExists() { assertJsonExists( JsonFunctions.JsonPathContext.withJavaObj(JsonFunctions.PathMode.STRICT, "bar"), SqlJsonExistsErrorBehavior.FALSE, @@ -142,7 +142,7 @@ public class SqlJsonFunctionsTest { errorMatches(new RuntimeException("java.lang.Exception: test message"))); } - @Test public void testJsonValueAny() { + @Test void testJsonValueAny() { assertJsonValueAny( JsonFunctions.JsonPathContext .withJavaObj(JsonFunctions.PathMode.LAX, "bar"), @@ -256,7 +256,7 @@ public class SqlJsonFunctionsTest { + "and the actual value is: '[]'", null))); } - @Test public void testJsonQuery() { + @Test void testJsonQuery() { assertJsonQuery( JsonFunctions.JsonPathContext .withJavaObj(JsonFunctions.PathMode.LAX, Collections.singletonList("bar")), @@ -408,12 +408,12 @@ public class SqlJsonFunctionsTest { is("[\"bar\"]")); } - @Test public void testJsonize() { + @Test void testJsonize() { assertJsonize(new HashMap<>(), is("{}")); } - @Test public void assertJsonPretty() { + @Test void assertJsonPretty() { assertJsonPretty( JsonFunctions.JsonValueContext.withJavaObj(new HashMap<>()), is("{ }")); assertJsonPretty( @@ -428,7 +428,7 @@ public class SqlJsonFunctionsTest { JsonFunctions.JsonValueContext.withJavaObj(input), errorMatches(expected)); } - @Test public void testDejsonize() { + @Test void testDejsonize() { assertDejsonize("{}", is(Collections.emptyMap())); assertDejsonize("[]", @@ -443,7 +443,7 @@ public class SqlJsonFunctionsTest { errorMatches(new InvalidJsonException(message))); } - @Test public void testJsonObject() { + @Test void testJsonObject() { assertJsonObject(is("{}"), SqlJsonConstructorNullClause.NULL_ON_NULL); assertJsonObject( is("{\"foo\":\"bar\"}"), SqlJsonConstructorNullClause.NULL_ON_NULL, @@ -459,7 +459,7 @@ public class SqlJsonFunctionsTest { null); } - @Test public void testJsonType() { + @Test void testJsonType() { assertJsonType(is("OBJECT"), "{}"); assertJsonType(is("ARRAY"), "[\"foo\",null]"); @@ -469,7 +469,7 @@ public class SqlJsonFunctionsTest { assertJsonType(is("DOUBLE"), "11.22"); } - @Test public void testJsonDepth() { + @Test void testJsonDepth() { assertJsonDepth(is(1), "{}"); assertJsonDepth(is(1), "false"); assertJsonDepth(is(1), "12"); @@ -481,7 +481,7 @@ public class SqlJsonFunctionsTest { assertJsonDepth(nullValue(), "null"); } - @Test public void testJsonLength() { + @Test void testJsonLength() { assertJsonLength( JsonFunctions.JsonPathContext .withJavaObj(JsonFunctions.PathMode.LAX, Collections.singletonList("bar")), @@ -500,7 +500,7 @@ public class SqlJsonFunctionsTest { is(1)); } - @Test public void testJsonKeys() { + @Test void testJsonKeys() { assertJsonKeys( JsonFunctions.JsonPathContext .withJavaObj(JsonFunctions.PathMode.LAX, Collections.singletonList("bar")), @@ -519,7 +519,7 @@ public class SqlJsonFunctionsTest { is("null")); } - @Test public void testJsonRemove() { + @Test void testJsonRemove() { assertJsonRemove( JsonFunctions.jsonValueExpression("{\"a\": 1, \"b\": [2]}"), new String[]{"$.a"}, @@ -530,13 +530,13 @@ public class SqlJsonFunctionsTest { is("{}")); } - @Test public void testJsonStorageSize() { + @Test void testJsonStorageSize() { assertJsonStorageSize("[100, \"sakila\", [1, 3, 5], 425.05]", is(29)); assertJsonStorageSize("null", is(4)); assertJsonStorageSize(JsonFunctions.JsonValueContext.withJavaObj(null), is(4)); } - @Test public void testJsonObjectAggAdd() { + @Test void testJsonObjectAggAdd() { Map map = new HashMap<>(); Map expected = new HashMap<>(); expected.put("foo", "bar"); @@ -549,7 +549,7 @@ public class SqlJsonFunctionsTest { SqlJsonConstructorNullClause.ABSENT_ON_NULL, is(expected)); } - @Test public void testJsonArray() { + @Test void testJsonArray() { assertJsonArray(is("[]"), SqlJsonConstructorNullClause.NULL_ON_NULL); assertJsonArray( is("[\"foo\"]"), SqlJsonConstructorNullClause.NULL_ON_NULL, "foo"); @@ -564,7 +564,7 @@ public class SqlJsonFunctionsTest { null); } - @Test public void testJsonArrayAggAdd() { + @Test void testJsonArrayAggAdd() { List list = new ArrayList<>(); List expected = new ArrayList<>(); expected.add("foo"); @@ -577,7 +577,7 @@ public class SqlJsonFunctionsTest { SqlJsonConstructorNullClause.ABSENT_ON_NULL, is(expected)); } - @Test public void testJsonPredicate() { + @Test void testJsonPredicate() { assertIsJsonValue("[]", is(true)); assertIsJsonValue("{}", is(true)); assertIsJsonValue("100", is(true)); diff --git a/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java b/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java index fb479e8aeab1..f5562f6464a5 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java @@ -78,7 +78,7 @@ public static List getTypes(RelDataTypeFactory typeFactory) { typeFactory.createSqlType(SqlTypeName.TIMESTAMP, 0)); } - @Test public void testPrintLimits() { + @Test void testPrintLimits() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); final List types = diff --git a/core/src/test/java/org/apache/calcite/test/SqlLineTest.java b/core/src/test/java/org/apache/calcite/test/SqlLineTest.java index 3eb8c4b97c8c..8a7399d589eb 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlLineTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlLineTest.java @@ -41,7 +41,7 @@ /** * Tests that we can invoke SqlLine on a Calcite connection. */ -public class SqlLineTest { +class SqlLineTest { /** * Execute a script with "sqlline -f". * @@ -107,7 +107,7 @@ private void checkScriptFile(String scriptText, boolean flag, assertThat(delete, is(true)); } - @Test public void testSqlLine() throws Throwable { + @Test void testSqlLine() throws Throwable { checkScriptFile("!tables", false, equalTo(SqlLine.Status.OK), equalTo("")); } } diff --git a/core/src/test/java/org/apache/calcite/test/SqlOperatorBindingTest.java b/core/src/test/java/org/apache/calcite/test/SqlOperatorBindingTest.java index 804f4d2f7ced..cac4e3b2b117 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlOperatorBindingTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlOperatorBindingTest.java @@ -45,7 +45,7 @@ * Unit tests for {@link RexProgram} and * {@link RexProgramBuilder}. */ -public class SqlOperatorBindingTest { +class SqlOperatorBindingTest { private RexBuilder rexBuilder; private RelDataType integerDataType; private SqlDataTypeSpec integerType; @@ -64,7 +64,7 @@ public void setUp() { * Add a method to SqlOperatorBinding to determine whether operand is a * literal. */ - @Test public void testSqlNodeLiteral() { + @Test void testSqlNodeLiteral() { final SqlNode literal = SqlLiteral.createExactNumeric( "0", SqlParserPos.ZERO); @@ -91,7 +91,7 @@ public void setUp() { * Add a method to SqlOperatorBinding to determine whether operand is a * literal. */ - @Test public void testRexNodeLiteral() { + @Test void testRexNodeLiteral() { final RexNode literal = rexBuilder.makeZeroLiteral( integerDataType); diff --git a/core/src/test/java/org/apache/calcite/test/SqlStatisticProviderTest.java b/core/src/test/java/org/apache/calcite/test/SqlStatisticProviderTest.java index 9fa9c53c9927..ddfad5119f0c 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlStatisticProviderTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlStatisticProviderTest.java @@ -50,7 +50,7 @@ * Unit test for {@link org.apache.calcite.materialize.SqlStatisticProvider} * and implementations of it. */ -public class SqlStatisticProviderTest { +class SqlStatisticProviderTest { /** Creates a config based on the "foodmart" schema. */ public static Frameworks.ConfigBuilder config() { final SchemaPlus rootSchema = Frameworks.createRootSchema(true); @@ -63,18 +63,18 @@ public static Frameworks.ConfigBuilder config() { .programs(Programs.heuristicJoinOrder(Programs.RULE_SET, true, 2)); } - @Test public void testMapProvider() { + @Test void testMapProvider() { check(MapSqlStatisticProvider.INSTANCE); } - @Test public void testQueryProvider() { + @Test void testQueryProvider() { final boolean debug = CalciteSystemProperty.DEBUG.value(); final Consumer sqlConsumer = debug ? System.out::println : Util::discard; check(new QuerySqlStatisticProvider(sqlConsumer)); } - @Test public void testQueryProviderWithCache() { + @Test void testQueryProviderWithCache() { Cache cache = CacheBuilder.newBuilder() .expireAfterAccess(5, TimeUnit.MINUTES) .build(); diff --git a/core/src/test/java/org/apache/calcite/test/SqlTestGen.java b/core/src/test/java/org/apache/calcite/test/SqlTestGen.java index bebacdd1318e..6f733b0e32f6 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlTestGen.java +++ b/core/src/test/java/org/apache/calcite/test/SqlTestGen.java @@ -37,7 +37,7 @@ /** * Utility to generate a SQL script from validator test. */ -public class SqlTestGen { +class SqlTestGen { private SqlTestGen() {} //~ Methods ---------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterExtendedTest.java b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterExtendedTest.java index 56cfe7e807f2..c18608aa6e2d 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterExtendedTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterExtendedTest.java @@ -34,7 +34,7 @@ /** * Runs {@link org.apache.calcite.test.SqlToRelConverterTest} with extensions. */ -public class SqlToRelConverterExtendedTest extends SqlToRelConverterTest { +class SqlToRelConverterExtendedTest extends SqlToRelConverterTest { Hook.Closeable closeable; @BeforeEach public void before() { diff --git a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java index 0ae6913c6b7b..36c2914489a4 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java @@ -72,7 +72,7 @@ /** * Unit test for {@link org.apache.calcite.sql2rel.SqlToRelConverter}. */ -public class SqlToRelConverterTest extends SqlToRelTestBase { +class SqlToRelConverterTest extends SqlToRelTestBase { protected DiffRepository getDiffRepos() { return DiffRepository.lookup(SqlToRelConverterTest.class); } @@ -83,36 +83,36 @@ public final Sql sql(String sql) { SqlToRelConverter.Config.DEFAULT, tester.getConformance()); } - @Test public void testDotLiteralAfterNestedRow() { + @Test void testDotLiteralAfterNestedRow() { final String sql = "select ((1,2),(3,4,5)).\"EXPR$1\".\"EXPR$2\" from emp"; sql(sql).ok(); } - @Test public void testDotLiteralAfterRow() { + @Test void testDotLiteralAfterRow() { final String sql = "select row(1,2).\"EXPR$1\" from emp"; sql(sql).ok(); } - @Test public void testIntegerLiteral() { + @Test void testIntegerLiteral() { final String sql = "select 1 from emp"; sql(sql).ok(); } - @Test public void testIntervalLiteralYearToMonth() { + @Test void testIntervalLiteralYearToMonth() { final String sql = "select\n" + " cast(empno as Integer) * (INTERVAL '1-1' YEAR TO MONTH)\n" + "from emp"; sql(sql).ok(); } - @Test public void testIntervalLiteralHourToMinute() { + @Test void testIntervalLiteralHourToMinute() { final String sql = "select\n" + " cast(empno as Integer) * (INTERVAL '1:1' HOUR TO MINUTE)\n" + "from emp"; sql(sql).ok(); } - @Test public void testAliasList() { + @Test void testAliasList() { final String sql = "select a + b from (\n" + " select deptno, 1 as uno, name from dept\n" + ") as d(a, b, c)\n" @@ -120,7 +120,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testAliasList2() { + @Test void testAliasList2() { final String sql = "select * from (\n" + " select a, b, c from (values (1, 2, 3)) as t (c, b, a)\n" + ") join dept on dept.deptno = c\n" @@ -132,13 +132,13 @@ public final Sql sql(String sql) { * [CALCITE-2468] * struct type alias should not cause IndexOutOfBoundsException. */ - @Test public void testStructTypeAlias() { + @Test void testStructTypeAlias() { final String sql = "select t.r AS myRow\n" + "from (select row(row(1)) r from dept) t"; sql(sql).ok(); } - @Test public void testJoinUsingDynamicTable() { + @Test void testJoinUsingDynamicTable() { final String sql = "select * from SALES.NATION t1\n" + "join SALES.NATION t2\n" + "using (n_nationkey)"; @@ -148,7 +148,7 @@ public final Sql sql(String sql) { /** * Tests that AND(x, AND(y, z)) gets flattened to AND(x, y, z). */ - @Test public void testMultiAnd() { + @Test void testMultiAnd() { final String sql = "select * from emp\n" + "where deptno < 10\n" + "and deptno > 5\n" @@ -156,7 +156,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testJoinOn() { + @Test void testJoinOn() { final String sql = "SELECT * FROM emp\n" + "JOIN dept on emp.deptno = dept.deptno"; sql(sql).ok(); @@ -165,7 +165,7 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-245] * Off-by-one translation of ON clause of JOIN. */ - @Test public void testConditionOffByOne() { + @Test void testConditionOffByOne() { // Bug causes the plan to contain // LogicalJoin(condition=[=($9, $9)], joinType=[inner]) final String sql = "SELECT * FROM emp\n" @@ -173,39 +173,39 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testConditionOffByOneReversed() { + @Test void testConditionOffByOneReversed() { final String sql = "SELECT * FROM emp\n" + "JOIN dept on dept.deptno = emp.deptno + 0"; sql(sql).ok(); } - @Test public void testJoinOnExpression() { + @Test void testJoinOnExpression() { final String sql = "SELECT * FROM emp\n" + "JOIN dept on emp.deptno + 1 = dept.deptno - 2"; sql(sql).ok(); } - @Test public void testJoinOnIn() { + @Test void testJoinOnIn() { final String sql = "select * from emp join dept\n" + " on emp.deptno = dept.deptno and emp.empno in (1, 3)"; sql(sql).ok(); } - @Test public void testJoinOnInSubQuery() { + @Test void testJoinOnInSubQuery() { final String sql = "select * from emp left join dept\n" + "on emp.empno = 1\n" + "or dept.deptno in (select deptno from emp where empno > 5)"; sql(sql).expand(false).ok(); } - @Test public void testJoinOnExists() { + @Test void testJoinOnExists() { final String sql = "select * from emp left join dept\n" + "on emp.empno = 1\n" + "or exists (select deptno from emp where empno > dept.deptno + 5)"; sql(sql).expand(false).ok(); } - @Test public void testJoinUsing() { + @Test void testJoinUsing() { sql("SELECT * FROM emp JOIN dept USING (deptno)").ok(); } @@ -213,7 +213,7 @@ public final Sql sql(String sql) { * [CALCITE-74] * JOIN ... USING fails in 3-way join with * UnsupportedOperationException. */ - @Test public void testJoinUsingThreeWay() { + @Test void testJoinUsingThreeWay() { final String sql = "select *\n" + "from emp as e\n" + "join dept as d using (deptno)\n" @@ -221,7 +221,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testJoinUsingCompound() { + @Test void testJoinUsingCompound() { final String sql = "SELECT * FROM emp LEFT JOIN (" + "SELECT *, deptno * 5 as empno FROM dept) " + "USING (deptno,empno)"; @@ -231,7 +231,7 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-801] * NullPointerException using USING on table alias with column aliases. */ - @Test public void testValuesUsing() { + @Test void testValuesUsing() { final String sql = "select d.deptno, min(e.empid) as empid\n" + "from (values (100, 'Bill', 1)) as e(empid, name, deptno)\n" + "join (values (1, 'LeaderShip')) as d(deptno, name)\n" @@ -240,17 +240,17 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testJoinNatural() { + @Test void testJoinNatural() { sql("SELECT * FROM emp NATURAL JOIN dept").ok(); } - @Test public void testJoinNaturalNoCommonColumn() { + @Test void testJoinNaturalNoCommonColumn() { final String sql = "SELECT *\n" + "FROM emp NATURAL JOIN (SELECT deptno AS foo, name FROM dept) AS d"; sql(sql).ok(); } - @Test public void testJoinNaturalMultipleCommonColumn() { + @Test void testJoinNaturalMultipleCommonColumn() { final String sql = "SELECT *\n" + "FROM emp\n" + "NATURAL JOIN (SELECT deptno, name AS ename FROM dept) AS d"; @@ -261,7 +261,7 @@ public final Sql sql(String sql) { * [CALCITE-3387] * Query with GROUP BY and JOIN ... USING wrongly fails with * "Column 'DEPTNO' is ambiguous". */ - @Test public void testJoinUsingWithUnqualifiedCommonColumn() { + @Test void testJoinUsingWithUnqualifiedCommonColumn() { final String sql = "SELECT deptno, name\n" + "FROM emp JOIN dept using (deptno)"; sql(sql).ok(); @@ -269,7 +269,7 @@ public final Sql sql(String sql) { /** Similar to {@link #testJoinUsingWithUnqualifiedCommonColumn()}, * but with nested common column. */ - @Test public void testJoinUsingWithUnqualifiedNestedCommonColumn() { + @Test void testJoinUsingWithUnqualifiedNestedCommonColumn() { final String sql = "select (coord).x from\n" + "customer.contact_peek t1\n" @@ -280,7 +280,7 @@ public final Sql sql(String sql) { /** Similar to {@link #testJoinUsingWithUnqualifiedCommonColumn()}, * but with aggregate. */ - @Test public void testJoinUsingWithAggregate() { + @Test void testJoinUsingWithAggregate() { final String sql = "select deptno, count(*)\n" + "from emp\n" + "full join dept using (deptno)\n" @@ -290,7 +290,7 @@ public final Sql sql(String sql) { /** Similar to {@link #testJoinUsingWithUnqualifiedCommonColumn()}, * but with grouping sets. */ - @Test public void testJoinUsingWithGroupingSets() { + @Test void testJoinUsingWithGroupingSets() { final String sql = "select deptno, grouping(deptno),\n" + "grouping(deptno, job), count(*)\n" + "from emp\n" @@ -301,7 +301,7 @@ public final Sql sql(String sql) { /** Similar to {@link #testJoinUsingWithUnqualifiedCommonColumn()}, * but with multiple join. */ - @Test public void testJoinUsingWithMultipleJoin() { + @Test void testJoinUsingWithMultipleJoin() { final String sql = "SELECT deptno, ename\n" + "FROM emp " + "JOIN dept using (deptno)\n" @@ -309,59 +309,59 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testJoinWithUnion() { + @Test void testJoinWithUnion() { final String sql = "select grade\n" + "from (select empno from emp union select deptno from dept),\n" + " salgrade"; sql(sql).ok(); } - @Test public void testGroup() { + @Test void testGroup() { sql("select deptno from emp group by deptno").ok(); } - @Test public void testGroupByAlias() { + @Test void testGroupByAlias() { sql("select empno as d from emp group by d") .conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testGroupByAliasOfSubExpressionsInProject() { + @Test void testGroupByAliasOfSubExpressionsInProject() { final String sql = "select deptno+empno as d, deptno+empno+mgr\n" + "from emp group by d,mgr"; sql(sql) .conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testGroupByAliasEqualToColumnName() { + @Test void testGroupByAliasEqualToColumnName() { sql("select empno, ename as deptno from emp group by empno, deptno") .conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testGroupByOrdinal() { + @Test void testGroupByOrdinal() { sql("select empno from emp group by 1") .conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testGroupByContainsLiterals() { + @Test void testGroupByContainsLiterals() { final String sql = "select count(*) from (\n" + " select 1 from emp group by substring(ename from 2 for 3))"; sql(sql) .conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testAliasInHaving() { + @Test void testAliasInHaving() { sql("select count(empno) as e from emp having e > 1") .conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testGroupJustOneAgg() { + @Test void testGroupJustOneAgg() { // just one agg final String sql = "select deptno, sum(sal) as sum_sal from emp group by deptno"; sql(sql).ok(); } - @Test public void testGroupExpressionsInsideAndOut() { + @Test void testGroupExpressionsInsideAndOut() { // Expressions inside and outside aggs. Common sub-expressions should be // eliminated: 'sal' always translates to expression #2. final String sql = "select\n" @@ -370,20 +370,20 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testAggregateNoGroup() { + @Test void testAggregateNoGroup() { sql("select sum(deptno) from emp").ok(); } - @Test public void testGroupEmpty() { + @Test void testGroupEmpty() { sql("select sum(deptno) from emp group by ()").ok(); } // Same effect as writing "GROUP BY deptno" - @Test public void testSingletonGroupingSet() { + @Test void testSingletonGroupingSet() { sql("select sum(sal) from emp group by grouping sets (deptno)").ok(); } - @Test public void testGroupingSets() { + @Test void testGroupingSets() { final String sql = "select deptno, ename, sum(sal) from emp\n" + "group by grouping sets ((deptno), (ename, deptno))\n" + "order by 2"; @@ -400,28 +400,28 @@ public final Sql sql(String sql) { *
    GROUP BY GROUPING SETS ((A,B), (A), (), * (C,D), (C), (D) )
    */ - @Test public void testGroupingSetsWithRollup() { + @Test void testGroupingSetsWithRollup() { final String sql = "select deptno, ename, sum(sal) from emp\n" + "group by grouping sets ( rollup(deptno), (ename, deptno))\n" + "order by 2"; sql(sql).ok(); } - @Test public void testGroupingSetsWithCube() { + @Test void testGroupingSetsWithCube() { final String sql = "select deptno, ename, sum(sal) from emp\n" + "group by grouping sets ( (deptno), CUBE(ename, deptno))\n" + "order by 2"; sql(sql).ok(); } - @Test public void testGroupingSetsWithRollupCube() { + @Test void testGroupingSetsWithRollupCube() { final String sql = "select deptno, ename, sum(sal) from emp\n" + "group by grouping sets ( CUBE(deptno), ROLLUP(ename, deptno))\n" + "order by 2"; sql(sql).ok(); } - @Test public void testGroupingSetsProduct() { + @Test void testGroupingSetsProduct() { // Example in SQL:2011: // GROUP BY GROUPING SETS ((A, B), (C)), GROUPING SETS ((X, Y), ()) // is transformed to @@ -434,7 +434,7 @@ public final Sql sql(String sql) { /** When the GROUPING function occurs with GROUP BY (effectively just one * grouping set), we can translate it directly to 1. */ - @Test public void testGroupingFunctionWithGroupBy() { + @Test void testGroupingFunctionWithGroupBy() { final String sql = "select\n" + " deptno, grouping(deptno), count(*), grouping(empno)\n" + "from emp\n" @@ -443,7 +443,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testGroupingFunction() { + @Test void testGroupingFunction() { final String sql = "select\n" + " deptno, grouping(deptno), count(*), grouping(empno)\n" + "from emp\n" @@ -463,12 +463,12 @@ public final Sql sql(String sql) { * BY (). * */ // Same effect as writing "GROUP BY ()" - @Test public void testGroupByWithDuplicates() { + @Test void testGroupByWithDuplicates() { sql("select sum(sal) from emp group by (), ()").ok(); } /** GROUP BY with duplicate (and heavily nested) GROUPING SETS. */ - @Test public void testDuplicateGroupingSets() { + @Test void testDuplicateGroupingSets() { final String sql = "select sum(sal) from emp\n" + "group by sal,\n" + " grouping sets (deptno,\n" @@ -478,7 +478,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testGroupingSetsCartesianProduct() { + @Test void testGroupingSetsCartesianProduct() { // Equivalent to (a, c), (a, d), (b, c), (b, d) final String sql = "select 1\n" + "from (values (1, 2, 3, 4)) as t(a, b, c, d)\n" @@ -486,14 +486,14 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testGroupingSetsCartesianProduct2() { + @Test void testGroupingSetsCartesianProduct2() { final String sql = "select 1\n" + "from (values (1, 2, 3, 4)) as t(a, b, c, d)\n" + "group by grouping sets (a, (a, b)), grouping sets (c), d"; sql(sql).ok(); } - @Test public void testRollupSimple() { + @Test void testRollupSimple() { // a is nullable so is translated as just "a" // b is not null, so is represented as 0 inside Aggregate, then // using "CASE WHEN i$b THEN NULL ELSE b END" @@ -503,7 +503,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testRollup() { + @Test void testRollup() { // Equivalent to {(a, b), (a), ()} * {(c, d), (c), ()} final String sql = "select 1\n" + "from (values (1, 2, 3, 4)) as t(a, b, c, d)\n" @@ -511,7 +511,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testRollupTuples() { + @Test void testRollupTuples() { // rollup(b, (a, d)) is (b, a, d), (b), () final String sql = "select 1\n" + "from (values (1, 2, 3, 4)) as t(a, b, c, d)\n" @@ -519,7 +519,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testCube() { + @Test void testCube() { // cube(a, b) is {(a, b), (a), (b), ()} final String sql = "select 1\n" + "from (values (1, 2, 3, 4)) as t(a, b, c, d)\n" @@ -527,20 +527,20 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testGroupingSetsWith() { + @Test void testGroupingSetsWith() { final String sql = "with t(a, b, c, d) as (values (1, 2, 3, 4))\n" + "select 1 from t\n" + "group by rollup(a, b), rollup(c, d)"; sql(sql).ok(); } - @Test public void testHaving() { + @Test void testHaving() { // empty group-by clause, having final String sql = "select sum(sal + sal) from emp having sum(sal) > 10"; sql(sql).ok(); } - @Test public void testGroupBug281() { + @Test void testGroupBug281() { // Dtbug 281 gives: // Internal error: // Type 'RecordType(VARCHAR(128) $f0)' has no field 'NAME' @@ -549,7 +549,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testGroupBug281b() { + @Test void testGroupBug281b() { // Try to confuse it with spurious columns. final String sql = "select name, foo from (\n" + "select deptno, name, count(deptno) as foo\n" @@ -558,7 +558,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testGroupByExpression() { + @Test void testGroupByExpression() { // This used to cause an infinite loop, // SqlValidatorImpl.getValidatedNodeType // calling getValidatedNodeTypeIfKnown @@ -569,14 +569,14 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testAggDistinct() { + @Test void testAggDistinct() { final String sql = "select deptno, sum(sal), sum(distinct sal), count(*)\n" + "from emp\n" + "group by deptno"; sql(sql).ok(); } - @Test public void testAggFilter() { + @Test void testAggFilter() { final String sql = "select\n" + " deptno, sum(sal * 2) filter (where empno < 10), count(*)\n" + "from emp\n" @@ -584,7 +584,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testAggFilterWithIn() { + @Test void testAggFilterWithIn() { final String sql = "select\n" + " deptno, sum(sal * 2) filter (where empno not in (1, 2)), count(*)\n" + "from emp\n" @@ -592,18 +592,18 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testFakeStar() { + @Test void testFakeStar() { sql("SELECT * FROM (VALUES (0, 0)) AS T(A, \"*\")").ok(); } - @Test public void testSelectDistinct() { + @Test void testSelectDistinct() { sql("select distinct sal + 5 from emp").ok(); } /** Test case for * [CALCITE-476] * DISTINCT flag in windowed aggregates. */ - @Test public void testSelectOverDistinct() { + @Test void testSelectOverDistinct() { // Checks to see if (DISTINCT x) is set and preserved // as a flag for the aggregate call. final String sql = "select SUM(DISTINCT deptno)\n" @@ -613,7 +613,7 @@ public final Sql sql(String sql) { } /** As {@link #testSelectOverDistinct()} but for streaming queries. */ - @Test public void testSelectStreamPartitionDistinct() { + @Test void testSelectStreamPartitionDistinct() { final String sql = "select stream\n" + " count(distinct orderId) over (partition by productId\n" + " order by rowtime\n" @@ -625,7 +625,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testSelectDistinctGroup() { + @Test void testSelectDistinctGroup() { sql("select distinct sum(sal) from emp group by deptno").ok(); } @@ -633,13 +633,13 @@ public final Sql sql(String sql) { * Tests that if the clause of SELECT DISTINCT contains duplicate * expressions, they are only aggregated once. */ - @Test public void testSelectDistinctDup() { + @Test void testSelectDistinctDup() { final String sql = "select distinct sal + 5, deptno, sal + 5 from emp where deptno < 10"; sql(sql).ok(); } - @Test public void testSelectWithoutFrom() { + @Test void testSelectWithoutFrom() { final String sql = "select 2+2"; sql(sql).ok(); } @@ -647,13 +647,13 @@ public final Sql sql(String sql) { /** Tests referencing columns from a sub-query that has duplicate column * names. I think the standard says that this is illegal. We roll with it, * and rename the second column to "e0". */ - @Test public void testDuplicateColumnsInSubQuery() { + @Test void testDuplicateColumnsInSubQuery() { String sql = "select \"e\" from (\n" + "select empno as \"e\", deptno as d, 1 as \"e0\" from EMP)"; sql(sql).ok(); } - @Test public void testOrder() { + @Test void testOrder() { final String sql = "select empno from emp order by empno"; sql(sql).ok(); @@ -668,17 +668,17 @@ public final Sql sql(String sql) { /** Tests that if a column occurs twice in ORDER BY, only the first key is * kept. */ - @Test public void testOrderBasedRepeatFields() { + @Test void testOrderBasedRepeatFields() { final String sql = "select empno from emp order by empno DESC, empno ASC"; sql(sql).ok(); } - @Test public void testOrderDescNullsLast() { + @Test void testOrderDescNullsLast() { final String sql = "select empno from emp order by empno desc nulls last"; sql(sql).ok(); } - @Test public void testOrderByOrdinalDesc() { + @Test void testOrderByOrdinalDesc() { // FRG-98 if (!tester.getConformance().isSortByOrdinal()) { return; @@ -694,7 +694,7 @@ public final Sql sql(String sql) { sql(sql2).ok(); } - @Test public void testOrderDistinct() { + @Test void testOrderDistinct() { // The relexp aggregates by 3 expressions - the 2 select expressions // plus the one to sort on. A little inefficient, but acceptable. final String sql = "select distinct empno, deptno + 1\n" @@ -702,7 +702,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderByNegativeOrdinal() { + @Test void testOrderByNegativeOrdinal() { // Regardless of whether sort-by-ordinals is enabled, negative ordinals // are treated like ordinary numbers. final String sql = @@ -710,7 +710,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderByOrdinalInExpr() { + @Test void testOrderByOrdinalInExpr() { // Regardless of whether sort-by-ordinals is enabled, ordinals // inside expressions are treated like integers. final String sql = @@ -718,7 +718,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderByIdenticalExpr() { + @Test void testOrderByIdenticalExpr() { // Expression in ORDER BY clause is identical to expression in SELECT // clause, so plan should not need an extra project. final String sql = @@ -726,19 +726,19 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderByAlias() { + @Test void testOrderByAlias() { final String sql = "select empno + 1 as x, empno - 2 as y from emp order by y"; sql(sql).ok(); } - @Test public void testOrderByAliasInExpr() { + @Test void testOrderByAliasInExpr() { final String sql = "select empno + 1 as x, empno - 2 as y\n" + "from emp order by y + 3"; sql(sql).ok(); } - @Test public void testOrderByAliasOverrides() { + @Test void testOrderByAliasOverrides() { if (!tester.getConformance().isSortByAlias()) { return; } @@ -749,7 +749,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderByAliasDoesNotOverride() { + @Test void testOrderByAliasDoesNotOverride() { if (tester.getConformance().isSortByAlias()) { return; } @@ -760,13 +760,13 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderBySameExpr() { + @Test void testOrderBySameExpr() { final String sql = "select empno from emp, dept\n" + "order by sal + empno desc, sal * empno, sal + empno desc"; sql(sql).ok(); } - @Test public void testOrderUnion() { + @Test void testOrderUnion() { final String sql = "select empno, sal from emp\n" + "union all\n" + "select deptno, deptno from dept\n" @@ -774,7 +774,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderUnionOrdinal() { + @Test void testOrderUnionOrdinal() { if (!tester.getConformance().isSortByOrdinal()) { return; } @@ -785,7 +785,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderUnionExprs() { + @Test void testOrderUnionExprs() { final String sql = "select empno, sal from emp\n" + "union all\n" + "select deptno, deptno from dept\n" @@ -793,46 +793,46 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOrderOffsetFetch() { + @Test void testOrderOffsetFetch() { final String sql = "select empno from emp\n" + "order by empno offset 10 rows fetch next 5 rows only"; sql(sql).ok(); } - @Test public void testOrderOffsetFetchWithDynamicParameter() { + @Test void testOrderOffsetFetchWithDynamicParameter() { final String sql = "select empno from emp\n" + "order by empno offset ? rows fetch next ? rows only"; sql(sql).ok(); } - @Test public void testOffsetFetch() { + @Test void testOffsetFetch() { final String sql = "select empno from emp\n" + "offset 10 rows fetch next 5 rows only"; sql(sql).ok(); } - @Test public void testOffsetFetchWithDynamicParameter() { + @Test void testOffsetFetchWithDynamicParameter() { final String sql = "select empno from emp\n" + "offset ? rows fetch next ? rows only"; sql(sql).ok(); } - @Test public void testOffset() { + @Test void testOffset() { final String sql = "select empno from emp offset 10 rows"; sql(sql).ok(); } - @Test public void testOffsetWithDynamicParameter() { + @Test void testOffsetWithDynamicParameter() { final String sql = "select empno from emp offset ? rows"; sql(sql).ok(); } - @Test public void testFetch() { + @Test void testFetch() { final String sql = "select empno from emp fetch next 5 rows only"; sql(sql).ok(); } - @Test public void testFetchWithDynamicParameter() { + @Test void testFetchWithDynamicParameter() { final String sql = "select empno from emp fetch next ? rows only"; sql(sql).ok(); } @@ -840,14 +840,14 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-439] * SqlValidatorUtil.uniquify() may not terminate under some conditions. */ - @Test public void testGroupAlias() { + @Test void testGroupAlias() { final String sql = "select \"$f2\", max(x), max(x + 1)\n" + "from (values (1, 2)) as t(\"$f2\", x)\n" + "group by \"$f2\""; sql(sql).ok(); } - @Test public void testOrderGroup() { + @Test void testOrderGroup() { final String sql = "select deptno, count(*)\n" + "from emp\n" + "group by deptno\n" @@ -855,14 +855,14 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testCountNoGroup() { + @Test void testCountNoGroup() { final String sql = "select count(*), sum(sal)\n" + "from emp\n" + "where empno > 10"; sql(sql).ok(); } - @Test public void testWith() { + @Test void testWith() { final String sql = "with emp2 as (select * from emp)\n" + "select * from emp2"; sql(sql).ok(); @@ -871,13 +871,13 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-309] * WITH ... ORDER BY query gives AssertionError. */ - @Test public void testWithOrder() { + @Test void testWithOrder() { final String sql = "with emp2 as (select * from emp)\n" + "select * from emp2 order by deptno"; sql(sql).ok(); } - @Test public void testWithUnionOrder() { + @Test void testWithUnionOrder() { final String sql = "with emp2 as (select empno, deptno as x from emp)\n" + "select * from emp2\n" + "union all\n" @@ -886,7 +886,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testWithUnion() { + @Test void testWithUnion() { final String sql = "with emp2 as (select * from emp where deptno > 10)\n" + "select empno from emp2 where deptno < 30\n" + "union all\n" @@ -894,14 +894,14 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testWithAlias() { + @Test void testWithAlias() { final String sql = "with w(x, y) as\n" + " (select * from dept where deptno > 10)\n" + "select x from w where x < 30 union all select deptno from dept"; sql(sql).ok(); } - @Test public void testWithInsideWhereExists() { + @Test void testWithInsideWhereExists() { final String sql = "select * from emp\n" + "where exists (\n" + " with dept2 as (select * from dept where dept.deptno >= emp.deptno)\n" @@ -909,7 +909,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(false).ok(); } - @Test public void testWithInsideWhereExistsRex() { + @Test void testWithInsideWhereExistsRex() { final String sql = "select * from emp\n" + "where exists (\n" + " with dept2 as (select * from dept where dept.deptno >= emp.deptno)\n" @@ -917,7 +917,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(false).expand(false).ok(); } - @Test public void testWithInsideWhereExistsDecorrelate() { + @Test void testWithInsideWhereExistsDecorrelate() { final String sql = "select * from emp\n" + "where exists (\n" + " with dept2 as (select * from dept where dept.deptno >= emp.deptno)\n" @@ -925,7 +925,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).ok(); } - @Test public void testWithInsideWhereExistsDecorrelateRex() { + @Test void testWithInsideWhereExistsDecorrelateRex() { final String sql = "select * from emp\n" + "where exists (\n" + " with dept2 as (select * from dept where dept.deptno >= emp.deptno)\n" @@ -933,7 +933,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).expand(false).ok(); } - @Test public void testWithInsideScalarSubQuery() { + @Test void testWithInsideScalarSubQuery() { final String sql = "select (\n" + " with dept2 as (select * from dept where deptno > 10)" + " select count(*) from dept2) as c\n" @@ -941,7 +941,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testWithInsideScalarSubQueryRex() { + @Test void testWithInsideScalarSubQueryRex() { final String sql = "select (\n" + " with dept2 as (select * from dept where deptno > 10)" + " select count(*) from dept2) as c\n" @@ -953,57 +953,57 @@ public final Sql sql(String sql) { * [CALCITE-365] * AssertionError while translating query with WITH and correlated * sub-query. */ - @Test public void testWithExists() { + @Test void testWithExists() { final String sql = "with t (a, b) as (select * from (values (1, 2)))\n" + "select * from t where exists (\n" + " select 1 from emp where deptno = t.a)"; sql(sql).ok(); } - @Test public void testTableSubset() { + @Test void testTableSubset() { final String sql = "select deptno, name from dept"; sql(sql).ok(); } - @Test public void testTableExpression() { + @Test void testTableExpression() { final String sql = "select deptno + deptno from dept"; sql(sql).ok(); } - @Test public void testTableExtend() { + @Test void testTableExtend() { final String sql = "select * from dept extend (x varchar(5) not null)"; sql(sql).ok(); } - @Test public void testTableExtendSubset() { + @Test void testTableExtendSubset() { final String sql = "select deptno, x from dept extend (x int)"; sql(sql).ok(); } - @Test public void testTableExtendExpression() { + @Test void testTableExtendExpression() { final String sql = "select deptno + x from dept extend (x int not null)"; sql(sql).ok(); } - @Test public void testModifiableViewExtend() { + @Test void testModifiableViewExtend() { final String sql = "select *\n" + "from EMP_MODIFIABLEVIEW extend (x varchar(5) not null)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testModifiableViewExtendSubset() { + @Test void testModifiableViewExtendSubset() { final String sql = "select x, empno\n" + "from EMP_MODIFIABLEVIEW extend (x varchar(5) not null)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testModifiableViewExtendExpression() { + @Test void testModifiableViewExtendExpression() { final String sql = "select empno + x\n" + "from EMP_MODIFIABLEVIEW extend (x int not null)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testSelectViewExtendedColumnCollision() { + @Test void testSelectViewExtendedColumnCollision() { sql("select ENAME, EMPNO, JOB, SLACKER, SAL, HIREDATE, MGR\n" + " from EMP_MODIFIABLEVIEW3\n" + " where SAL = 20").with(getExtendedTester()).ok(); @@ -1012,13 +1012,13 @@ public final Sql sql(String sql) { + " where SAL = 20").with(getExtendedTester()).ok(); } - @Test public void testSelectViewExtendedColumnCaseSensitiveCollision() { + @Test void testSelectViewExtendedColumnCaseSensitiveCollision() { sql("select ENAME, EMPNO, JOB, SLACKER, \"sal\", HIREDATE, MGR\n" + " from EMP_MODIFIABLEVIEW3 extend (\"sal\" boolean)\n" + " where \"sal\" = true").with(getExtendedTester()).ok(); } - @Test public void testSelectViewExtendedColumnExtendedCollision() { + @Test void testSelectViewExtendedColumnExtendedCollision() { sql("select ENAME, EMPNO, JOB, SLACKER, SAL, HIREDATE, EXTRA\n" + " from EMP_MODIFIABLEVIEW2\n" + " where SAL = 20").with(getExtendedTester()).ok(); @@ -1027,107 +1027,107 @@ public final Sql sql(String sql) { + " where SAL = 20").with(getExtendedTester()).ok(); } - @Test public void testSelectViewExtendedColumnCaseSensitiveExtendedCollision() { + @Test void testSelectViewExtendedColumnCaseSensitiveExtendedCollision() { sql("select ENAME, EMPNO, JOB, SLACKER, SAL, HIREDATE, \"extra\"\n" + " from EMP_MODIFIABLEVIEW2 extend (\"extra\" boolean)\n" + " where \"extra\" = false").with(getExtendedTester()).ok(); } - @Test public void testSelectViewExtendedColumnUnderlyingCollision() { + @Test void testSelectViewExtendedColumnUnderlyingCollision() { sql("select ENAME, EMPNO, JOB, SLACKER, SAL, HIREDATE, MGR, COMM\n" + " from EMP_MODIFIABLEVIEW3 extend (COMM int)\n" + " where SAL = 20").with(getExtendedTester()).ok(); } - @Test public void testSelectViewExtendedColumnCaseSensitiveUnderlyingCollision() { + @Test void testSelectViewExtendedColumnCaseSensitiveUnderlyingCollision() { sql("select ENAME, EMPNO, JOB, SLACKER, SAL, HIREDATE, MGR, \"comm\"\n" + " from EMP_MODIFIABLEVIEW3 extend (\"comm\" int)\n" + " where \"comm\" = 20").with(getExtendedTester()).ok(); } - @Test public void testUpdateExtendedColumnCollision() { + @Test void testUpdateExtendedColumnCollision() { sql("update empdefaults(empno INTEGER NOT NULL, deptno INTEGER)" + " set deptno = 1, empno = 20, ename = 'Bob'" + " where deptno = 10").ok(); } - @Test public void testUpdateExtendedColumnCaseSensitiveCollision() { + @Test void testUpdateExtendedColumnCaseSensitiveCollision() { sql("update empdefaults(\"slacker\" INTEGER, deptno INTEGER)" + " set deptno = 1, \"slacker\" = 100" + " where ename = 'Bob'").ok(); } - @Test public void testUpdateExtendedColumnModifiableViewCollision() { + @Test void testUpdateExtendedColumnModifiableViewCollision() { sql("update EMP_MODIFIABLEVIEW3(empno INTEGER NOT NULL, deptno INTEGER)" + " set deptno = 20, empno = 20, ename = 'Bob'" + " where empno = 10").with(getExtendedTester()).ok(); } - @Test public void testUpdateExtendedColumnModifiableViewCaseSensitiveCollision() { + @Test void testUpdateExtendedColumnModifiableViewCaseSensitiveCollision() { sql("update EMP_MODIFIABLEVIEW2(\"slacker\" INTEGER, deptno INTEGER)" + " set deptno = 20, \"slacker\" = 100" + " where ename = 'Bob'").with(getExtendedTester()).ok(); } - @Test public void testUpdateExtendedColumnModifiableViewExtendedCollision() { + @Test void testUpdateExtendedColumnModifiableViewExtendedCollision() { sql("update EMP_MODIFIABLEVIEW2(\"slacker\" INTEGER, extra BOOLEAN)" + " set deptno = 20, \"slacker\" = 100, extra = true" + " where ename = 'Bob'").with(getExtendedTester()).ok(); } - @Test public void testUpdateExtendedColumnModifiableViewExtendedCaseSensitiveCollision() { + @Test void testUpdateExtendedColumnModifiableViewExtendedCaseSensitiveCollision() { sql("update EMP_MODIFIABLEVIEW2(\"extra\" INTEGER, extra BOOLEAN)" + " set deptno = 20, \"extra\" = 100, extra = true" + " where ename = 'Bob'").with(getExtendedTester()).ok(); } - @Test public void testUpdateExtendedColumnModifiableViewUnderlyingCollision() { + @Test void testUpdateExtendedColumnModifiableViewUnderlyingCollision() { sql("update EMP_MODIFIABLEVIEW3(extra BOOLEAN, comm INTEGER)" + " set empno = 20, comm = 123, extra = true" + " where ename = 'Bob'").with(getExtendedTester()).ok(); } - @Test public void testSelectModifiableViewConstraint() { + @Test void testSelectModifiableViewConstraint() { final String sql = "select deptno from EMP_MODIFIABLEVIEW2\n" + "where deptno = ?"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testModifiableViewDdlExtend() { + @Test void testModifiableViewDdlExtend() { final String sql = "select extra from EMP_MODIFIABLEVIEW2"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testExplicitTable() { + @Test void testExplicitTable() { sql("table emp").ok(); } - @Test public void testCollectionTable() { + @Test void testCollectionTable() { sql("select * from table(ramp(3))").ok(); } - @Test public void testCollectionTableWithLateral() { + @Test void testCollectionTableWithLateral() { sql("select * from dept, lateral table(ramp(dept.deptno))").ok(); } - @Test public void testCollectionTableWithLateral2() { + @Test void testCollectionTableWithLateral2() { sql("select * from dept, lateral table(ramp(deptno))").ok(); } - @Test public void testSnapshotOnTemporalTable1() { + @Test void testSnapshotOnTemporalTable1() { final String sql = "select * from products_temporal " + "for system_time as of TIMESTAMP '2011-01-02 00:00:00'"; sql(sql).ok(); } - @Test public void testSnapshotOnTemporalTable2() { + @Test void testSnapshotOnTemporalTable2() { // Test temporal table with virtual columns. final String sql = "select * from VIRTUALCOLUMNS.VC_T1 " + "for system_time as of TIMESTAMP '2011-01-02 00:00:00'"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testJoinTemporalTableOnSpecificTime1() { + @Test void testJoinTemporalTableOnSpecificTime1() { final String sql = "select stream *\n" + "from orders,\n" + " products_temporal for system_time as of\n" @@ -1135,7 +1135,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testJoinTemporalTableOnSpecificTime2() { + @Test void testJoinTemporalTableOnSpecificTime2() { // Test temporal table with virtual columns. final String sql = "select stream *\n" + "from orders,\n" @@ -1144,7 +1144,7 @@ public final Sql sql(String sql) { sql(sql).with(getExtendedTester()).ok(); } - @Test public void testJoinTemporalTableOnColumnReference1() { + @Test void testJoinTemporalTableOnColumnReference1() { final String sql = "select stream *\n" + "from orders\n" + "join products_temporal for system_time as of orders.rowtime\n" @@ -1152,7 +1152,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testJoinTemporalTableOnColumnReference2() { + @Test void testJoinTemporalTableOnColumnReference2() { // Test temporal table with virtual columns. final String sql = "select stream *\n" + "from orders\n" @@ -1166,7 +1166,7 @@ public final Sql sql(String sql) { * and snapshot's period reference outer columns. Should not * decorrelate join. */ - @Test public void testCrossJoinTemporalTable1() { + @Test void testCrossJoinTemporalTable1() { final String sql = "select stream *\n" + "from orders\n" + "cross join lateral (\n" @@ -1181,7 +1181,7 @@ public final Sql sql(String sql) { * reference outer columns, but snapshot's period is static. * Should be able to decorrelate join. */ - @Test public void testCrossJoinTemporalTable2() { + @Test void testCrossJoinTemporalTable2() { final String sql = "select stream *\n" + "from orders\n" + "cross join lateral (\n" @@ -1195,7 +1195,7 @@ public final Sql sql(String sql) { * Lateral join with temporal table, snapshot's period reference * outer columns. Should not decorrelate join. */ - @Test public void testCrossJoinTemporalTable3() { + @Test void testCrossJoinTemporalTable3() { final String sql = "select stream *\n" + "from orders\n" + "cross join lateral (\n" @@ -1209,7 +1209,7 @@ public final Sql sql(String sql) { * [CALCITE-1732] * IndexOutOfBoundsException when using LATERAL TABLE with more than one * field. */ - @Test public void testCollectionTableWithLateral3() { + @Test void testCollectionTableWithLateral3() { sql("select * from dept, lateral table(DEDUP(dept.deptno, dept.name))").ok(); } @@ -1217,20 +1217,20 @@ public final Sql sql(String sql) { * [CALCITE-3847] * Decorrelation for join with lateral table outputs wrong plan if the join * condition contains correlation variables. */ - @Test public void testJoinLateralTableWithConditionCorrelated() { + @Test void testJoinLateralTableWithConditionCorrelated() { final String sql = "select deptno, r.num from dept join\n" + " lateral table(ramp(dept.deptno)) as r(num)\n" + " on deptno=num"; sql(sql).ok(); } - @Test public void testSample() { + @Test void testSample() { final String sql = "select * from emp tablesample substitute('DATASET1') where empno > 5"; sql(sql).ok(); } - @Test public void testSampleQuery() { + @Test void testSampleQuery() { final String sql = "select * from (\n" + " select * from emp as e tablesample substitute('DATASET1')\n" + " join dept on e.deptno = dept.deptno\n" @@ -1239,13 +1239,13 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testSampleBernoulli() { + @Test void testSampleBernoulli() { final String sql = "select * from emp tablesample bernoulli(50) where empno > 5"; sql(sql).ok(); } - @Test public void testSampleBernoulliQuery() { + @Test void testSampleBernoulliQuery() { final String sql = "select * from (\n" + " select * from emp as e tablesample bernoulli(10) repeatable(1)\n" + " join dept on e.deptno = dept.deptno\n" @@ -1254,13 +1254,13 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testSampleSystem() { + @Test void testSampleSystem() { final String sql = "select * from emp tablesample system(50) where empno > 5"; sql(sql).ok(); } - @Test public void testSampleSystemQuery() { + @Test void testSampleSystemQuery() { final String sql = "select * from (\n" + " select * from emp as e tablesample system(10) repeatable(1)\n" + " join dept on e.deptno = dept.deptno\n" @@ -1269,90 +1269,90 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testCollectionTableWithCursorParam() { + @Test void testCollectionTableWithCursorParam() { final String sql = "select * from table(dedup(" + "cursor(select ename from emp)," + " cursor(select name from dept), 'NAME'))"; sql(sql).decorrelate(false).ok(); } - @Test public void testUnnest() { + @Test void testUnnest() { final String sql = "select*from unnest(multiset[1,2])"; sql(sql).ok(); } - @Test public void testUnnestSubQuery() { + @Test void testUnnestSubQuery() { final String sql = "select*from unnest(multiset(select*from dept))"; sql(sql).ok(); } - @Test public void testUnnestArrayAggPlan() { + @Test void testUnnestArrayAggPlan() { final String sql = "select d.deptno, e2.empno_avg\n" + "from dept_nested as d outer apply\n" + " (select avg(e.empno) as empno_avg from UNNEST(d.employees) as e) e2"; sql(sql).conformance(SqlConformanceEnum.LENIENT).ok(); } - @Test public void testUnnestArrayPlan() { + @Test void testUnnestArrayPlan() { final String sql = "select d.deptno, e2.empno\n" + "from dept_nested as d,\n" + " UNNEST(d.employees) e2"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testUnnestArrayPlanAs() { + @Test void testUnnestArrayPlanAs() { final String sql = "select d.deptno, e2.empno\n" + "from dept_nested as d,\n" + " UNNEST(d.employees) as e2(empno, y, z)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testArrayOfRecord() { + @Test void testArrayOfRecord() { sql("select employees[1].detail.skills[2+3].desc from dept_nested").ok(); } - @Test public void testFlattenRecords() { + @Test void testFlattenRecords() { sql("select employees[1] from dept_nested").ok(); } - @Test public void testUnnestArray() { + @Test void testUnnestArray() { sql("select*from unnest(array(select*from dept))").ok(); } - @Test public void testUnnestWithOrdinality() { + @Test void testUnnestWithOrdinality() { final String sql = "select*from unnest(array(select*from dept)) with ordinality"; sql(sql).ok(); } - @Test public void testMultisetSubQuery() { + @Test void testMultisetSubQuery() { final String sql = "select multiset(select deptno from dept) from (values(true))"; sql(sql).ok(); } - @Test public void testMultiset() { + @Test void testMultiset() { final String sql = "select 'a',multiset[10] from dept"; sql(sql).ok(); } - @Test public void testMultisetOfColumns() { + @Test void testMultisetOfColumns() { final String sql = "select 'abc',multiset[deptno,sal] from emp"; sql(sql).expand(true).ok(); } - @Test public void testMultisetOfColumnsRex() { + @Test void testMultisetOfColumnsRex() { sql("select 'abc',multiset[deptno,sal] from emp").ok(); } - @Test public void testCorrelationJoin() { + @Test void testCorrelationJoin() { final String sql = "select *,\n" + " multiset(select * from emp where deptno=dept.deptno) as empset\n" + "from dept"; sql(sql).ok(); } - @Test public void testCorrelationJoinRex() { + @Test void testCorrelationJoinRex() { final String sql = "select *,\n" + " multiset(select * from emp where deptno=dept.deptno) as empset\n" + "from dept"; @@ -1363,7 +1363,7 @@ public final Sql sql(String sql) { * [CALCITE-864] * Correlation variable has incorrect row type if it is populated by right * side of a Join. */ - @Test public void testCorrelatedSubQueryInJoin() { + @Test void testCorrelatedSubQueryInJoin() { final String sql = "select *\n" + "from emp as e\n" + "join dept as d using (deptno)\n" @@ -1374,61 +1374,61 @@ public final Sql sql(String sql) { sql(sql).expand(false).ok(); } - @Test public void testExists() { + @Test void testExists() { final String sql = "select*from emp\n" + "where exists (select 1 from dept where deptno=55)"; sql(sql).ok(); } - @Test public void testExistsCorrelated() { + @Test void testExistsCorrelated() { final String sql = "select*from emp where exists (\n" + " select 1 from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(false).ok(); } - @Test public void testNotExistsCorrelated() { + @Test void testNotExistsCorrelated() { final String sql = "select * from emp where not exists (\n" + " select 1 from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(false).ok(); } - @Test public void testExistsCorrelatedDecorrelate() { + @Test void testExistsCorrelatedDecorrelate() { final String sql = "select*from emp where exists (\n" + " select 1 from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(true).ok(); } - @Test public void testExistsCorrelatedDecorrelateRex() { + @Test void testExistsCorrelatedDecorrelateRex() { final String sql = "select*from emp where exists (\n" + " select 1 from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(true).expand(false).ok(); } - @Test public void testExistsCorrelatedLimit() { + @Test void testExistsCorrelatedLimit() { final String sql = "select*from emp where exists (\n" + " select 1 from dept where emp.deptno=dept.deptno limit 1)"; sql(sql).decorrelate(false).ok(); } - @Test public void testExistsCorrelatedLimitDecorrelate() { + @Test void testExistsCorrelatedLimitDecorrelate() { final String sql = "select*from emp where exists (\n" + " select 1 from dept where emp.deptno=dept.deptno limit 1)"; sql(sql).decorrelate(true).expand(true).ok(); } - @Test public void testExistsCorrelatedLimitDecorrelateRex() { + @Test void testExistsCorrelatedLimitDecorrelateRex() { final String sql = "select*from emp where exists (\n" + " select 1 from dept where emp.deptno=dept.deptno limit 1)"; sql(sql).decorrelate(true).expand(false).ok(); } - @Test public void testInValueListShort() { + @Test void testInValueListShort() { final String sql = "select empno from emp where deptno in (10, 20)"; sql(sql).ok(); sql(sql).expand(false).ok(); } - @Test public void testInValueListLong() { + @Test void testInValueListLong() { // Go over the default threshold of 20 to force a sub-query. final String sql = "select empno from emp where deptno in" + " (10, 20, 30, 40, 50, 60, 70, 80, 90, 100" @@ -1437,77 +1437,77 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testInUncorrelatedSubQuery() { + @Test void testInUncorrelatedSubQuery() { final String sql = "select empno from emp where deptno in" + " (select deptno from dept)"; sql(sql).ok(); } - @Test public void testInUncorrelatedSubQueryRex() { + @Test void testInUncorrelatedSubQueryRex() { final String sql = "select empno from emp where deptno in" + " (select deptno from dept)"; sql(sql).expand(false).ok(); } - @Test public void testCompositeInUncorrelatedSubQueryRex() { + @Test void testCompositeInUncorrelatedSubQueryRex() { final String sql = "select empno from emp where (empno, deptno) in" + " (select deptno - 10, deptno from dept)"; sql(sql).expand(false).ok(); } - @Test public void testNotInUncorrelatedSubQuery() { + @Test void testNotInUncorrelatedSubQuery() { final String sql = "select empno from emp where deptno not in" + " (select deptno from dept)"; sql(sql).ok(); } - @Test public void testAllValueList() { + @Test void testAllValueList() { final String sql = "select empno from emp where deptno > all (10, 20)"; sql(sql).expand(false).ok(); } - @Test public void testSomeValueList() { + @Test void testSomeValueList() { final String sql = "select empno from emp where deptno > some (10, 20)"; sql(sql).expand(false).ok(); } - @Test public void testSome() { + @Test void testSome() { final String sql = "select empno from emp where deptno > some (\n" + " select deptno from dept)"; sql(sql).expand(false).ok(); } - @Test public void testSomeWithEquality() { + @Test void testSomeWithEquality() { final String sql = "select empno from emp where deptno = some (\n" + " select deptno from dept)"; sql(sql).expand(false).ok(); } - @Test public void testNotInUncorrelatedSubQueryRex() { + @Test void testNotInUncorrelatedSubQueryRex() { final String sql = "select empno from emp where deptno not in" + " (select deptno from dept)"; sql(sql).expand(false).ok(); } - @Test public void testNotCaseInThreeClause() { + @Test void testNotCaseInThreeClause() { final String sql = "select empno from emp where not case when " + "true then deptno in (10,20) else true end"; sql(sql).expand(false).ok(); } - @Test public void testNotCaseInMoreClause() { + @Test void testNotCaseInMoreClause() { final String sql = "select empno from emp where not case when " + "true then deptno in (10,20) when false then false else deptno in (30,40) end"; sql(sql).expand(false).ok(); } - @Test public void testNotCaseInWithoutElse() { + @Test void testNotCaseInWithoutElse() { final String sql = "select empno from emp where not case when " + "true then deptno in (10,20) end"; sql(sql).expand(false).ok(); } - @Test public void testWhereInCorrelated() { + @Test void testWhereInCorrelated() { final String sql = "select empno from emp as e\n" + "join dept as d using (deptno)\n" + "where e.sal in (\n" @@ -1515,7 +1515,7 @@ public final Sql sql(String sql) { sql(sql).expand(false).ok(); } - @Test public void testInUncorrelatedSubQueryInSelect() { + @Test void testInUncorrelatedSubQueryInSelect() { // In the SELECT clause, the value of IN remains in 3-valued logic // -- it's not forced into 2-valued by the "... IS TRUE" wrapper as in the // WHERE clause -- so the translation is more complicated. @@ -1525,7 +1525,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testInUncorrelatedSubQueryInSelectRex() { + @Test void testInUncorrelatedSubQueryInSelectRex() { // In the SELECT clause, the value of IN remains in 3-valued logic // -- it's not forced into 2-valued by the "... IS TRUE" wrapper as in the // WHERE clause -- so the translation is more complicated. @@ -1535,7 +1535,7 @@ public final Sql sql(String sql) { sql(sql).expand(false).ok(); } - @Test public void testInUncorrelatedSubQueryInHavingRex() { + @Test void testInUncorrelatedSubQueryInHavingRex() { final String sql = "select sum(sal) as s\n" + "from emp\n" + "group by deptno\n" @@ -1545,7 +1545,7 @@ public final Sql sql(String sql) { sql(sql).expand(false).ok(); } - @Test public void testUncorrelatedScalarSubQueryInOrderRex() { + @Test void testUncorrelatedScalarSubQueryInOrderRex() { final String sql = "select ename\n" + "from emp\n" + "order by (select case when true then deptno else null end from emp) desc,\n" @@ -1553,7 +1553,7 @@ public final Sql sql(String sql) { sql(sql).expand(false).ok(); } - @Test public void testUncorrelatedScalarSubQueryInGroupOrderRex() { + @Test void testUncorrelatedScalarSubQueryInGroupOrderRex() { final String sql = "select sum(sal) as s\n" + "from emp\n" + "group by deptno\n" @@ -1562,7 +1562,7 @@ public final Sql sql(String sql) { sql(sql).expand(false).ok(); } - @Test public void testUncorrelatedScalarSubQueryInAggregateRex() { + @Test void testUncorrelatedScalarSubQueryInAggregateRex() { final String sql = "select sum((select min(deptno) from emp)) as s\n" + "from emp\n" + "group by deptno\n"; @@ -1571,14 +1571,14 @@ public final Sql sql(String sql) { /** Plan should be as {@link #testInUncorrelatedSubQueryInSelect}, but with * an extra NOT. Both queries require 3-valued logic. */ - @Test public void testNotInUncorrelatedSubQueryInSelect() { + @Test void testNotInUncorrelatedSubQueryInSelect() { final String sql = "select empno, deptno not in (\n" + " select case when true then deptno else null end from dept)\n" + "from emp"; sql(sql).ok(); } - @Test public void testNotInUncorrelatedSubQueryInSelectRex() { + @Test void testNotInUncorrelatedSubQueryInSelectRex() { final String sql = "select empno, deptno not in (\n" + " select case when true then deptno else null end from dept)\n" + "from emp"; @@ -1587,7 +1587,7 @@ public final Sql sql(String sql) { /** Since 'deptno NOT IN (SELECT deptno FROM dept)' can not be null, we * generate a simpler plan. */ - @Test public void testNotInUncorrelatedSubQueryInSelectNotNull() { + @Test void testNotInUncorrelatedSubQueryInSelectNotNull() { final String sql = "select empno, deptno not in (\n" + " select deptno from dept)\n" + "from emp"; @@ -1596,7 +1596,7 @@ public final Sql sql(String sql) { /** Since 'deptno NOT IN (SELECT mgr FROM emp)' can be null, we need a more * complex plan, including counts of null and not-null keys. */ - @Test public void testNotInUncorrelatedSubQueryInSelectMayBeNull() { + @Test void testNotInUncorrelatedSubQueryInSelectMayBeNull() { final String sql = "select empno, deptno not in (\n" + " select mgr from emp)\n" + "from emp"; @@ -1605,7 +1605,7 @@ public final Sql sql(String sql) { /** Even though "mgr" allows nulls, we can deduce from the WHERE clause that * it will never be null. Therefore we can generate a simpler plan. */ - @Test public void testNotInUncorrelatedSubQueryInSelectDeduceNotNull() { + @Test void testNotInUncorrelatedSubQueryInSelectDeduceNotNull() { final String sql = "select empno, deptno not in (\n" + " select mgr from emp where mgr > 5)\n" + "from emp"; @@ -1614,7 +1614,7 @@ public final Sql sql(String sql) { /** Similar to {@link #testNotInUncorrelatedSubQueryInSelectDeduceNotNull()}, * using {@code IS NOT NULL}. */ - @Test public void testNotInUncorrelatedSubQueryInSelectDeduceNotNull2() { + @Test void testNotInUncorrelatedSubQueryInSelectDeduceNotNull2() { final String sql = "select empno, deptno not in (\n" + " select mgr from emp where mgr is not null)\n" + "from emp"; @@ -1623,7 +1623,7 @@ public final Sql sql(String sql) { /** Similar to {@link #testNotInUncorrelatedSubQueryInSelectDeduceNotNull()}, * using {@code IN}. */ - @Test public void testNotInUncorrelatedSubQueryInSelectDeduceNotNull3() { + @Test void testNotInUncorrelatedSubQueryInSelectDeduceNotNull3() { final String sql = "select empno, deptno not in (\n" + " select mgr from emp where mgr in (\n" + " select mgr from emp where deptno = 10))\n" @@ -1631,58 +1631,58 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testNotInUncorrelatedSubQueryInSelectNotNullRex() { + @Test void testNotInUncorrelatedSubQueryInSelectNotNullRex() { final String sql = "select empno, deptno not in (\n" + " select deptno from dept)\n" + "from emp"; sql(sql).expand(false).ok(); } - @Test public void testUnnestSelect() { + @Test void testUnnestSelect() { final String sql = "select*from unnest(select multiset[deptno] from dept)"; sql(sql).expand(true).ok(); } - @Test public void testUnnestSelectRex() { + @Test void testUnnestSelectRex() { final String sql = "select*from unnest(select multiset[deptno] from dept)"; sql(sql).expand(false).ok(); } - @Test public void testJoinUnnest() { + @Test void testJoinUnnest() { final String sql = "select*from dept as d, unnest(multiset[d.deptno * 2])"; sql(sql).ok(); } - @Test public void testJoinUnnestRex() { + @Test void testJoinUnnestRex() { final String sql = "select*from dept as d, unnest(multiset[d.deptno * 2])"; sql(sql).expand(false).ok(); } - @Test public void testLateral() { + @Test void testLateral() { final String sql = "select * from emp,\n" + " LATERAL (select * from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(false).ok(); } - @Test public void testLateralDecorrelate() { + @Test void testLateralDecorrelate() { final String sql = "select * from emp,\n" + " LATERAL (select * from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(true).expand(true).ok(); } - @Test public void testLateralDecorrelateRex() { + @Test void testLateralDecorrelateRex() { final String sql = "select * from emp,\n" + " LATERAL (select * from dept where emp.deptno=dept.deptno)"; sql(sql).decorrelate(true).ok(); } - @Test public void testLateralDecorrelateThetaRex() { + @Test void testLateralDecorrelateThetaRex() { final String sql = "select * from emp,\n" + " LATERAL (select * from dept where emp.deptno < dept.deptno)"; sql(sql).decorrelate(true).ok(); } - @Test public void testNestedCorrelations() { + @Test void testNestedCorrelations() { final String sql = "select *\n" + "from (select 2+deptno d2, 3+deptno d3 from emp) e\n" + " where exists (select 1 from (select deptno+1 d1 from dept) d\n" @@ -1691,7 +1691,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(false).ok(); } - @Test public void testNestedCorrelationsDecorrelated() { + @Test void testNestedCorrelationsDecorrelated() { final String sql = "select *\n" + "from (select 2+deptno d2, 3+deptno d3 from emp) e\n" + " where exists (select 1 from (select deptno+1 d1 from dept) d\n" @@ -1700,7 +1700,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).expand(true).ok(); } - @Test public void testNestedCorrelationsDecorrelatedRex() { + @Test void testNestedCorrelationsDecorrelatedRex() { final String sql = "select *\n" + "from (select 2+deptno d2, 3+deptno d3 from emp) e\n" + " where exists (select 1 from (select deptno+1 d1 from dept) d\n" @@ -1709,27 +1709,27 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).ok(); } - @Test public void testElement() { + @Test void testElement() { sql("select element(multiset[5]) from emp").ok(); } - @Test public void testElementInValues() { + @Test void testElementInValues() { sql("values element(multiset[5])").ok(); } - @Test public void testUnionAll() { + @Test void testUnionAll() { final String sql = "select empno from emp union all select deptno from dept"; sql(sql).ok(); } - @Test public void testUnion() { + @Test void testUnion() { final String sql = "select empno from emp union select deptno from dept"; sql(sql).ok(); } - @Test public void testUnionValues() { + @Test void testUnionValues() { // union with values final String sql = "values (10), (20)\n" + "union all\n" @@ -1738,7 +1738,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testUnionSubQuery() { + @Test void testUnionSubQuery() { // union of sub-query, inside from list, also values final String sql = "select deptno from emp as emp0 cross join\n" + " (select empno from emp union all\n" @@ -1747,27 +1747,27 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testIsDistinctFrom() { + @Test void testIsDistinctFrom() { final String sql = "select empno is distinct from deptno\n" + "from (values (cast(null as int), 1),\n" + " (2, cast(null as int))) as emp(empno, deptno)"; sql(sql).ok(); } - @Test public void testIsNotDistinctFrom() { + @Test void testIsNotDistinctFrom() { final String sql = "select empno is not distinct from deptno\n" + "from (values (cast(null as int), 1),\n" + " (2, cast(null as int))) as emp(empno, deptno)"; sql(sql).ok(); } - @Test public void testNotLike() { + @Test void testNotLike() { // note that 'x not like y' becomes 'not(x like y)' final String sql = "values ('a' not like 'b' escape 'c')"; sql(sql).ok(); } - @Test public void testTumble() { + @Test void testTumble() { final String sql = "select STREAM\n" + " TUMBLE_START(rowtime, INTERVAL '1' MINUTE) AS s,\n" + " TUMBLE_END(rowtime, INTERVAL '1' MINUTE) AS e\n" @@ -1778,7 +1778,7 @@ public final Sql sql(String sql) { // In generated plan, the first parameter of TUMBLE function will always be the last field // of it's input. There isn't a way to give the first operand a proper type. - @Test public void testTableValuedFunctionTumble() { + @Test void testTableValuedFunctionTumble() { final String sql = "select *\n" + "from table(tumble(table Shipments, descriptor(rowtime), INTERVAL '1' MINUTE))"; sql(sql).ok(); @@ -1786,18 +1786,18 @@ public final Sql sql(String sql) { // In generated plan, the first parameter of TUMBLE function will always be the last field // of it's input. There isn't a way to give the first operand a proper type. - @Test public void testTableValuedFunctionTumbleWithSubQueryParam() { + @Test void testTableValuedFunctionTumbleWithSubQueryParam() { final String sql = "select *\n" + "from table(tumble((select * from Shipments), descriptor(rowtime), INTERVAL '1' MINUTE))"; sql(sql).ok(); } - @Test public void testNotNotIn() { + @Test void testNotNotIn() { final String sql = "select * from EMP where not (ename not in ('Fred') )"; sql(sql).ok(); } - @Test public void testOverMultiple() { + @Test void testOverMultiple() { final String sql = "select sum(sal) over w1,\n" + " sum(deptno) over w1,\n" + " sum(deptno) over w2\n" @@ -1834,7 +1834,7 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-750] * Allow windowed aggregate on top of regular aggregate. */ - @Test public void testNestedAggregates() { + @Test void testNestedAggregates() { final String sql = "SELECT\n" + " avg(sum(sal) + 2 * min(empno) + 3 * avg(empno))\n" + " over (partition by deptno)\n" @@ -1848,7 +1848,7 @@ public final Sql sql(String sql) { * operator (in this case, * {@link org.apache.calcite.sql.fun.SqlCaseOperator}). */ - @Test public void testCase() { + @Test void testCase() { sql("values (case 'a' when 'a' then 1 end)").ok(); } @@ -1857,12 +1857,12 @@ public final Sql sql(String sql) { * of the operator (in this case, * {@link org.apache.calcite.sql.fun.SqlStdOperatorTable#CHARACTER_LENGTH}). */ - @Test public void testCharLength() { + @Test void testCharLength() { // Note that CHARACTER_LENGTH becomes CHAR_LENGTH. sql("values (character_length('foo'))").ok(); } - @Test public void testOverAvg() { + @Test void testOverAvg() { // AVG(x) gets translated to SUM(x)/COUNT(x). Because COUNT controls // the return type there usually needs to be a final CAST to get the // result back to match the type of x. @@ -1873,7 +1873,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOverAvg2() { + @Test void testOverAvg2() { // Check to see if extra CAST is present. Because CAST is nested // inside AVG it passed to both SUM and COUNT so the outer final CAST // isn't needed. @@ -1884,7 +1884,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testOverCountStar() { + @Test void testOverCountStar() { final String sql = "select count(sal) over w1,\n" + " count(*) over w1\n" + "from emp\n" @@ -1895,7 +1895,7 @@ public final Sql sql(String sql) { /** * Tests that a window containing only ORDER BY is implicitly CURRENT ROW. */ - @Test public void testOverOrderWindow() { + @Test void testOverOrderWindow() { final String sql = "select last_value(deptno) over w\n" + "from emp\n" + "window w as (order by empno)"; @@ -1910,7 +1910,7 @@ public final Sql sql(String sql) { /** * Tests that a window with specifying null treatment. */ - @Test public void testOverNullTreatmentWindow() { + @Test void testOverNullTreatmentWindow() { final String sql = "select\n" + "lead(deptno, 1) over w,\n " + "lead(deptno, 2) ignore nulls over w,\n" @@ -1933,7 +1933,7 @@ public final Sql sql(String sql) { * Tests that a window with a FOLLOWING bound becomes BETWEEN CURRENT ROW * AND FOLLOWING. */ - @Test public void testOverOrderFollowingWindow() { + @Test void testOverOrderFollowingWindow() { // Window contains only ORDER BY (implicitly CURRENT ROW). final String sql = "select last_value(deptno) over w\n" + "from emp\n" @@ -1947,7 +1947,7 @@ public final Sql sql(String sql) { sql(sql2).ok(); } - @Test public void testTumbleTable() { + @Test void testTumbleTable() { final String sql = "select stream" + " tumble_end(rowtime, interval '2' hour) as rowtime, productId\n" + "from orders\n" @@ -1957,7 +1957,7 @@ public final Sql sql(String sql) { /** As {@link #testTumbleTable()} but on a table where "rowtime" is at * position 1 not 0. */ - @Test public void testTumbleTableRowtimeNotFirstColumn() { + @Test void testTumbleTableRowtimeNotFirstColumn() { final String sql = "select stream\n" + " tumble_end(rowtime, interval '2' hour) as rowtime, orderId\n" + "from shipments\n" @@ -1965,7 +1965,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testHopTable() { + @Test void testHopTable() { final String sql = "select stream hop_start(rowtime, interval '1' hour," + " interval '3' hour) as rowtime,\n" + " count(*) as c\n" @@ -1974,7 +1974,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testSessionTable() { + @Test void testSessionTable() { final String sql = "select stream session_start(rowtime, interval '1' hour)" + " as rowtime,\n" + " session_end(rowtime, interval '1' hour),\n" @@ -1984,7 +1984,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testInterval() { + @Test void testInterval() { // temporarily disabled per DTbug 1212 if (!Bug.DT785_FIXED) { return; @@ -1994,13 +1994,13 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testStream() { + @Test void testStream() { final String sql = "select stream productId from orders where productId = 10"; sql(sql).ok(); } - @Test public void testStreamGroupBy() { + @Test void testStreamGroupBy() { final String sql = "select stream\n" + " floor(rowtime to second) as rowtime, count(*) as c\n" + "from orders\n" @@ -2008,7 +2008,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testStreamWindowedAggregation() { + @Test void testStreamWindowedAggregation() { final String sql = "select stream *,\n" + " count(*) over (partition by productId\n" + " order by rowtime\n" @@ -2017,7 +2017,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testExplainAsXml() { + @Test void testExplainAsXml() { String sql = "select 1 + 2, 3 from (values (true))"; final RelNode rel = tester.convertSqlToRel(sql).rel; StringWriter sw = new StringWriter(); @@ -2050,7 +2050,7 @@ public final Sql sql(String sql) { * [CALCITE-412] * RelFieldTrimmer: when trimming Sort, the collation and trait set don't * match. */ - @Test public void testSortWithTrim() { + @Test void testSortWithTrim() { final String sql = "select ename from (select * from emp order by sal) a"; sql(sql).trim(true).ok(); } @@ -2058,7 +2058,7 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-3183] * Trimming method for Filter rel uses wrong traitSet. */ - @Test public void testFilterAndSortWithTrim() { + @Test void testFilterAndSortWithTrim() { // Create a customized test with RelCollation trait in the test cluster. Tester tester = new TesterImpl(getDiffRepos(), false, true, @@ -2106,7 +2106,7 @@ public final Sql sql(String sql) { assertTrue(filterCollation.satisfies(sortCollation)); } - @Test public void testRelShuttleForLogicalTableModify() { + @Test void testRelShuttleForLogicalTableModify() { final String sql = "insert into emp select * from emp"; final LogicalTableModify rel = (LogicalTableModify) tester.convertSqlToRel(sql).rel; final List rels = new ArrayList<>(); @@ -2122,7 +2122,7 @@ public final Sql sql(String sql) { assertThat(rels.get(0), isA(LogicalTableModify.class)); } - @Test public void testOffset0() { + @Test void testOffset0() { final String sql = "select * from emp offset 0"; sql(sql).ok(); } @@ -2130,7 +2130,7 @@ public final Sql sql(String sql) { /** * Test group-by CASE expression involving a non-query IN */ - @Test public void testGroupByCaseSubQuery() { + @Test void testGroupByCaseSubQuery() { final String sql = "SELECT CASE WHEN emp.empno IN (3) THEN 0 ELSE 1 END\n" + "FROM emp\n" + "GROUP BY (CASE WHEN emp.empno IN (3) THEN 0 ELSE 1 END)"; @@ -2140,7 +2140,7 @@ public final Sql sql(String sql) { /** * Test aggregate function on a CASE expression involving a non-query IN */ - @Test public void testAggCaseSubQuery() { + @Test void testAggCaseSubQuery() { final String sql = "SELECT SUM(CASE WHEN empno IN (3) THEN 0 ELSE 1 END) FROM emp"; sql(sql).ok(); @@ -2150,7 +2150,7 @@ public final Sql sql(String sql) { * [CALCITE-753] * Test aggregate operators do not derive row types with duplicate column * names. */ - @Test public void testAggNoDuplicateColumnNames() { + @Test void testAggNoDuplicateColumnNames() { final String sql = "SELECT empno, EXPR$2, COUNT(empno) FROM (\n" + " SELECT empno, deptno AS EXPR$2\n" + " FROM emp)\n" @@ -2158,7 +2158,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testAggScalarSubQuery() { + @Test void testAggScalarSubQuery() { final String sql = "SELECT SUM(SELECT min(deptno) FROM dept) FROM emp"; sql(sql).ok(); } @@ -2169,14 +2169,14 @@ public final Sql sql(String sql) { *

    Test case for * [CALCITE-551] * Sub-query inside aggregate function. */ - @Test public void testAggCaseInSubQuery() { + @Test void testAggCaseInSubQuery() { final String sql = "SELECT SUM(\n" + " CASE WHEN deptno IN (SELECT deptno FROM dept) THEN 1 ELSE 0 END)\n" + "FROM emp"; sql(sql).expand(false).ok(); } - @Test public void testCorrelatedSubQueryInAggregate() { + @Test void testCorrelatedSubQueryInAggregate() { final String sql = "SELECT SUM(\n" + " (select char_length(name) from dept\n" + " where dept.deptno = emp.empno))\n" @@ -2189,7 +2189,7 @@ public final Sql sql(String sql) { * [CALCITE-614] * IN within CASE within GROUP BY gives AssertionError. */ - @Test public void testGroupByCaseIn() { + @Test void testGroupByCaseIn() { final String sql = "select\n" + " (CASE WHEN (deptno IN (10, 20)) THEN 0 ELSE deptno END),\n" + " min(empno) from EMP\n" @@ -2197,133 +2197,133 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testInsert() { + @Test void testInsert() { final String sql = "insert into empnullables (deptno, empno, ename)\n" + "values (10, 150, 'Fred')"; sql(sql).ok(); } - @Test public void testInsertSubset() { + @Test void testInsertSubset() { final String sql = "insert into empnullables\n" + "values (50, 'Fred')"; sql(sql).conformance(SqlConformanceEnum.PRAGMATIC_2003).ok(); } - @Test public void testInsertWithCustomInitializerExpressionFactory() { + @Test void testInsertWithCustomInitializerExpressionFactory() { final String sql = "insert into empdefaults (deptno) values (300)"; sql(sql).ok(); } - @Test public void testInsertSubsetWithCustomInitializerExpressionFactory() { + @Test void testInsertSubsetWithCustomInitializerExpressionFactory() { final String sql = "insert into empdefaults values (100)"; sql(sql).conformance(SqlConformanceEnum.PRAGMATIC_2003).ok(); } - @Test public void testInsertBind() { + @Test void testInsertBind() { final String sql = "insert into empnullables (deptno, empno, ename)\n" + "values (?, ?, ?)"; sql(sql).ok(); } - @Test public void testInsertBindSubset() { + @Test void testInsertBindSubset() { final String sql = "insert into empnullables\n" + "values (?, ?)"; sql(sql).conformance(SqlConformanceEnum.PRAGMATIC_2003).ok(); } - @Test public void testInsertBindWithCustomInitializerExpressionFactory() { + @Test void testInsertBindWithCustomInitializerExpressionFactory() { final String sql = "insert into empdefaults (deptno) values (?)"; sql(sql).ok(); } - @Test public void testInsertBindSubsetWithCustomInitializerExpressionFactory() { + @Test void testInsertBindSubsetWithCustomInitializerExpressionFactory() { final String sql = "insert into empdefaults values (?)"; sql(sql).conformance(SqlConformanceEnum.PRAGMATIC_2003).ok(); } - @Test public void testInsertSubsetView() { + @Test void testInsertSubsetView() { final String sql = "insert into empnullables_20\n" + "values (10, 'Fred')"; sql(sql).conformance(SqlConformanceEnum.PRAGMATIC_2003).ok(); } - @Test public void testInsertExtendedColumn() { + @Test void testInsertExtendedColumn() { final String sql = "insert into empdefaults(updated TIMESTAMP)\n" + " (ename, deptno, empno, updated, sal)\n" + " values ('Fred', 456, 44, timestamp '2017-03-12 13:03:05', 999999)"; sql(sql).ok(); } - @Test public void testInsertBindExtendedColumn() { + @Test void testInsertBindExtendedColumn() { final String sql = "insert into empdefaults(updated TIMESTAMP)\n" + " (ename, deptno, empno, updated, sal)\n" + " values ('Fred', 456, 44, ?, 999999)"; sql(sql).ok(); } - @Test public void testInsertExtendedColumnModifiableView() { + @Test void testInsertExtendedColumnModifiableView() { final String sql = "insert into EMP_MODIFIABLEVIEW2(updated TIMESTAMP)\n" + " (ename, deptno, empno, updated, sal)\n" + " values ('Fred', 20, 44, timestamp '2017-03-12 13:03:05', 999999)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testInsertBindExtendedColumnModifiableView() { + @Test void testInsertBindExtendedColumnModifiableView() { final String sql = "insert into EMP_MODIFIABLEVIEW2(updated TIMESTAMP)\n" + " (ename, deptno, empno, updated, sal)\n" + " values ('Fred', 20, 44, ?, 999999)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testInsertWithSort() { + @Test void testInsertWithSort() { final String sql = "insert into empnullables (empno, ename)\n" + "select deptno, ename from emp order by ename"; sql(sql).ok(); } - @Test public void testInsertWithLimit() { + @Test void testInsertWithLimit() { final String sql = "insert into empnullables (empno, ename)\n" + "select deptno, ename from emp order by ename limit 10"; sql(sql).ok(); } - @Test public void testDelete() { + @Test void testDelete() { final String sql = "delete from emp"; sql(sql).ok(); } - @Test public void testDeleteWhere() { + @Test void testDeleteWhere() { final String sql = "delete from emp where deptno = 10"; sql(sql).ok(); } - @Test public void testDeleteBind() { + @Test void testDeleteBind() { final String sql = "delete from emp where deptno = ?"; sql(sql).ok(); } - @Test public void testDeleteBindExtendedColumn() { + @Test void testDeleteBindExtendedColumn() { final String sql = "delete from emp(enddate TIMESTAMP) where enddate < ?"; sql(sql).ok(); } - @Test public void testDeleteBindModifiableView() { + @Test void testDeleteBindModifiableView() { final String sql = "delete from EMP_MODIFIABLEVIEW2 where empno = ?"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testDeleteBindExtendedColumnModifiableView() { + @Test void testDeleteBindExtendedColumnModifiableView() { final String sql = "delete from EMP_MODIFIABLEVIEW2(note VARCHAR)\n" + "where note = ?"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testUpdate() { + @Test void testUpdate() { final String sql = "update emp set empno = empno + 1"; sql(sql).ok(); } - @Test public void testUpdateSubQuery() { + @Test void testUpdateSubQuery() { final String sql = "update emp\n" + "set empno = (\n" + " select min(empno) from emp as e where e.deptno = emp.deptno)"; @@ -2335,7 +2335,7 @@ public final Sql sql(String sql) { * [CALCITE-3229] * UnsupportedOperationException for UPDATE with IN query. */ - @Test public void testUpdateSubQueryWithIn() { + @Test void testUpdateSubQueryWithIn() { final String sql = "update emp\n" + "set empno = 1 where empno in (\n" + " select empno from emp where empno=2)"; @@ -2347,7 +2347,7 @@ public final Sql sql(String sql) { * [CALCITE-3292] * NPE for UPDATE with IN query. */ - @Test public void testUpdateSubQueryWithIn1() { + @Test void testUpdateSubQueryWithIn1() { final String sql = "update emp\n" + "set empno = 1 where emp.empno in (\n" + " select emp.empno from emp where emp.empno=2)"; @@ -2355,66 +2355,66 @@ public final Sql sql(String sql) { } /** Similar to {@link #testUpdateSubQueryWithIn()} but with not in instead of in. */ - @Test public void testUpdateSubQueryWithNotIn() { + @Test void testUpdateSubQueryWithNotIn() { final String sql = "update emp\n" + "set empno = 1 where empno not in (\n" + " select empno from emp where empno=2)"; sql(sql).ok(); } - @Test public void testUpdateWhere() { + @Test void testUpdateWhere() { final String sql = "update emp set empno = empno + 1 where deptno = 10"; sql(sql).ok(); } - @Test public void testUpdateModifiableView() { + @Test void testUpdateModifiableView() { final String sql = "update EMP_MODIFIABLEVIEW2\n" + "set sal = sal + 5000 where slacker = false"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testUpdateExtendedColumn() { + @Test void testUpdateExtendedColumn() { final String sql = "update empdefaults(updated TIMESTAMP)" + " set deptno = 1, updated = timestamp '2017-03-12 13:03:05', empno = 20, ename = 'Bob'" + " where deptno = 10"; sql(sql).ok(); } - @Test public void testUpdateExtendedColumnModifiableView() { + @Test void testUpdateExtendedColumnModifiableView() { final String sql = "update EMP_MODIFIABLEVIEW2(updated TIMESTAMP)\n" + "set updated = timestamp '2017-03-12 13:03:05', sal = sal + 5000\n" + "where slacker = false"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testUpdateBind() { + @Test void testUpdateBind() { final String sql = "update emp" + " set sal = sal + ? where slacker = false"; sql(sql).ok(); } - @Test public void testUpdateBind2() { + @Test void testUpdateBind2() { final String sql = "update emp" + " set sal = ? where slacker = false"; sql(sql).ok(); } @Disabled("CALCITE-1708") - @Test public void testUpdateBindExtendedColumn() { + @Test void testUpdateBindExtendedColumn() { final String sql = "update emp(test INT)" + " set test = ?, sal = sal + 5000 where slacker = false"; sql(sql).ok(); } @Disabled("CALCITE-1708") - @Test public void testUpdateBindExtendedColumnModifiableView() { + @Test void testUpdateBindExtendedColumnModifiableView() { final String sql = "update EMP_MODIFIABLEVIEW2(test INT)" + " set test = ?, sal = sal + 5000 where slacker = false"; sql(sql).ok(); } @Disabled("CALCITE-985") - @Test public void testMerge() { + @Test void testMerge() { final String sql = "merge into emp as target\n" + "using (select * from emp where deptno = 30) as source\n" + "on target.empno = source.empno\n" @@ -2426,63 +2426,63 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testSelectView() { + @Test void testSelectView() { // translated condition: deptno = 20 and sal > 1000 and empno > 100 final String sql = "select * from emp_20 where empno > 100"; sql(sql).ok(); } - @Test public void testInsertView() { + @Test void testInsertView() { final String sql = "insert into empnullables_20 (empno, ename)\n" + "values (150, 'Fred')"; sql(sql).ok(); } - @Test public void testInsertModifiableView() { + @Test void testInsertModifiableView() { final String sql = "insert into EMP_MODIFIABLEVIEW (EMPNO, ENAME, JOB)" + " values (34625, 'nom', 'accountant')"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testInsertSubsetModifiableView() { + @Test void testInsertSubsetModifiableView() { final String sql = "insert into EMP_MODIFIABLEVIEW " + "values (10, 'Fred')"; sql(sql).with(getExtendedTester()) .conformance(SqlConformanceEnum.PRAGMATIC_2003).ok(); } - @Test public void testInsertBindModifiableView() { + @Test void testInsertBindModifiableView() { final String sql = "insert into EMP_MODIFIABLEVIEW (empno, job)" + " values (?, ?)"; sql(sql).with(getExtendedTester()).ok(); } - @Test public void testInsertBindSubsetModifiableView() { + @Test void testInsertBindSubsetModifiableView() { final String sql = "insert into EMP_MODIFIABLEVIEW" + " values (?, ?)"; sql(sql).conformance(SqlConformanceEnum.PRAGMATIC_2003) .with(getExtendedTester()).ok(); } - @Test public void testInsertWithCustomColumnResolving() { + @Test void testInsertWithCustomColumnResolving() { final String sql = "insert into struct.t values (?, ?, ?, ?, ?, ?, ?, ?, ?)"; sql(sql).ok(); } - @Test public void testInsertWithCustomColumnResolving2() { + @Test void testInsertWithCustomColumnResolving2() { final String sql = "insert into struct.t_nullables (f0.c0, f1.c2, c1)\n" + "values (?, ?, ?)"; sql(sql).ok(); } - @Test public void testInsertViewWithCustomColumnResolving() { + @Test void testInsertViewWithCustomColumnResolving() { final String sql = "insert into struct.t_10 (f0.c0, f1.c2, c1, k0,\n" + " f1.a0, f2.a0, f0.c1, f2.c3)\n" + "values (?, ?, ?, ?, ?, ?, ?, ?)"; sql(sql).ok(); } - @Test public void testUpdateWithCustomColumnResolving() { + @Test void testUpdateWithCustomColumnResolving() { final String sql = "update struct.t set c0 = c0 + 1"; sql(sql).ok(); } @@ -2493,14 +2493,14 @@ public final Sql sql(String sql) { * Existential sub-query that has aggregate without grouping key * should be simplified to constant boolean expression. */ - @Test public void testSimplifyExistsAggregateSubQuery() { + @Test void testSimplifyExistsAggregateSubQuery() { final String sql = "SELECT e1.empno\n" + "FROM emp e1 where exists\n" + "(select avg(sal) from emp e2 where e1.empno = e2.empno)"; sql(sql).decorrelate(true).ok(); } - @Test public void testSimplifyNotExistsAggregateSubQuery() { + @Test void testSimplifyNotExistsAggregateSubQuery() { final String sql = "SELECT e1.empno\n" + "FROM emp e1 where not exists\n" + "(select avg(sal) from emp e2 where e1.empno = e2.empno)"; @@ -2513,14 +2513,14 @@ public final Sql sql(String sql) { * Existential sub-query that has Values with at least 1 tuple * should be simplified to constant boolean expression. */ - @Test public void testSimplifyExistsValuesSubQuery() { + @Test void testSimplifyExistsValuesSubQuery() { final String sql = "select deptno\n" + "from EMP\n" + "where exists (values 10)"; sql(sql).decorrelate(true).ok(); } - @Test public void testSimplifyNotExistsValuesSubQuery() { + @Test void testSimplifyNotExistsValuesSubQuery() { final String sql = "select deptno\n" + "from EMP\n" + "where not exists (values 10)"; @@ -2532,7 +2532,7 @@ public final Sql sql(String sql) { * [CALCITE-695] * SqlSingleValueAggFunction is created when it may not be needed. */ - @Test public void testSubQueryAggregateFunctionFollowedBySimpleOperation() { + @Test void testSubQueryAggregateFunctionFollowedBySimpleOperation() { final String sql = "select deptno\n" + "from EMP\n" + "where deptno > (select min(deptno) * 2 + 10 from EMP)"; @@ -2546,7 +2546,7 @@ public final Sql sql(String sql) { * *

    The problem is only fixed if you have {@code expand = false}. */ - @Test public void testSubQueryOr() { + @Test void testSubQueryOr() { final String sql = "select * from emp where deptno = 10 or deptno in (\n" + " select dept.deptno from dept where deptno < 5)\n"; sql(sql).expand(false).ok(); @@ -2557,7 +2557,7 @@ public final Sql sql(String sql) { * [CALCITE-695] * SqlSingleValueAggFunction is created when it may not be needed. */ - @Test public void testSubQueryValues() { + @Test void testSubQueryValues() { final String sql = "select deptno\n" + "from EMP\n" + "where deptno > (values 10)"; @@ -2569,7 +2569,7 @@ public final Sql sql(String sql) { * [CALCITE-695] * SqlSingleValueAggFunction is created when it may not be needed. */ - @Test public void testSubQueryLimitOne() { + @Test void testSubQueryLimitOne() { final String sql = "select deptno\n" + "from EMP\n" + "where deptno > (select deptno\n" @@ -2583,7 +2583,7 @@ public final Sql sql(String sql) { * When look up sub-queries, perform the same logic as the way when ones were * registered. */ - @Test public void testIdenticalExpressionInSubQuery() { + @Test void testIdenticalExpressionInSubQuery() { final String sql = "select deptno\n" + "from EMP\n" + "where deptno in (1, 2) or deptno in (1, 2)"; @@ -2595,7 +2595,7 @@ public final Sql sql(String sql) { * [CALCITE-694] * Scan HAVING clause for sub-queries and IN-lists relating to IN. */ - @Test public void testHavingAggrFunctionIn() { + @Test void testHavingAggrFunctionIn() { final String sql = "select deptno\n" + "from emp\n" + "group by deptno\n" @@ -2610,7 +2610,7 @@ public final Sql sql(String sql) { * Scan HAVING clause for sub-queries and IN-lists, with a sub-query in * the HAVING clause. */ - @Test public void testHavingInSubQueryWithAggrFunction() { + @Test void testHavingInSubQueryWithAggrFunction() { final String sql = "select sal\n" + "from emp\n" + "group by sal\n" @@ -2628,7 +2628,7 @@ public final Sql sql(String sql) { * Scalar sub-query and aggregate function in SELECT or HAVING clause gives * AssertionError; variant involving HAVING clause. */ - @Test public void testAggregateAndScalarSubQueryInHaving() { + @Test void testAggregateAndScalarSubQueryInHaving() { final String sql = "select deptno\n" + "from emp\n" + "group by deptno\n" @@ -2642,7 +2642,7 @@ public final Sql sql(String sql) { * Scalar sub-query and aggregate function in SELECT or HAVING clause gives * AssertionError; variant involving SELECT clause. */ - @Test public void testAggregateAndScalarSubQueryInSelect() { + @Test void testAggregateAndScalarSubQueryInSelect() { final String sql = "select deptno,\n" + " max(emp.empno) > (SELECT min(emp.empno) FROM emp) as b\n" + "from emp\n" @@ -2655,7 +2655,7 @@ public final Sql sql(String sql) { * [CALCITE-770] * window aggregate and ranking functions with grouped aggregates. */ - @Test public void testWindowAggWithGroupBy() { + @Test void testWindowAggWithGroupBy() { final String sql = "select min(deptno), rank() over (order by empno),\n" + "max(empno) over (partition by deptno)\n" + "from emp group by deptno, empno\n"; @@ -2667,7 +2667,7 @@ public final Sql sql(String sql) { * [CALCITE-847] * AVG window function in GROUP BY gives AssertionError. */ - @Test public void testWindowAverageWithGroupBy() { + @Test void testWindowAverageWithGroupBy() { final String sql = "select avg(deptno) over ()\n" + "from emp\n" + "group by deptno"; @@ -2679,7 +2679,7 @@ public final Sql sql(String sql) { * [CALCITE-770] * variant involving joins. */ - @Test public void testWindowAggWithGroupByAndJoin() { + @Test void testWindowAggWithGroupByAndJoin() { final String sql = "select min(d.deptno), rank() over (order by e.empno),\n" + " max(e.empno) over (partition by e.deptno)\n" + "from emp e, dept d\n" @@ -2693,7 +2693,7 @@ public final Sql sql(String sql) { * [CALCITE-770] * variant involving HAVING clause. */ - @Test public void testWindowAggWithGroupByAndHaving() { + @Test void testWindowAggWithGroupByAndHaving() { final String sql = "select min(deptno), rank() over (order by empno),\n" + "max(empno) over (partition by deptno)\n" + "from emp group by deptno, empno\n" @@ -2707,7 +2707,7 @@ public final Sql sql(String sql) { * variant involving join with sub-query that contains window function and * GROUP BY. */ - @Test public void testWindowAggInSubQueryJoin() { + @Test void testWindowAggInSubQueryJoin() { final String sql = "select T.x, T.y, T.z, emp.empno\n" + "from (select min(deptno) as x,\n" + " rank() over (order by empno) as y,\n" @@ -2722,7 +2722,7 @@ public final Sql sql(String sql) { * [CALCITE-1313] * Validator should derive type of expression in ORDER BY. */ - @Test public void testOrderByOver() { + @Test void testOrderByOver() { String sql = "select deptno, rank() over(partition by empno order by deptno)\n" + "from emp order by row_number() over(partition by empno order by deptno)"; sql(sql).ok(); @@ -2733,7 +2733,7 @@ public final Sql sql(String sql) { * [CALCITE-714] * When de-correlating, push join condition into sub-query. */ - @Test public void testCorrelationScalarAggAndFilter() { + @Test void testCorrelationScalarAggAndFilter() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -2745,7 +2745,7 @@ public final Sql sql(String sql) { * [CALCITE-1543] * Correlated scalar sub-query with multiple aggregates gives * AssertionError. */ - @Test public void testCorrelationMultiScalarAggregate() { + @Test void testCorrelationMultiScalarAggregate() { final String sql = "select sum(e1.empno)\n" + "from emp e1, dept d1\n" + "where e1.deptno = d1.deptno\n" @@ -2754,7 +2754,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).expand(true).ok(); } - @Test public void testCorrelationScalarAggAndFilterRex() { + @Test void testCorrelationScalarAggAndFilterRex() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -2767,7 +2767,7 @@ public final Sql sql(String sql) { * [CALCITE-714] * When de-correlating, push join condition into sub-query. */ - @Test public void testCorrelationExistsAndFilter() { + @Test void testCorrelationExistsAndFilter() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -2775,7 +2775,7 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).expand(true).ok(); } - @Test public void testCorrelationExistsAndFilterRex() { + @Test void testCorrelationExistsAndFilterRex() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -2786,7 +2786,7 @@ public final Sql sql(String sql) { /** A theta join condition, unlike the equi-join condition in * {@link #testCorrelationExistsAndFilterRex()}, requires a value * generator. */ - @Test public void testCorrelationExistsAndFilterThetaRex() { + @Test void testCorrelationExistsAndFilterThetaRex() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -2799,7 +2799,7 @@ public final Sql sql(String sql) { * [CALCITE-714] * When de-correlating, push join condition into sub-query. */ - @Test public void testCorrelationNotExistsAndFilter() { + @Test void testCorrelationNotExistsAndFilter() { final String sql = "SELECT e1.empno\n" + "FROM emp e1, dept d1 where e1.deptno = d1.deptno\n" + "and e1.deptno < 10 and d1.deptno < 15\n" @@ -2811,7 +2811,7 @@ public final Sql sql(String sql) { * Test case for decorrelating sub-query that has aggregate with * grouping sets. */ - @Test public void testCorrelationAggregateGroupSets() { + @Test void testCorrelationAggregateGroupSets() { final String sql = "select sum(e1.empno)\n" + "from emp e1, dept d1\n" + "where e1.deptno = d1.deptno\n" @@ -2820,37 +2820,37 @@ public final Sql sql(String sql) { sql(sql).decorrelate(true).ok(); } - @Test public void testCustomColumnResolving() { + @Test void testCustomColumnResolving() { final String sql = "select k0 from struct.t"; sql(sql).ok(); } - @Test public void testCustomColumnResolving2() { + @Test void testCustomColumnResolving2() { final String sql = "select c2 from struct.t"; sql(sql).ok(); } - @Test public void testCustomColumnResolving3() { + @Test void testCustomColumnResolving3() { final String sql = "select f1.c2 from struct.t"; sql(sql).ok(); } - @Test public void testCustomColumnResolving4() { + @Test void testCustomColumnResolving4() { final String sql = "select c1 from struct.t order by f0.c1"; sql(sql).ok(); } - @Test public void testCustomColumnResolving5() { + @Test void testCustomColumnResolving5() { final String sql = "select count(c1) from struct.t group by f0.c1"; sql(sql).ok(); } - @Test public void testCustomColumnResolvingWithSelectStar() { + @Test void testCustomColumnResolvingWithSelectStar() { final String sql = "select * from struct.t"; sql(sql).ok(); } - @Test public void testCustomColumnResolvingWithSelectFieldNameDotStar() { + @Test void testCustomColumnResolvingWithSelectFieldNameDotStar() { final String sql = "select f1.* from struct.t"; sql(sql).ok(); } @@ -2860,7 +2860,7 @@ public final Sql sql(String sql) { * [CALCITE-1150] * Dynamic Table / Dynamic Star support */ - @Test public void testSelectFromDynamicTable() throws Exception { + @Test void testSelectFromDynamicTable() throws Exception { final String sql = "select n_nationkey, n_name from SALES.NATION"; sql(sql).with(getTesterWithDynamicTable()).ok(); } @@ -2869,7 +2869,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testSelectStarFromDynamicTable() throws Exception { + @Test void testSelectStarFromDynamicTable() throws Exception { final String sql = "select * from SALES.NATION"; sql(sql).with(getTesterWithDynamicTable()).ok(); } @@ -2878,7 +2878,7 @@ public final Sql sql(String sql) { * [CALCITE-2080] * Query with NOT IN operator and literal fails throws AssertionError: 'Cast * for just nullability not allowed'. */ - @Test public void testNotInWithLiteral() { + @Test void testNotInWithLiteral() { final String sql = "SELECT *\n" + "FROM SALES.NATION\n" + "WHERE n_name NOT IN\n" @@ -2891,7 +2891,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testReferDynamicStarInSelectOB() throws Exception { + @Test void testReferDynamicStarInSelectOB() throws Exception { final String sql = "select n_nationkey, n_name\n" + "from (select * from SALES.NATION)\n" + "order by n_regionkey"; @@ -2902,7 +2902,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testDynamicStarInTableJoin() throws Exception { + @Test void testDynamicStarInTableJoin() throws Exception { final String sql = "select * from " + " (select * from SALES.NATION) T1, " + " (SELECT * from SALES.CUSTOMER) T2 " @@ -2910,7 +2910,7 @@ public final Sql sql(String sql) { sql(sql).with(getTesterWithDynamicTable()).ok(); } - @Test public void testDynamicNestedColumn() { + @Test void testDynamicNestedColumn() { final String sql = "select t3.fake_q1['fake_col2'] as fake2\n" + "from (\n" + " select t2.fake_col as fake_q1\n" @@ -2922,7 +2922,7 @@ public final Sql sql(String sql) { * Test case for [CALCITE-2900] * RelStructuredTypeFlattener generates wrong types on nested columns. */ - @Test public void testNestedColumnType() { + @Test void testNestedColumnType() { final String sql = "select empa.home_address.zip from sales.emp_address empa where empa.home_address.city = 'abc'"; sql(sql).ok(); @@ -2934,7 +2934,7 @@ public final Sql sql(String sql) { * RelStructuredTypeFlattener generates wrong types for nested column when * flattenProjection. */ - @Test public void testSelectNestedColumnType() { + @Test void testSelectNestedColumnType() { final String sql = "select\n" + " char_length(coord.\"unit\") as unit_length\n" + "from\n" @@ -2953,25 +2953,25 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testNestedStructFieldAccess() { + @Test void testNestedStructFieldAccess() { final String sql = "select dn.skill['others']\n" + "from sales.dept_nested dn"; sql(sql).ok(); } - @Test public void testNestedStructPrimitiveFieldAccess() { + @Test void testNestedStructPrimitiveFieldAccess() { final String sql = "select dn.skill['others']['a']\n" + "from sales.dept_nested dn"; sql(sql).ok(); } - @Test public void testFunctionWithStructInput() { + @Test void testFunctionWithStructInput() { final String sql = "select json_type(skill)\n" + "from sales.dept_nested"; sql(sql).ok(); } - @Test public void testAggregateFunctionForStructInput() { + @Test void testAggregateFunctionForStructInput() { final String sql = "select collect(skill) as collect_skill,\n" + " count(skill) as count_skill, count(*) as count_star,\n" + " approx_count_distinct(skill) as approx_count_distinct_skill,\n" @@ -2981,7 +2981,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testAggregateFunctionForStructInputByName() { + @Test void testAggregateFunctionForStructInputByName() { final String sql = "select collect(skill) as collect_skill,\n" + " count(skill) as count_skill, count(*) as count_star,\n" + " approx_count_distinct(skill) as approx_count_distinct_skill,\n" @@ -2991,31 +2991,31 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testNestedPrimitiveFieldAccess() { + @Test void testNestedPrimitiveFieldAccess() { final String sql = "select dn.skill['desc']\n" + "from sales.dept_nested dn"; sql(sql).ok(); } - @Test public void testArrayElementNestedPrimitive() { + @Test void testArrayElementNestedPrimitive() { final String sql = "select dn.employees[0]['empno']\n" + "from sales.dept_nested dn"; sql(sql).ok(); } - @Test public void testArrayElementDoublyNestedPrimitive() { + @Test void testArrayElementDoublyNestedPrimitive() { final String sql = "select dn.employees[0]['detail']['skills'][0]['type']\n" + "from sales.dept_nested dn"; sql(sql).ok(); } - @Test public void testArrayElementDoublyNestedStruct() { + @Test void testArrayElementDoublyNestedStruct() { final String sql = "select dn.employees[0]['detail']['skills'][0]\n" + "from sales.dept_nested dn"; sql(sql).ok(); } - @Test public void testArrayElementThreeTimesNestedStruct() { + @Test void testArrayElementThreeTimesNestedStruct() { final String sql = "" + "select dn.employees[0]['detail']['skills'][0]['others']\n" + "from sales.dept_nested dn"; @@ -3027,7 +3027,7 @@ public final Sql sql(String sql) { * [CALCITE-3003] * AssertionError when GROUP BY nested field. */ - @Test public void testGroupByNestedColumn() { + @Test void testGroupByNestedColumn() { final String sql = "select\n" + " coord.x,\n" @@ -3045,7 +3045,7 @@ public final Sql sql(String sql) { * Similar to {@link #testGroupByNestedColumn()}, * but with grouping sets. */ - @Test public void testGroupingSetsWithNestedColumn() { + @Test void testGroupingSetsWithNestedColumn() { final String sql = "select\n" + " coord.x,\n" @@ -3066,7 +3066,7 @@ public final Sql sql(String sql) { * Similar to {@link #testGroupByNestedColumn()}, * but with cube. */ - @Test public void testGroupByCubeWithNestedColumn() { + @Test void testGroupByCubeWithNestedColumn() { final String sql = "select\n" + " coord.x,\n" @@ -3080,7 +3080,7 @@ public final Sql sql(String sql) { sql(sql).ok(); } - @Test public void testDynamicSchemaUnnest() { + @Test void testDynamicSchemaUnnest() { final String sql3 = "select t1.c_nationkey, t3.fake_col3\n" + "from SALES.CUSTOMER as t1,\n" + "lateral (select t2.\"$unnest\" as fake_col3\n" @@ -3088,7 +3088,7 @@ public final Sql sql(String sql) { sql(sql3).with(getTesterWithDynamicTable()).ok(); } - @Test public void testStarDynamicSchemaUnnest() { + @Test void testStarDynamicSchemaUnnest() { final String sql3 = "select *\n" + "from SALES.CUSTOMER as t1,\n" + "lateral (select t2.\"$unnest\" as fake_col3\n" @@ -3096,14 +3096,14 @@ public final Sql sql(String sql) { sql(sql3).with(getTesterWithDynamicTable()).ok(); } - @Test public void testStarDynamicSchemaUnnest2() { + @Test void testStarDynamicSchemaUnnest2() { final String sql3 = "select *\n" + "from SALES.CUSTOMER as t1,\n" + "unnest(t1.fake_col) as t2"; sql(sql3).with(getTesterWithDynamicTable()).ok(); } - @Test public void testStarDynamicSchemaUnnestNestedSubQuery() { + @Test void testStarDynamicSchemaUnnestNestedSubQuery() { String sql3 = "select t2.c1\n" + "from (select * from SALES.CUSTOMER) as t1,\n" + "unnest(t1.fake_col) as t2(c1)"; @@ -3114,7 +3114,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testReferDynamicStarInSelectWhereGB() throws Exception { + @Test void testReferDynamicStarInSelectWhereGB() throws Exception { final String sql = "select n_regionkey, count(*) as cnt from " + "(select * from SALES.NATION) where n_nationkey > 5 " + "group by n_regionkey"; @@ -3125,7 +3125,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testDynamicStarInJoinAndSubQ() throws Exception { + @Test void testDynamicStarInJoinAndSubQ() throws Exception { final String sql = "select * from " + " (select * from SALES.NATION T1, " + " SALES.CUSTOMER T2 where T1.n_nationkey = T2.c_nationkey)"; @@ -3136,7 +3136,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testStarJoinStaticDynTable() throws Exception { + @Test void testStarJoinStaticDynTable() throws Exception { final String sql = "select * from SALES.NATION N, SALES.REGION as R " + "where N.n_regionkey = R.r_regionkey"; sql(sql).with(getTesterWithDynamicTable()).ok(); @@ -3146,7 +3146,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testGrpByColFromStarInSubQuery() throws Exception { + @Test void testGrpByColFromStarInSubQuery() throws Exception { final String sql = "SELECT n.n_nationkey AS col " + " from (SELECT * FROM SALES.NATION) as n " + " group by n.n_nationkey"; @@ -3157,7 +3157,7 @@ public final Sql sql(String sql) { * Test case for Dynamic Table / Dynamic Star support * [CALCITE-1150] */ - @Test public void testDynStarInExistSubQ() throws Exception { + @Test void testDynStarInExistSubQ() throws Exception { final String sql = "select *\n" + "from SALES.REGION where exists (select * from SALES.NATION)"; sql(sql).with(getTesterWithDynamicTable()).ok(); @@ -3167,7 +3167,7 @@ public final Sql sql(String sql) { * [CALCITE-1150] * Create the a new DynamicRecordType, avoiding star expansion when working * with this type. */ - @Test public void testSelectDynamicStarOrderBy() throws Exception { + @Test void testSelectDynamicStarOrderBy() throws Exception { final String sql = "SELECT * from SALES.NATION order by n_nationkey"; sql(sql).with(getTesterWithDynamicTable()).ok(); } @@ -3175,7 +3175,7 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-1321] * Configurable IN list size when converting IN clause to join. */ - @Test public void testInToSemiJoin() { + @Test void testInToSemiJoin() { final String sql = "SELECT empno\n" + "FROM emp AS e\n" + "WHERE cast(e.empno as bigint) in (130, 131, 132, 133, 134)"; @@ -3193,14 +3193,14 @@ public final Sql sql(String sql) { * [CALCITE-1944] * Window function applied to sub-query with dynamic star gets wrong * plan. */ - @Test public void testWindowOnDynamicStar() throws Exception { + @Test void testWindowOnDynamicStar() throws Exception { final String sql = "SELECT SUM(n_nationkey) OVER w\n" + "FROM (SELECT * FROM SALES.NATION) subQry\n" + "WINDOW w AS (PARTITION BY REGION ORDER BY n_nationkey)"; sql(sql).with(getTesterWithDynamicTable()).ok(); } - @Test public void testWindowAndGroupByWithDynamicStar() { + @Test void testWindowAndGroupByWithDynamicStar() { final String sql = "SELECT\n" + "n_regionkey,\n" + "MAX(MIN(n_nationkey)) OVER (PARTITION BY n_regionkey)\n" @@ -3217,17 +3217,17 @@ public final Sql sql(String sql) { /** Test case for * [CALCITE-2366] * Add support for ANY_VALUE aggregate function. */ - @Test public void testAnyValueAggregateFunctionNoGroupBy() throws Exception { + @Test void testAnyValueAggregateFunctionNoGroupBy() throws Exception { final String sql = "SELECT any_value(empno) as anyempno FROM emp AS e"; sql(sql).ok(); } - @Test public void testAnyValueAggregateFunctionGroupBy() throws Exception { + @Test void testAnyValueAggregateFunctionGroupBy() throws Exception { final String sql = "SELECT any_value(empno) as anyempno FROM emp AS e group by e.sal"; sql(sql).ok(); } - @Test public void testSomeAndEveryAggregateFunctions() throws Exception { + @Test void testSomeAndEveryAggregateFunctions() throws Exception { final String sql = "SELECT some(empno = 130) as someempnoexists,\n" + " every(empno > 0) as everyempnogtzero\n" + " FROM emp AS e group by e.sal"; @@ -3238,7 +3238,7 @@ private Tester getExtendedTester() { return tester.withCatalogReaderFactory(MockCatalogReaderExtended::new); } - @Test public void testLarge() { + @Test void testLarge() { // Size factor used to be 400, but lambdas use a lot of stack final int x = 300; SqlValidatorTest.checkLarge(x, input -> { @@ -3248,7 +3248,7 @@ private Tester getExtendedTester() { }); } - @Test public void testUnionInFrom() { + @Test void testUnionInFrom() { final String sql = "select x0, x1 from (\n" + " select 'a' as x0, 'a' as x1, 'a' as x2 from emp\n" + " union all\n" @@ -3256,7 +3256,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognize1() { + @Test void testMatchRecognize1() { final String sql = "select *\n" + " from emp match_recognize\n" + " (\n" @@ -3269,7 +3269,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizeMeasures1() { + @Test void testMatchRecognizeMeasures1() { final String sql = "select *\n" + "from emp match_recognize (\n" + " partition by job, sal\n" @@ -3290,7 +3290,7 @@ private Tester getExtendedTester() { * [CALCITE-1909] * Output rowType of Match should include PARTITION BY and ORDER BY * columns. */ - @Test public void testMatchRecognizeMeasures2() { + @Test void testMatchRecognizeMeasures2() { final String sql = "select *\n" + "from emp match_recognize (\n" + " partition by job\n" @@ -3307,7 +3307,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizeMeasures3() { + @Test void testMatchRecognizeMeasures3() { final String sql = "select *\n" + "from emp match_recognize (\n" + " partition by job\n" @@ -3325,7 +3325,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizePatternSkip1() { + @Test void testMatchRecognizePatternSkip1() { final String sql = "select *\n" + " from emp match_recognize\n" + " (\n" @@ -3338,7 +3338,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizeSubset1() { + @Test void testMatchRecognizeSubset1() { final String sql = "select *\n" + " from emp match_recognize\n" + " (\n" @@ -3352,7 +3352,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizePrevLast() { + @Test void testMatchRecognizePrevLast() { final String sql = "SELECT *\n" + "FROM emp\n" + "MATCH_RECOGNIZE (\n" @@ -3369,7 +3369,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizePrevDown() { + @Test void testMatchRecognizePrevDown() { final String sql = "SELECT *\n" + "FROM emp\n" + "MATCH_RECOGNIZE (\n" @@ -3385,7 +3385,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testPrevClassifier() { + @Test void testPrevClassifier() { final String sql = "SELECT *\n" + "FROM emp\n" + "MATCH_RECOGNIZE (\n" @@ -3406,7 +3406,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testMatchRecognizeIn() { + @Test void testMatchRecognizeIn() { final String sql = "select *\n" + " from emp match_recognize\n" + " (\n" @@ -3423,7 +3423,7 @@ private Tester getExtendedTester() { * [CALCITE-2323] * Validator should allow alternative nullCollations for ORDER BY in * OVER. */ - @Test public void testUserDefinedOrderByOver() { + @Test void testUserDefinedOrderByOver() { String sql = "select deptno,\n" + " rank() over(partition by empno order by deptno)\n" + "from emp\n" @@ -3440,7 +3440,7 @@ private Tester getExtendedTester() { sql(sql).with(tester).ok(); } - @Test public void testJsonValueExpressionOperator() { + @Test void testJsonValueExpressionOperator() { final String sql = "select ename format json,\n" + "ename format json encoding utf8,\n" + "ename format json encoding utf16,\n" @@ -3449,97 +3449,97 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testJsonExists() { + @Test void testJsonExists() { final String sql = "select json_exists(ename, 'lax $')\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonValue() { + @Test void testJsonValue() { final String sql = "select json_value(ename, 'lax $')\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonQuery() { + @Test void testJsonQuery() { final String sql = "select json_query(ename, 'lax $')\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonType() { + @Test void testJsonType() { final String sql = "select json_type(ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonPretty() { + @Test void testJsonPretty() { final String sql = "select json_pretty(ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonDepth() { + @Test void testJsonDepth() { final String sql = "select json_depth(ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonLength() { + @Test void testJsonLength() { final String sql = "select json_length(ename, 'strict $')\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonKeys() { + @Test void testJsonKeys() { final String sql = "select json_keys(ename, 'strict $')\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonArray() { + @Test void testJsonArray() { final String sql = "select json_array(ename, ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonArrayAgg1() { + @Test void testJsonArrayAgg1() { final String sql = "select json_arrayagg(ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonArrayAgg2() { + @Test void testJsonArrayAgg2() { final String sql = "select json_arrayagg(ename order by ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonArrayAgg3() { + @Test void testJsonArrayAgg3() { final String sql = "select json_arrayagg(ename order by ename null on null)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonArrayAgg4() { + @Test void testJsonArrayAgg4() { final String sql = "select json_arrayagg(ename null on null) within group (order by ename)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonObject() { + @Test void testJsonObject() { final String sql = "select json_object(ename: deptno, ename: deptno)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonObjectAgg() { + @Test void testJsonObjectAgg() { final String sql = "select json_objectagg(ename: deptno)\n" + "from emp"; sql(sql).ok(); } - @Test public void testJsonPredicate() { + @Test void testJsonPredicate() { final String sql = "select\n" + "ename is json,\n" + "ename is json value,\n" @@ -3555,7 +3555,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testWithinGroup1() { + @Test void testWithinGroup1() { final String sql = "select deptno,\n" + " collect(empno) within group (order by deptno, hiredate desc)\n" + "from emp\n" @@ -3563,7 +3563,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testWithinGroup2() { + @Test void testWithinGroup2() { final String sql = "select dept.deptno,\n" + " collect(sal) within group (order by sal desc) as s,\n" + " collect(sal) within group (order by 1)as s1,\n" @@ -3575,7 +3575,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testWithinGroup3() { + @Test void testWithinGroup3() { final String sql = "select deptno,\n" + " collect(empno) within group (order by empno not in (1, 2)), count(*)\n" + "from emp\n" @@ -3583,21 +3583,21 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testOrderByRemoval1() { + @Test void testOrderByRemoval1() { final String sql = "select * from (\n" + " select empno from emp order by deptno offset 0) t\n" + "order by empno desc"; sql(sql).ok(); } - @Test public void testOrderByRemoval2() { + @Test void testOrderByRemoval2() { final String sql = "select * from (\n" + " select empno from emp order by deptno offset 1) t\n" + "order by empno desc"; sql(sql).ok(); } - @Test public void testOrderByRemoval3() { + @Test void testOrderByRemoval3() { final String sql = "select * from (\n" + " select empno from emp order by deptno limit 10) t\n" + "order by empno"; @@ -3607,7 +3607,7 @@ private Tester getExtendedTester() { /** * Tests left join lateral with using */ - @Test public void testLeftJoinLateral1() { + @Test void testLeftJoinLateral1() { final String sql = "select * from (values 4) as t(c)\n" + " left join lateral\n" + " (select c,a*c from (values 2) as s(a)) as r(d,c)\n" @@ -3618,7 +3618,7 @@ private Tester getExtendedTester() { /** * Tests left join lateral with natural join */ - @Test public void testLeftJoinLateral2() { + @Test void testLeftJoinLateral2() { final String sql = "select * from (values 4) as t(c)\n" + " natural left join lateral\n" + " (select c,a*c from (values 2) as s(a)) as r(d,c)"; @@ -3628,7 +3628,7 @@ private Tester getExtendedTester() { /** * Tests left join lateral with on condition */ - @Test public void testLeftJoinLateral3() { + @Test void testLeftJoinLateral3() { final String sql = "select * from (values 4) as t(c)\n" + " left join lateral\n" + " (select c,a*c from (values 2) as s(a)) as r(d,c)\n" @@ -3639,7 +3639,7 @@ private Tester getExtendedTester() { /** * Tests left join lateral with multiple columns from outer */ - @Test public void testLeftJoinLateral4() { + @Test void testLeftJoinLateral4() { final String sql = "select * from (values (4,5)) as t(c,d)\n" + " left join lateral\n" + " (select c,a*c from (values 2) as s(a)) as r(d,c)\n" @@ -3651,7 +3651,7 @@ private Tester getExtendedTester() { * Tests left join lateral with correlate variable coming * from one level up join scope */ - @Test public void testLeftJoinLateral5() { + @Test void testLeftJoinLateral5() { final String sql = "select * from (values 4) as t (c)\n" + "left join lateral\n" + " (select f1+b1 from (values 2) as foo(f1)\n" @@ -3665,7 +3665,7 @@ private Tester getExtendedTester() { /** * Tests cross join lateral with multiple columns from outer */ - @Test public void testCrossJoinLateral1() { + @Test void testCrossJoinLateral1() { final String sql = "select * from (values (4,5)) as t(c,d)\n" + " cross join lateral\n" + " (select c,a*c as f from (values 2) as s(a)\n" @@ -3677,7 +3677,7 @@ private Tester getExtendedTester() { * Tests cross join lateral with correlate variable coming * from one level up join scope */ - @Test public void testCrossJoinLateral2() { + @Test void testCrossJoinLateral2() { final String sql = "select * from (values 4) as t (c)\n" + "cross join lateral\n" + "(select * from (\n" @@ -3694,7 +3694,7 @@ private Tester getExtendedTester() { * Approximate and exact aggregate calls are recognized as the same * during sql-to-rel conversion.. */ - @Test public void testProjectApproximateAndExactAggregates() { + @Test void testProjectApproximateAndExactAggregates() { final String sql = "SELECT empno, count(distinct ename),\n" + "approx_count_distinct(ename)\n" + "FROM emp\n" @@ -3702,7 +3702,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testProjectAggregatesIgnoreNullsAndNot() { + @Test void testProjectAggregatesIgnoreNullsAndNot() { final String sql = "select lead(sal, 4) IGNORE NULLS, lead(sal, 4) over (w)\n" + "from emp window w as (order by empno)"; sql(sql).ok(); @@ -3713,7 +3713,7 @@ private Tester getExtendedTester() { * AssertionError throws when aggregation same digest in sub-query in same * scope. */ - @Test public void testAggregateWithSameDigestInSubQueries() { + @Test void testAggregateWithSameDigestInSubQueries() { final String sql = "select\n" + " CASE WHEN job IN ('810000', '820000') THEN job\n" + " ELSE 'error'\n" @@ -3725,7 +3725,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testPushDownJoinConditionWithProjectMerge() { + @Test void testPushDownJoinConditionWithProjectMerge() { final String sql = "select * from\n" + " (select empno, deptno from emp) a\n" + " join dept b\n" @@ -3733,7 +3733,7 @@ private Tester getExtendedTester() { sql(sql).ok(); } - @Test public void testCoalesceOnNullableField() { + @Test void testCoalesceOnNullableField() { final String sql = "select coalesce(mgr, 0) from emp"; sql(sql).ok(); } @@ -3743,7 +3743,7 @@ private Tester getExtendedTester() { * [CALCITE-3826] * UPDATE assigns wrong type to bind variables. */ - @Test public void testDynamicParamTypesInUpdate() { + @Test void testDynamicParamTypesInUpdate() { RelNode rel = tester.convertSqlToRel("update emp set sal = ?, ename = ? where empno = ?").rel; LogicalTableModify modify = (LogicalTableModify) rel; List parameters = modify.getSourceExpressionList(); diff --git a/core/src/test/java/org/apache/calcite/test/SqlValidatorFeatureTest.java b/core/src/test/java/org/apache/calcite/test/SqlValidatorFeatureTest.java index 10b518c4c219..199fed9dd640 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlValidatorFeatureTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlValidatorFeatureTest.java @@ -37,7 +37,7 @@ * SqlValidatorFeatureTest verifies that features can be independently enabled * or disabled. */ -public class SqlValidatorFeatureTest extends SqlValidatorTestCase { +class SqlValidatorFeatureTest extends SqlValidatorTestCase { private static final String FEATURE_DISABLED = "feature_disabled"; private Feature disabledFeature; @@ -46,13 +46,13 @@ public class SqlValidatorFeatureTest extends SqlValidatorTestCase { return new SqlValidatorTester(SqlTestFactory.INSTANCE.withValidator(FeatureValidator::new)); } - @Test public void testDistinct() { + @Test void testDistinct() { checkFeature( "select ^distinct^ name from dept", RESOURCE.sQLFeature_E051_01()); } - @Test public void testOrderByDesc() { + @Test void testOrderByDesc() { checkFeature( "select name from dept order by ^name desc^", RESOURCE.sQLConformance_OrderByDesc()); @@ -61,19 +61,19 @@ public class SqlValidatorFeatureTest extends SqlValidatorTestCase { // NOTE jvs 6-Mar-2006: carets don't come out properly placed // for INTERSECT/EXCEPT, so don't bother - @Test public void testIntersect() { + @Test void testIntersect() { checkFeature( "^select name from dept intersect select name from dept^", RESOURCE.sQLFeature_F302()); } - @Test public void testExcept() { + @Test void testExcept() { checkFeature( "^select name from dept except select name from dept^", RESOURCE.sQLFeature_E071_03()); } - @Test public void testMultiset() { + @Test void testMultiset() { checkFeature( "values ^multiset[1]^", RESOURCE.sQLFeature_S271()); @@ -83,7 +83,7 @@ public class SqlValidatorFeatureTest extends SqlValidatorTestCase { RESOURCE.sQLFeature_S271()); } - @Test public void testTablesample() { + @Test void testTablesample() { checkFeature( "select name from ^dept tablesample bernoulli(50)^", RESOURCE.sQLFeature_T613()); diff --git a/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java index 68a48b649b6d..b6f9115009e2 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java @@ -92,7 +92,7 @@ * {@link org.apache.calcite.sql.test.SqlTester}. */ @LocaleEnUs -public class SqlValidatorTest extends SqlValidatorTestCase { +class SqlValidatorTest extends SqlValidatorTestCase { //~ Static fields/initializers --------------------------------------------- /** @@ -160,16 +160,16 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { + "'. At least one input should be convertible to a stream"; } - @Test public void testMultipleSameAsPass() { + @Test void testMultipleSameAsPass() { sql("select 1 as again,2 as \"again\", 3 as AGAiN from (values (true))") .ok(); } - @Test public void testMultipleDifferentAs() { + @Test void testMultipleDifferentAs() { sql("select 1 as c1,2 as c2 from (values(true))").ok(); } - @Test public void testTypeOfAs() { + @Test void testTypeOfAs() { sql("select 1 as c1 from (values (true))") .columnType("INTEGER NOT NULL"); sql("select 'hej' as c1 from (values (true))") @@ -180,7 +180,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("BOOLEAN"); } - @Test public void testTypesLiterals() { + @Test void testTypesLiterals() { expr("'abc'") .columnType("CHAR(3) NOT NULL"); expr("n'abc'") @@ -231,7 +231,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("BOOLEAN"); } - @Test public void testBooleans() { + @Test void testBooleans() { sql("select TRUE OR unknowN from (values(true))").ok(); sql("select false AND unknown from (values(true))").ok(); sql("select not UNKNOWn from (values(true))").ok(); @@ -239,7 +239,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { sql("select not false from (values(true))").ok(); } - @Test public void testAndOrIllegalTypesFails() { + @Test void testAndOrIllegalTypesFails() { // TODO need col+line number wholeExpr("'abc' AND FaLsE") .fails("(?s).*' AND '.*"); @@ -259,7 +259,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { } } - @Test public void testNotIllegalTypeFails() { + @Test void testNotIllegalTypeFails() { sql("select ^NOT 3.141^ from (values(true))") .fails("(?s).*Cannot apply 'NOT' to arguments of type " + "'NOT'.*"); @@ -271,7 +271,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .fails(ANY); } - @Test public void testIs() { + @Test void testIs() { sql("select TRUE IS FALSE FROM (values(true))").ok(); sql("select false IS NULL FROM (values(true))").ok(); sql("select UNKNOWN IS NULL FROM (values(true))").ok(); @@ -289,7 +289,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .fails("(?s).*Cannot apply.*"); } - @Test public void testIsFails() { + @Test void testIsFails() { sql("select ^1 IS TRUE^ FROM (values(true))") .fails("(?s).*' IS TRUE'.*"); @@ -304,7 +304,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .fails(ANY); } - @Test public void testScalars() { + @Test void testScalars() { sql("select 1 + 1 from (values(true))").ok(); sql("select 1 + 2.3 from (values(true))").ok(); sql("select 1.2+3 from (values(true))").ok(); @@ -326,17 +326,17 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { sql("select 1.2/3.4 from (values(true))").ok(); } - @Test public void testScalarsFails() { + @Test void testScalarsFails() { sql("select ^1+TRUE^ from (values(true))") .fails("(?s).*Cannot apply '\\+' to arguments of type " + "' \\+ '\\. Supported form\\(s\\):.*"); } - @Test public void testNumbers() { + @Test void testNumbers() { sql("select 1+-2.*-3.e-1/-4>+5 AND true from (values(true))").ok(); } - @Test public void testPrefix() { + @Test void testPrefix() { expr("+interval '1' second") .columnType("INTERVAL SECOND NOT NULL"); expr("-interval '1' month") @@ -351,7 +351,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { sql("SELECT +'abc' from (values(true))").ok(); } - @Test public void testEqualNotEqual() { + @Test void testEqualNotEqual() { expr("''=''").ok(); expr("'abc'=n''").ok(); expr("''=_latin1''").ok(); @@ -397,7 +397,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { expr("1.1e-1<>1e1").ok(); } - @Test public void testEqualNotEqualFails() { + @Test void testEqualNotEqualFails() { // compare CHAR, INTEGER ok; implicitly convert CHAR expr("''<>1").ok(); expr("'1'>=1").ok(); @@ -424,12 +424,12 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { + "' <> '.*"); } - @Test public void testBinaryString() { + @Test void testBinaryString() { sql("select x'face'=X'' from (values(true))").ok(); sql("select x'ff'=X'' from (values(true))").ok(); } - @Test public void testBinaryStringFails() { + @Test void testBinaryStringFails() { expr("select x'ffee'='abc' from (values(true))") .columnType("BOOLEAN"); sql("select ^x'ffee'='abc'^ from (values(true))") @@ -447,12 +447,12 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { + "' <> '.*"); } - @Test public void testStringLiteral() { + @Test void testStringLiteral() { sql("select n''=_iso-8859-1'abc' from (values(true))").ok(); sql("select N'f'<>'''' from (values(true))").ok(); } - @Test public void testStringLiteralBroken() { + @Test void testStringLiteralBroken() { sql("select 'foo'\n" + "'bar' from (values(true))").ok(); sql("select 'foo'\r'bar' from (values(true))").ok(); @@ -466,7 +466,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .fails("String literal continued on same line"); } - @Test public void testArithmeticOperators() { + @Test void testArithmeticOperators() { expr("power(2,3)").ok(); expr("aBs(-2.3e-2)").ok(); expr("MOD(5 ,\t\f\r\n2)").ok(); @@ -478,7 +478,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { expr("exp(3.67)").ok(); } - @Test public void testArithmeticOperatorsFails() { + @Test void testArithmeticOperatorsFails() { expr("^power(2,'abc')^") .withTypeCoercion(false) .fails("(?s).*Cannot apply 'POWER' to arguments of type " @@ -508,7 +508,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("DOUBLE NOT NULL"); } - @Test public void testCaseExpression() { + @Test void testCaseExpression() { expr("case 1 when 1 then 'one' end").ok(); expr("case 1 when 1 then 'one' else null end").ok(); expr("case 1 when 1 then 'one' else 'more' end").ok(); @@ -523,7 +523,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { + " as tinyint) as integer) END").ok(); } - @Test public void testCaseExpressionTypes() { + @Test void testCaseExpressionTypes() { expr("case 1 when 1 then 'one' else 'not one' end") .columnType("CHAR(7) NOT NULL"); expr("case when 2<1 then 'impossible' end") @@ -564,7 +564,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("INTEGER"); } - @Test public void testCaseExpressionFails() { + @Test void testCaseExpressionFails() { // varchar not comparable with bit string expr("case 'string' when x'01' then 'zero one' else 'something' end") .columnType("CHAR(9) NOT NULL"); @@ -593,7 +593,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .fails("Illegal mixing of types in CASE or COALESCE statement"); } - @Test public void testNullIf() { + @Test void testNullIf() { expr("nullif(1,2)").ok(); expr("nullif(1,2)") .columnType("INTEGER"); @@ -608,7 +608,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { + "expecting 2 arguments"); } - @Test public void testCoalesce() { + @Test void testCoalesce() { expr("coalesce('a','b')").ok(); expr("coalesce('a','b','c')") .columnType("CHAR(1) NOT NULL"); @@ -617,7 +617,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("INTEGER NOT NULL"); } - @Test public void testCoalesceFails() { + @Test void testCoalesceFails() { wholeExpr("coalesce('a',1)") .withTypeCoercion(false) .fails("Illegal mixing of types in CASE or COALESCE statement"); @@ -630,7 +630,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("VARCHAR NOT NULL"); } - @Test public void testStringCompare() { + @Test void testStringCompare() { expr("'a' = 'b'").ok(); expr("'a' <> 'b'").ok(); expr("'a' > 'b'").ok(); @@ -646,7 +646,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { expr("cast('' as varchar(1))<>cast('' as char(1))").ok(); } - @Test public void testStringCompareType() { + @Test void testStringCompareType() { expr("'a' = 'b'") .columnType("BOOLEAN NOT NULL"); expr("'a' <> 'b'") @@ -663,7 +663,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .columnType("BOOLEAN"); } - @Test public void testConcat() { + @Test void testConcat() { expr("'a'||'b'").ok(); expr("x'12'||x'34'").ok(); expr("'a'||'b'") @@ -681,12 +681,12 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { expr("_UTF16'a'||_UTF16'b'||_UTF16'c'").ok(); } - @Test public void testConcatWithCharset() { + @Test void testConcatWithCharset() { sql("_UTF16'a'||_UTF16'b'||_UTF16'c'") .charset(Charset.forName("UTF-16LE")); } - @Test public void testConcatFails() { + @Test void testConcatFails() { wholeExpr("'a'||x'ff'") .fails("(?s).*Cannot apply '\\|\\|' to arguments of type " + "' \\|\\| '.*Supported form.s.: " @@ -695,7 +695,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { /** Tests the CONCAT function, which unlike the concat operator ('||') is not * standard but only in the ORACLE and POSTGRESQL libraries. */ - @Test public void testConcatFunction() { + @Test void testConcatFunction() { // CONCAT is not in the library operator table final Sql s = sql("?") .withOperatorTable(SqlLibraryOperatorTableFactory.INSTANCE @@ -718,7 +718,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { + "'CONCAT\\(, \\)'\\. .*"); } - @Test public void testBetween() { + @Test void testBetween() { expr("1 between 2 and 3").ok(); expr("'a' between 'b' and 'c'").ok(); // can implicitly convert CHAR to INTEGER @@ -727,7 +727,7 @@ private static String cannotStreamResultsForNonStreamingInputs(String inputs) { .fails("(?s).*Cannot apply 'BETWEEN ASYMMETRIC' to arguments of type.*"); } - @Test public void testCharsetMismatch() { + @Test void testCharsetMismatch() { wholeExpr("''=_UTF16''") .fails("Cannot apply .* to the two different charsets ISO-8859-1 and " + "UTF-16LE"); @@ -791,7 +791,7 @@ public void _testDyadicCollateOperator() { .collation("ISO-8859-1$sv$3", SqlCollation.Coercibility.EXPLICIT); } - @Test public void testCharLength() { + @Test void testCharLength() { expr("char_length('string')").ok(); expr("char_length(_UTF16'string')").ok(); expr("character_length('string')").ok(); @@ -801,7 +801,7 @@ public void _testDyadicCollateOperator() { .columnType("INTEGER NOT NULL"); } - @Test public void testUpperLower() { + @Test void testUpperLower() { expr("upper(_UTF16'sadf')").ok(); expr("lower(n'sadf')").ok(); expr("lower('sadf')") @@ -813,7 +813,7 @@ public void _testDyadicCollateOperator() { .columnType("VARCHAR NOT NULL"); } - @Test public void testPosition() { + @Test void testPosition() { expr("position('mouse' in 'house')").ok(); expr("position(x'11' in x'100110')").ok(); expr("position(x'11' in x'100110' FROM 10)").ok(); @@ -826,7 +826,7 @@ public void _testDyadicCollateOperator() { .fails("Parameters must be of the same type"); } - @Test public void testTrim() { + @Test void testTrim() { expr("trim('mustache' FROM 'beard')").ok(); expr("trim(both 'mustache' FROM 'beard')").ok(); expr("trim(leading 'mustache' FROM 'beard')").ok(); @@ -845,7 +845,7 @@ public void _testDyadicCollateOperator() { } } - @Test public void testTrimFails() { + @Test void testTrimFails() { wholeExpr("trim(123 FROM 'beard')") .withTypeCoercion(false) .fails("(?s).*Cannot apply 'TRIM' to arguments of type.*"); @@ -865,7 +865,7 @@ public void _testConvertAndTranslate() { expr("translate('abc' using translation)").ok(); } - @Test public void testTranslate3() { + @Test void testTranslate3() { // TRANSLATE3 is not in the standard operator table wholeExpr("translate('aabbcc', 'ab', '+-')") .fails("No match found for function signature " @@ -896,7 +896,7 @@ public void _testConvertAndTranslate() { + "Was expecting 3 arguments"); } - @Test public void testOverlay() { + @Test void testOverlay() { expr("overlay('ABCdef' placing 'abc' from 1)").ok(); expr("overlay('ABCdef' placing 'abc' from 1 for 3)").ok(); wholeExpr("overlay('ABCdef' placing 'abc' from '1' for 3)") @@ -917,7 +917,7 @@ public void _testConvertAndTranslate() { } } - @Test public void testSubstring() { + @Test void testSubstring() { expr("substring('a' FROM 1)").ok(); expr("substring('a' FROM 1 FOR 3)").ok(); expr("substring('a' FROM 'reg' FOR '\\')").ok(); @@ -950,7 +950,7 @@ public void _testConvertAndTranslate() { .columnType("VARCHAR(1) NOT NULL"); } - @Test public void testSubstringFails() { + @Test void testSubstringFails() { wholeExpr("substring('a' from 1 for 'b')") .withTypeCoercion(false) .fails("(?s).*Cannot apply 'SUBSTRING' to arguments of type.*"); @@ -964,7 +964,7 @@ public void _testConvertAndTranslate() { .fails("(?s).* not comparable to each other.*"); } - @Test public void testLikeAndSimilar() { + @Test void testLikeAndSimilar() { expr("'a' like 'b'").ok(); expr("'a' like 'b'").ok(); expr("'a' similar to 'b'").ok(); @@ -984,7 +984,7 @@ public void _testLikeAndSimilarFails() { + " _ISO-8859-1.b. COLLATE SHIFT_JIS.jp.primary.*"); } - @Test public void testNull() { + @Test void testNull() { expr("nullif(null, 1)").ok(); expr("values 1.0 + ^NULL^").ok(); expr("1.0 + ^NULL^").ok(); @@ -1035,7 +1035,7 @@ public void _testLikeAndSimilarFails() { expr("1 in (null, null)").ok(); } - @Test public void testNullCast() { + @Test void testNullCast() { expr("cast(null as tinyint)") .columnType("TINYINT"); expr("cast(null as smallint)") @@ -1072,7 +1072,7 @@ public void _testLikeAndSimilarFails() { expr("cast(null as integer), cast(null as char(1))").ok(); } - @Test public void testCastTypeToType() { + @Test void testCastTypeToType() { expr("cast(123 as char)") .columnType("CHAR(1) NOT NULL"); expr("cast(123 as varchar)") @@ -1177,7 +1177,7 @@ public void _testLikeAndSimilarFails() { .columnType("TIMESTAMP_WITH_LOCAL_TIME_ZONE(3) NOT NULL"); } - @Test public void testCastRegisteredType() { + @Test void testCastRegisteredType() { expr("cast(123 as customBigInt)") .fails("class org.apache.calcite.sql.SqlIdentifier: CUSTOMBIGINT"); expr("cast(123 as sales.customBigInt)") @@ -1186,7 +1186,7 @@ public void _testLikeAndSimilarFails() { .columnType("BIGINT NOT NULL"); } - @Test public void testCastFails() { + @Test void testCastFails() { expr("cast('foo' as ^bar^)") .fails("class org.apache.calcite.sql.SqlIdentifier: BAR"); wholeExpr("cast(multiset[1] as integer)") @@ -1203,7 +1203,7 @@ public void _testLikeAndSimilarFails() { + "TIME\\(0\\) to type DATE.*"); } - @Test public void testCastBinaryLiteral() { + @Test void testCastBinaryLiteral() { expr("cast(^x'0dd'^ as binary(5))") .fails("Binary literal string must contain an even number of hexits"); } @@ -1213,7 +1213,7 @@ public void _testLikeAndSimilarFails() { * * @see SqlConformance#allowGeometry() */ - @Test public void testGeometry() { + @Test void testGeometry() { final String err = "Geo-spatial extensions and the GEOMETRY data type are not enabled"; sql("select cast(null as geometry) as g from emp") @@ -1221,7 +1221,7 @@ public void _testLikeAndSimilarFails() { .withConformance(SqlConformanceEnum.LENIENT).sansCarets().ok(); } - @Test public void testDateTime() { + @Test void testDateTime() { // LOCAL_TIME expr("LOCALTIME(3)").ok(); expr("LOCALTIME").ok(); // fix sqlcontext later. @@ -1363,7 +1363,7 @@ public void _testLikeAndSimilarFails() { /** * Tests casting to/from date/time types. */ - @Test public void testDateTimeCast() { + @Test void testDateTimeCast() { wholeExpr("CAST(1 as DATE)") .fails("Cast function cannot convert value of type INTEGER to type DATE"); expr("CAST(DATE '2001-12-21' AS VARCHAR(10))").ok(); @@ -1374,7 +1374,7 @@ public void _testLikeAndSimilarFails() { expr("CAST( '2004-12-21 10:12:21' AS TIMESTAMP)").ok(); } - @Test public void testConvertTimezoneFunction() { + @Test void testConvertTimezoneFunction() { wholeExpr("CONVERT_TIMEZONE('UTC', 'America/Los_Angeles'," + " CAST('2000-01-01' AS TIMESTAMP))") .fails("No match found for function signature " @@ -1405,7 +1405,7 @@ public void _testLikeAndSimilarFails() { + "Was expecting 3 arguments"); } - @Test public void testToDateFunction() { + @Test void testToDateFunction() { wholeExpr("TO_DATE('2000-01-01', 'YYYY-MM-DD')") .fails("No match found for function signature " + "TO_DATE\\(, \\)"); @@ -1436,7 +1436,7 @@ public void _testLikeAndSimilarFails() { + "Was expecting 2 arguments"); } - @Test public void testToTimestampFunction() { + @Test void testToTimestampFunction() { wholeExpr("TO_TIMESTAMP('2000-01-01 01:00:00', 'YYYY-MM-DD HH:MM:SS')") .fails("No match found for function signature " + "TO_TIMESTAMP\\(, \\)"); @@ -1467,7 +1467,7 @@ public void _testLikeAndSimilarFails() { + "Was expecting 2 arguments"); } - @Test public void testInvalidFunction() { + @Test void testInvalidFunction() { wholeExpr("foo()") .fails("No match found for function signature FOO.."); wholeExpr("mod(123)") @@ -1480,7 +1480,7 @@ public void _testLikeAndSimilarFails() { .fails("No match found for function signature FOO.."); } - @Test public void testUnknownFunctionHandling() { + @Test void testUnknownFunctionHandling() { final Sql s = sql("?").withTester(t -> t.withLenientOperatorLookup(true)); s.expr("concat('a', 2)").ok(); s.expr("foo('2001-12-21')").ok(); @@ -1499,7 +1499,7 @@ public void _testLikeAndSimilarFails() { s.sql("select sum(1, 2) from emp").ok(); // too many args } - @Test public void testJdbcFunctionCall() { + @Test void testJdbcFunctionCall() { expr("{fn log10(1)}").ok(); expr("{fn locate('','')}").ok(); expr("{fn insert('',1,2,'')}").ok(); @@ -1534,7 +1534,7 @@ public void _testLikeAndSimilarFails() { .fails("(?s).*Function '.fn HAHAHA.' is not defined.*"); } - @Test public void testQuotedFunction() { + @Test void testQuotedFunction() { if (false) { // REVIEW jvs 2-Feb-2005: I am disabling this test because I // removed the corresponding support from the parser. Where in the @@ -1565,14 +1565,14 @@ public void _testLikeAndSimilarFails() { /** * Not able to parse member function yet. */ - @Test public void testInvalidMemberFunction() { + @Test void testInvalidMemberFunction() { expr("myCol.^func()^") .fails("(?s).*No match found for function signature FUNC().*"); expr("customer.mySubschema.^memberFunc()^") .fails("(?s).*No match found for function signature MEMBERFUNC().*"); } - @Test public void testRowtype() { + @Test void testRowtype() { sql("values (1),(2),(1)").ok(); sql("values (1),(2),(1)") .type("RecordType(INTEGER NOT NULL EXPR$0) NOT NULL"); @@ -1589,14 +1589,14 @@ public void _testLikeAndSimilarFails() { } } - @Test public void testRow() { + @Test void testRow() { // double-nested rows can confuse validator namespace resolution sql("select t.r.\"EXPR$1\".\"EXPR$2\"\n" + "from (select ((1,2),(3,4,5)) r from dept) t") .columnType("INTEGER NOT NULL"); } - @Test public void testRowWithValidDot() { + @Test void testRowWithValidDot() { sql("select ((1,2),(3,4,5)).\"EXPR$1\".\"EXPR$2\"\n from dept") .columnType("INTEGER NOT NULL"); sql("select row(1,2).\"EXPR$1\" from dept") @@ -1605,7 +1605,7 @@ public void _testLikeAndSimilarFails() { .columnType("INTEGER NOT NULL"); } - @Test public void testRowWithInvalidDotOperation() { + @Test void testRowWithInvalidDotOperation() { final String sql = "select t.^s.\"EXPR$1\"^ from (\n" + " select 1 AS s from (values (1))) as t"; expr(sql) @@ -1616,7 +1616,7 @@ public void _testLikeAndSimilarFails() { .fails("(?s).*Incompatible types.*"); } - @Test public void testMultiset() { + @Test void testMultiset() { expr("multiset[1]") .columnType("INTEGER NOT NULL MULTISET NOT NULL"); expr("multiset[1, CAST(null AS DOUBLE)]") @@ -1650,7 +1650,7 @@ public void _testLikeAndSimilarFails() { + " BOOLEAN NOT NULL SLACKER) NOT NULL MULTISET NOT NULL"); } - @Test public void testMultisetSetOperators() { + @Test void testMultisetSetOperators() { expr("multiset[1] multiset union multiset[1,2.3]").ok(); expr("multiset[324.2] multiset union multiset[23.2,2.32]") .columnType("DECIMAL(5, 2) NOT NULL MULTISET NOT NULL"); @@ -1671,7 +1671,7 @@ public void _testLikeAndSimilarFails() { } } - @Test public void testSubMultisetOf() { + @Test void testSubMultisetOf() { expr("multiset[1] submultiset of multiset[1,2.3]") .columnType("BOOLEAN NOT NULL"); expr("multiset[1] submultiset of multiset[1]") @@ -1682,7 +1682,7 @@ public void _testLikeAndSimilarFails() { expr("multiset[ROW(1,2)] submultiset of multiset[row(3,4)]").ok(); } - @Test public void testElement() { + @Test void testElement() { expr("element(multiset[1])") .columnType("INTEGER NOT NULL"); expr("1.0+element(multiset[1])") @@ -1695,21 +1695,21 @@ public void _testLikeAndSimilarFails() { .columnType("TINYINT MULTISET NOT NULL"); } - @Test public void testMemberOf() { + @Test void testMemberOf() { expr("1 member of multiset[1]") .columnType("BOOLEAN NOT NULL"); wholeExpr("1 member of multiset['1']") .fails("Cannot compare values of types 'INTEGER', 'CHAR\\(1\\)'"); } - @Test public void testIsASet() { + @Test void testIsASet() { expr("multiset[1] is a set").ok(); expr("multiset['1'] is a set").ok(); wholeExpr("'a' is a set") .fails(".*Cannot apply 'IS A SET' to.*"); } - @Test public void testCardinality() { + @Test void testCardinality() { expr("cardinality(multiset[1])") .columnType("INTEGER NOT NULL"); expr("cardinality(multiset['1'])") @@ -1722,7 +1722,7 @@ public void _testLikeAndSimilarFails() { + "'CARDINALITY\\(\\)'"); } - @Test public void testMatchRecognizeWithDistinctAggregation() { + @Test void testMatchRecognizeWithDistinctAggregation() { final String sql = "SELECT *\n" + "FROM emp\n" + "MATCH_RECOGNIZE (\n" @@ -1737,7 +1737,7 @@ public void _testLikeAndSimilarFails() { + "COUNT\\(DISTINCT `A`\\.`DEPTNO`\\) function"); } - @Test public void testIntervalTimeUnitEnumeration() { + @Test void testIntervalTimeUnitEnumeration() { // Since there is validation code relaying on the fact that the // enumerated time unit ordinals in SqlIntervalQualifier starts with 0 // and ends with 5, this test is here to make sure that if someone @@ -1775,14 +1775,14 @@ public void _testLikeAndSimilarFails() { assertTrue(b); } - @Test public void testIntervalMonthsConversion() { + @Test void testIntervalMonthsConversion() { expr("INTERVAL '1' YEAR").intervalConv("12"); expr("INTERVAL '5' MONTH").intervalConv("5"); expr("INTERVAL '3-2' YEAR TO MONTH").intervalConv("38"); expr("INTERVAL '-5-4' YEAR TO MONTH").intervalConv("-64"); } - @Test public void testIntervalMillisConversion() { + @Test void testIntervalMillisConversion() { expr("INTERVAL '1' DAY").intervalConv("86400000"); expr("INTERVAL '1' HOUR").intervalConv("3600000"); expr("INTERVAL '1' MINUTE").intervalConv("60000"); @@ -3493,7 +3493,7 @@ public void subTestIntervalSecondNegative() { + " INTERVAL SECOND\\(1, 0\\)"); } - @Test public void testDatetimePlusNullInterval() { + @Test void testDatetimePlusNullInterval() { expr("TIME '8:8:8' + cast(NULL AS interval hour)").columnType("TIME(0)"); expr("TIME '8:8:8' + cast(NULL AS interval YEAR)").columnType("TIME(0)"); expr("TIMESTAMP '1990-12-12 12:12:12' + cast(NULL AS interval hour)") @@ -3509,7 +3509,7 @@ public void subTestIntervalSecondNegative() { .columnType("TIMESTAMP(0)"); } - @Test public void testIntervalLiterals() { + @Test void testIntervalLiterals() { // First check that min, max, and defaults are what we expect // (values used in subtests depend on these being true to // accurately test bounds) @@ -3567,7 +3567,7 @@ public void subTestIntervalSecondNegative() { .columnType("INTERVAL MONTH(3) NOT NULL"); } - @Test public void testIntervalOperators() { + @Test void testIntervalOperators() { expr("interval '1' hour + TIME '8:8:8'") .columnType("TIME(0) NOT NULL"); expr("TIME '8:8:8' - interval '1' hour") @@ -3639,7 +3639,7 @@ public void subTestIntervalSecondNegative() { + "' / '.*"); } - @Test public void testTimestampAddAndDiff() { + @Test void testTimestampAddAndDiff() { List tsi = ImmutableList.builder() .add("FRAC_SECOND") .add("MICROSECOND") @@ -3687,7 +3687,7 @@ public void subTestIntervalSecondNegative() { .fails("(?s).*Was expecting one of.*"); } - @Test public void testTimestampAddNullInterval() { + @Test void testTimestampAddNullInterval() { expr("timestampadd(SQL_TSI_SECOND, cast(NULL AS INTEGER)," + " current_timestamp)") .columnType("TIMESTAMP(0)"); @@ -3696,7 +3696,7 @@ public void subTestIntervalSecondNegative() { .columnType("TIMESTAMP(0)"); } - @Test public void testNumericOperators() { + @Test void testNumericOperators() { // unary operator expr("- cast(1 as TINYINT)") .columnType("TINYINT NOT NULL"); @@ -3876,7 +3876,7 @@ public void subTestIntervalSecondNegative() { .columnType("FLOAT"); } - @Test public void testFloorCeil() { + @Test void testFloorCeil() { expr("floor(cast(null as tinyint))") .columnType("TINYINT"); expr("floor(1.2)") @@ -3918,7 +3918,7 @@ public void _testWinPartClause() { * Validate that window functions have OVER clause, and * [CALCITE-1340] * Window aggregates give invalid errors. */ - @Test public void testWindowFunctionsWithoutOver() { + @Test void testWindowFunctionsWithoutOver() { winSql("select sum(empno)\n" + "from emp\n" + "group by deptno\n" @@ -3942,7 +3942,7 @@ public void _testWinPartClause() { .fails("OVER clause is necessary for window functions"); } - @Test public void testOverInPartitionBy() { + @Test void testOverInPartitionBy() { winSql("select sum(deptno) over ^(partition by sum(deptno)\n" + "over(order by deptno))^ from emp") .fails("PARTITION BY expression should not contain OVER clause"); @@ -3953,7 +3953,7 @@ public void _testWinPartClause() { .fails("PARTITION BY expression should not contain OVER clause"); } - @Test public void testOverInOrderBy() { + @Test void testOverInOrderBy() { winSql("select sum(deptno) over ^(order by sum(deptno)\n" + "over(order by deptno))^ from emp") .fails("ORDER BY expression should not contain OVER clause"); @@ -3964,7 +3964,7 @@ public void _testWinPartClause() { .fails("ORDER BY expression should not contain OVER clause"); } - @Test public void testAggregateFunctionInOver() { + @Test void testAggregateFunctionInOver() { final String sql = "select sum(deptno) over (order by count(empno))\n" + "from emp\n" + "group by deptno"; @@ -3975,7 +3975,7 @@ public void _testWinPartClause() { winSql(sql2).fails("Expression 'EMPNO' is not being grouped"); } - @Test public void testAggregateInsideOverClause() { + @Test void testAggregateInsideOverClause() { final String sql = "select ^empno^,\n" + " sum(empno) over (partition by min(sal)) empno_sum\n" + "from emp"; @@ -3988,7 +3988,7 @@ public void _testWinPartClause() { sql(sql2).ok(); } - @Test public void testAggregateInsideOverClause2() { + @Test void testAggregateInsideOverClause2() { final String sql = "select ^empno^,\n" + " sum(empno) over ()\n" + " + sum(empno) over (partition by min(sal)) empno_sum\n" @@ -3996,7 +3996,7 @@ public void _testWinPartClause() { sql(sql).fails("Expression 'EMPNO' is not being grouped"); } - @Test public void testWindowFunctions() { + @Test void testWindowFunctions() { // SQL 03 Section 6.10 // Window functions may only appear in the