Package org.apache.calcite.sql.test
Class SqlRuntimeTester
- java.lang.Object
-
- org.apache.calcite.sql.test.AbstractSqlTester
-
- org.apache.calcite.sql.test.SqlRuntimeTester
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,SqlTester
,SqlValidatorTestCase.Tester
- Direct Known Subclasses:
SqlOperatorBaseTest.TesterImpl
public class SqlRuntimeTester extends AbstractSqlTester
Tester ofSqlValidator
and runtime execution of the input SQL.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.sql.test.SqlTester
SqlTester.ParameterChecker, SqlTester.ResultChecker, SqlTester.TypeChecker, SqlTester.VmName
-
-
Field Summary
-
Fields inherited from class org.apache.calcite.sql.test.AbstractSqlTester
factory
-
-
Constructor Summary
Constructors Constructor Description SqlRuntimeTester(SqlTestFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertExceptionIsThrown(java.lang.String sql, java.lang.String expectedMsgPattern)
Checks that a query is valid, or, if invalid, throws the right message at the right location.void
assertExceptionIsThrown(java.lang.String sql, java.lang.String expectedMsgPattern, boolean runtime)
void
checkFails(java.lang.String expression, java.lang.String expectedError, boolean runtime)
Tests that a scalar SQL expression fails at run time.protected SqlTester
with(SqlTestFactory factory)
-
Methods inherited from class org.apache.calcite.sql.test.AbstractSqlTester
buildQuery, buildQuery2, buildQueryAgg, check, check, checkAgg, checkAggWithMultipleArgs, checkBoolean, checkCharset, checkCollation, checkColumnType, checkFieldOrigin, checkIntervalConv, checkMonotonic, checkNull, checkParseEx, checkQuery, checkQueryFails, checkResultType, checkRewrite, checkScalar, checkScalarApprox, checkScalarExact, checkScalarExact, checkString, checkType, checkWinAgg, close, getColumnType, getConformance, getFactory, getMonotonicity, getResultType, getValidator, parseAndValidate, parseQuery, setFor, with, withCaseSensitive, withConformance, withConnectionFactory, withLex, withOperatorTable, withQuotedCasing, withQuoting, withUnquotedCasing
-
-
-
-
Constructor Detail
-
SqlRuntimeTester
public SqlRuntimeTester(SqlTestFactory factory)
-
-
Method Detail
-
with
protected SqlTester with(SqlTestFactory factory)
- Specified by:
with
in classAbstractSqlTester
-
checkFails
public void checkFails(java.lang.String expression, java.lang.String expectedError, boolean runtime)
Description copied from interface:SqlTester
Tests that a scalar SQL expression fails at run time.- Specified by:
checkFails
in interfaceSqlTester
- Overrides:
checkFails
in classAbstractSqlTester
- Parameters:
expression
- SQL scalar expressionexpectedError
- 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
-
assertExceptionIsThrown
public void assertExceptionIsThrown(java.lang.String sql, java.lang.String expectedMsgPattern)
Description copied from interface:SqlValidatorTestCase.Tester
Checks that a query is valid, or, if invalid, throws the right message at the right location.If
expectedMsgPattern
is null, the query must succeed.If
expectedMsgPattern
is not null, the query must fail, and give an error location of (expectedLine, expectedColumn) through (expectedEndLine, expectedEndColumn).- Specified by:
assertExceptionIsThrown
in interfaceSqlValidatorTestCase.Tester
- Overrides:
assertExceptionIsThrown
in classAbstractSqlTester
- Parameters:
sql
- SQL statementexpectedMsgPattern
- If this parameter is null the query must be valid for the test to pass; If this parameter is not null the query must be malformed and the message given must match the pattern
-
assertExceptionIsThrown
public void assertExceptionIsThrown(java.lang.String sql, java.lang.String expectedMsgPattern, boolean runtime)
-
-