Package org.apache.calcite.test
Class SqlOperatorTest.TesterImpl
java.lang.Object
org.apache.calcite.sql.test.AbstractSqlTester
org.apache.calcite.test.SqlOperatorTest.TesterImpl
- All Implemented Interfaces:
- AutoCloseable,- SqlTester
- Enclosing class:
- SqlOperatorTest
Implementation of 
SqlTester based on a
 JDBC connection.- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.calcite.sql.test.SqlTesterSqlTester.ParameterChecker, SqlTester.ResultChecker, SqlTester.TypeChecker, SqlTester.ValidatedNodeConsumer, SqlTester.ValidatedNodeFunction<R>, SqlTester.VmName
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final TryThreadLocal<RelDataTypeSystem>Assign a type system object to this thread-local, pass the name of the field as theCalciteConnectionProperty.TYPE_SYSTEMproperty, and any connection you make in the same thread will use your type system.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidassertExceptionIsThrown(SqlTestFactory factory, StringAndPos sap, @Nullable String expectedMsgPattern) Checks that a query is valid, or, if invalid, throws the right message at the right location.voidassertExceptionIsThrown(SqlTestFactory factory, StringAndPos sap, @Nullable String expectedMsgPattern, boolean runtime) voidcheck(SqlTestFactory factory, String query, SqlTester.TypeChecker typeChecker, SqlTester.ParameterChecker parameterChecker, SqlTester.ResultChecker resultChecker) Tests that a SQL query returns a result of expected type and value.voidcheckAggFails(SqlTestFactory factory, String expr, String[] inputValues, String expectedError, boolean runtime) Tests that an aggregate expression fails at run time.voidcheckFails(SqlTestFactory factory, StringAndPos sap, String expectedError, boolean runtime) Tests that a scalar SQL expression fails at run time.Methods inherited from class org.apache.calcite.sql.test.AbstractSqlTesterassertConvertsTo, buildQuery, buildQuery2, buildQueryAgg, checkAgg, checkColumnType, checkParseEx, checkQueryFails, checkWinAgg, close, convertSqlToRel2, createFieldTrimmer, forEachQuery, getColumnType, getResultType, parseExpression, parseQuery, setFor, trimRelNode, validateAndApply, validateAndThenMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.sql.test.SqlTestercheck, checkFails, convertSqlToRel
- 
Field Details- 
THREAD_TYPE_SYSTEMAssign a type system object to this thread-local, pass the name of the field as theCalciteConnectionProperty.TYPE_SYSTEMproperty, and any connection you make in the same thread will use your type system.
 
- 
- 
Constructor Details- 
TesterImplpublic TesterImpl()
 
- 
- 
Method Details- 
checkpublic void check(SqlTestFactory factory, String query, SqlTester.TypeChecker typeChecker, SqlTester.ParameterChecker parameterChecker, SqlTester.ResultChecker resultChecker) Description copied from interface:SqlTesterTests that a SQL query returns a result of expected type and value. Checking of type and value are abstracted usingSqlTester.TypeCheckerandSqlTester.ResultCheckerfunctors.- Specified by:
- checkin interface- SqlTester
- Overrides:
- checkin class- AbstractSqlTester
- Parameters:
- factory- Factory
- query- SQL query
- typeChecker- Checks whether the result is the expected type
- parameterChecker- Checks whether the parameters are of expected types
- resultChecker- Checks whether the result has the expected value
 
- 
checkFailspublic void checkFails(SqlTestFactory factory, StringAndPos sap, String expectedError, boolean runtime) Description copied from interface:SqlTesterTests that a scalar SQL expression fails at run time.- Specified by:
- checkFailsin interface- SqlTester
- Overrides:
- checkFailsin class- AbstractSqlTester
- Parameters:
- factory- Factory
- sap- SQL scalar expression
- expectedError- Pattern for expected error. If !runtime, must include an error location.
- runtime- If true, must fail at runtime; if false, must fail at validate time
 
- 
checkAggFailspublic void checkAggFails(SqlTestFactory factory, String expr, String[] inputValues, String expectedError, boolean runtime) Description copied from interface:SqlTesterTests that an aggregate expression fails at run time.- Specified by:
- checkAggFailsin interface- SqlTester
- Overrides:
- checkAggFailsin class- AbstractSqlTester
- Parameters:
- factory- Factory
- expr- An aggregate expression
- inputValues- Array of input values
- expectedError- Pattern for expected error
- runtime- If true, must fail at runtime; if false, must fail at validate time
 
- 
assertExceptionIsThrownpublic void assertExceptionIsThrown(SqlTestFactory factory, StringAndPos sap, @Nullable String expectedMsgPattern) Description copied from interface:SqlTesterChecks that a query is valid, or, if invalid, throws the right message at the right location.If expectedMsgPatternis null, the query must succeed.If expectedMsgPatternis not null, the query must fail, and give an error location of (expectedLine, expectedColumn) through (expectedEndLine, expectedEndColumn).- Specified by:
- assertExceptionIsThrownin interface- SqlTester
- Overrides:
- assertExceptionIsThrownin class- AbstractSqlTester
- Parameters:
- factory- Factory
- sap- SQL statement
- expectedMsgPattern- If this parameter is null the query must be
 
- 
assertExceptionIsThrownpublic void assertExceptionIsThrown(SqlTestFactory factory, StringAndPos sap, @Nullable String expectedMsgPattern, boolean runtime) 
 
-