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 {
*