Package org.apache.calcite.sql.test
Class SqlTests
java.lang.Object
org.apache.calcite.sql.test.SqlTests
Utility methods.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Stage of query processing.static class
Type checker which compares types to a specified string. -
Field Summary
Modifier and TypeFieldDescriptionstatic final SqlTester.ParameterChecker
Checker that allows any number or type of parameters.static final SqlTester.ResultChecker
Checker that allows any result.static final SqlTester.TypeChecker
Checker which allows any type.static final SqlTester.TypeChecker
static final SqlTester.TypeChecker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkEx
(@Nullable Throwable ex, @Nullable String expectedMsgPattern, StringAndPos sap, SqlTests.Stage stage) Checks whether an exception matches the expected pattern.static String
generateAggQuery
(String expr, String[] inputValues) static String
generateAggQueryWithMultipleArgs
(String expr, String[][] inputValues) static String
generateWinAggQuery
(String expr, String windowSpec, String[] inputValues) static List<RelDataType>
getTypes
(RelDataTypeFactory typeFactory) Returns a list of typical types.static String
getTypeString
(RelDataType sqlType) Helper function to get the string representation of a RelDataType (include precision/scale but no charset or collation).
-
Field Details
-
INTEGER_TYPE_CHECKER
-
BOOLEAN_TYPE_CHECKER
-
ANY_TYPE_CHECKER
Checker which allows any type. -
ANY_PARAMETER_CHECKER
Checker that allows any number or type of parameters. -
ANY_RESULT_CHECKER
Checker that allows any result.
-
-
Constructor Details
-
SqlTests
public SqlTests()
-
-
Method Details
-
getTypeString
Helper function to get the string representation of a RelDataType (include precision/scale but no charset or collation).- Parameters:
sqlType
- Type- Returns:
- String representation of type
-
getTypes
Returns a list of typical types. -
generateAggQuery
-
generateAggQueryWithMultipleArgs
-
generateWinAggQuery
-
checkEx
public static void checkEx(@Nullable Throwable ex, @Nullable String expectedMsgPattern, StringAndPos sap, SqlTests.Stage stage) Checks whether an exception matches the expected pattern. Ifsap
contains an error location, checks this too.- Parameters:
ex
- Exception thrownexpectedMsgPattern
- Expected patternsap
- Query and (optional) position in querystage
- Query processing stage
-