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.AssertThat
Creates aCalciteConnection
and executes a callback that returns no result.Creates aCalciteConnection
and executes a callback.doWithDataContext
(Function<DataContext, T> fn) Creates aDataContext
and 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.AssertThat
Sets the Lex 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.AssertThat
withMaterializations
(String model, boolean existing, String... materializations) Adds materializations to the schema.final CalciteAssert.AssertThat
withMaterializations
(String model, String... materializations) final CalciteAssert.AssertThat
withMaterializations
(String model, Function<JsonBuilder, List<Object>> materializations) Adds materializations to the schema.final CalciteAssert.AssertThat
final CalciteAssert.AssertThat
withRel
(Function<RelBuilder, RelNode> relFn) Adds a factory to create aRelNode
query.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. -
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 aRelNode
query. ThisRelNode
will 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 aCalciteConnection
and executes a callback.- Throws:
Exception
-
doWithConnection
public final CalciteAssert.AssertThat doWithConnection(Consumer<CalciteConnection> fn) throws Exception Creates aCalciteConnection
and executes a callback that returns no result.- Throws:
Exception
-
doWithDataContext
Creates aDataContext
and 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
-