Package org.apache.calcite.test
Class CalciteAssert.AssertThat
java.lang.Object
org.apache.calcite.test.CalciteAssert.AssertThat
- Enclosing class:
CalciteAssert
Result of calling
CalciteAssert.that().-
Method Summary
Modifier and TypeMethodDescriptionconnect()Use sparingly.connectThrows(String message) Asserts that there is an exception with the given message while creating a connection.connectThrows(Consumer<Throwable> exceptionChecker) Asserts that there is an exception that matches the given predicate while creating a connection.final CalciteAssert.AssertThatCreates aCalciteConnectionand executes a callback that returns no result.Creates aCalciteConnectionand executes a callback.doWithDataContext(Function<DataContext, T> fn) Creates aDataContextand executes a callback.enable(boolean enabled) metaData(Function<Connection, ResultSet> function) pooled()Returns a version that uses a single connection, as opposed to creating a new one each time a test method is invoked.final CalciteAssert.AssertThatSets the Lex property.with(SqlConformanceEnum conformance) Sets the conformance property.with(CalciteAssert.Config config) with(CalciteAssert.ConnectionPostProcessor postProcessor) with(CalciteAssert.SchemaSpec... specs) Creates a copy of this AssertThat, adding more schemas.with(ConnectionFactory connectionFactory) Creates a copy of this AssertThat, overriding the connection factory.withDefaultSchema(String schema) Sets the default schema of the connection.Adds a hook and a handler for that hook.final CalciteAssert.AssertThatwithMaterializations(String model, boolean existing, String... materializations) Adds materializations to the schema.final CalciteAssert.AssertThatwithMaterializations(String model, String... materializations) final CalciteAssert.AssertThatwithMaterializations(String model, Function<JsonBuilder, List<Object>> materializations) Adds materializations to the schema.final CalciteAssert.AssertThatfinal CalciteAssert.AssertThatwithRel(Function<RelBuilder, RelNode> relFn) Adds a factory to create aRelNodequery.withSchema(String name, Schema schema) Sets the default schema to a given schema.
-
Method Details
-
with
-
with
Creates a copy of this AssertThat, adding more schemas. -
with
Creates a copy of this AssertThat, overriding the connection factory. -
withHook
Adds a hook and a handler for that hook. Calcite will create a thread hook (by callingHook.addThread(Consumer)) just before running the query, and remove the hook afterwards. -
with
-
with
-
with
public CalciteAssert.AssertThat with(org.apache.calcite.avatica.ConnectionProperty property, Object value) -
with
Sets the Lex property. -
with
Sets the conformance property. -
withSchema
Sets the default schema to a given schema. -
withDefaultSchema
Sets the default schema of the connection. Schema name may be null. -
with
-
withModel
-
withModel
-
withMaterializations
public final CalciteAssert.AssertThat withMaterializations(String model, String... materializations) -
withMaterializations
public final CalciteAssert.AssertThat withMaterializations(String model, boolean existing, String... materializations) Adds materializations to the schema. -
withMaterializations
public final CalciteAssert.AssertThat withMaterializations(String model, Function<JsonBuilder, List<Object>> materializations) Adds materializations to the schema. -
query
-
withRel
Adds a factory to create aRelNodequery. ThisRelNodewill be used instead of the SQL string.Note: if you want to assert the optimized plan, consider using
explainHook...methods such asCalciteAssert.AssertQuery.explainHookMatches(String)- Parameters:
relFn- a custom factory that creates a RelNode instead of regular sql to rel- Returns:
- updated AssertQuery
- See Also:
-
connectThrows
Asserts that there is an exception with the given message while creating a connection. -
connectThrows
Asserts that there is an exception that matches the given predicate while creating a connection. -
doWithConnection
public <T> CalciteAssert.AssertThat doWithConnection(Function<CalciteConnection, T> fn) throws ExceptionCreates aCalciteConnectionand executes a callback.- Throws:
Exception
-
doWithConnection
public final CalciteAssert.AssertThat doWithConnection(Consumer<CalciteConnection> fn) throws Exception Creates aCalciteConnectionand executes a callback that returns no result.- Throws:
Exception
-
doWithDataContext
Creates aDataContextand executes a callback.- Throws:
Exception
-
connect
Use sparingly. Does not close the connection.- Throws:
SQLException
-
enable
-
pooled
Returns a version that uses a single connection, as opposed to creating a new one each time a test method is invoked. -
metaData
-