public static class CalciteAssert.AssertThat extends Object
CalciteAssert.that().| 限定符和类型 | 方法和说明 |
|---|---|
Connection |
connect()
Use sparingly.
|
CalciteAssert.AssertThat |
connectThrows(Consumer<Throwable> exceptionChecker)
Asserts that there is an exception that matches the given predicate
while creating a connection.
|
CalciteAssert.AssertThat |
connectThrows(String message)
Asserts that there is an exception with the given message while
creating a connection.
|
CalciteAssert.AssertThat |
doWithConnection(Consumer<org.apache.calcite.jdbc.CalciteConnection> fn)
Creates a
CalciteConnection
and executes a callback that returns no result. |
<T> CalciteAssert.AssertThat |
doWithConnection(Function<org.apache.calcite.jdbc.CalciteConnection,T> fn)
Creates a
CalciteConnection
and executes a callback. |
<T> CalciteAssert.AssertThat |
doWithDataContext(Function<org.apache.calcite.DataContext,T> fn)
Creates a
DataContext and executes a callback. |
CalciteAssert.AssertThat |
enable(boolean enabled) |
CalciteAssert.AssertMetaData |
metaData(Function<Connection,ResultSet> function) |
CalciteAssert.AssertThat |
pooled()
Returns a version that uses a single connection, as opposed to creating
a new one each time a test method is invoked.
|
CalciteAssert.AssertQuery |
query(String sql) |
CalciteAssert.AssertThat |
with(CalciteAssert.Config config) |
CalciteAssert.AssertThat |
with(CalciteAssert.ConnectionPostProcessor postProcessor) |
CalciteAssert.AssertThat |
with(CalciteAssert.SchemaSpec... specs)
Creates a copy of this AssertThat, adding more schemas.
|
CalciteAssert.AssertThat |
with(ConnectionFactory connectionFactory)
Creates a copy of this AssertThat, overriding the connection factory.
|
CalciteAssert.AssertThat |
with(org.apache.calcite.avatica.ConnectionProperty property,
Object value) |
CalciteAssert.AssertThat |
with(org.apache.calcite.config.Lex lex)
Sets the Lex property.
|
CalciteAssert.AssertThat |
with(Map<String,String> map) |
CalciteAssert.AssertThat |
with(String property,
Object value) |
CalciteAssert.AssertThat |
withDefaultSchema(String schema)
Sets the default schema of the connection.
|
<T> CalciteAssert.AssertThat |
withHook(org.apache.calcite.runtime.Hook hook,
Consumer<T> handler)
Adds a hook and a handler for that hook.
|
CalciteAssert.AssertThat |
withMaterializations(String model,
boolean existing,
String... materializations)
Adds materializations to the schema.
|
CalciteAssert.AssertThat |
withMaterializations(String model,
Function<org.apache.calcite.util.JsonBuilder,List<Object>> materializations)
Adds materializations to the schema.
|
CalciteAssert.AssertThat |
withMaterializations(String model,
String... materializations) |
CalciteAssert.AssertThat |
withModel(String model) |
CalciteAssert.AssertThat |
withModel(URL model) |
CalciteAssert.AssertQuery |
withRel(Function<org.apache.calcite.tools.RelBuilder,org.apache.calcite.rel.RelNode> relFn)
Adds a factory to create a
RelNode query. |
CalciteAssert.AssertThat |
withSchema(String name,
org.apache.calcite.schema.Schema schema)
Sets the default schema to a given schema.
|
public CalciteAssert.AssertThat with(CalciteAssert.Config config)
public CalciteAssert.AssertThat with(CalciteAssert.SchemaSpec... specs)
public CalciteAssert.AssertThat with(ConnectionFactory connectionFactory)
public <T> CalciteAssert.AssertThat withHook(org.apache.calcite.runtime.Hook hook, Consumer<T> handler)
Hook.addThread(Consumer))
just before running the query, and remove the hook afterwards.public final CalciteAssert.AssertThat with(Map<String,String> map)
public CalciteAssert.AssertThat with(String property, Object value)
public CalciteAssert.AssertThat with(org.apache.calcite.avatica.ConnectionProperty property, Object value)
public CalciteAssert.AssertThat with(org.apache.calcite.config.Lex lex)
public CalciteAssert.AssertThat withSchema(String name, org.apache.calcite.schema.Schema schema)
public CalciteAssert.AssertThat withDefaultSchema(String schema)
public CalciteAssert.AssertThat with(CalciteAssert.ConnectionPostProcessor postProcessor)
public final CalciteAssert.AssertThat withModel(String model)
public final CalciteAssert.AssertThat withModel(URL model)
public final CalciteAssert.AssertThat withMaterializations(String model, String... materializations)
public final CalciteAssert.AssertThat withMaterializations(String model, boolean existing, String... materializations)
public final CalciteAssert.AssertThat withMaterializations(String model, Function<org.apache.calcite.util.JsonBuilder,List<Object>> materializations)
public CalciteAssert.AssertQuery query(String sql)
public CalciteAssert.AssertQuery withRel(Function<org.apache.calcite.tools.RelBuilder,org.apache.calcite.rel.RelNode> relFn)
RelNode query. This RelNode
will be used instead of the SQL string.
Note: if you want to assert the optimized plan, consider using
explainHook... methods such as
CalciteAssert.AssertQuery.explainHookMatches(String)
relFn - a custom factory that creates a RelNode instead of regular sql to relCalciteAssert.AssertQuery.explainHookContains(String),
CalciteAssert.AssertQuery.explainHookMatches(String)public CalciteAssert.AssertThat connectThrows(String message)
public CalciteAssert.AssertThat connectThrows(Consumer<Throwable> exceptionChecker)
public <T> CalciteAssert.AssertThat doWithConnection(Function<org.apache.calcite.jdbc.CalciteConnection,T> fn) throws Exception
CalciteConnection
and executes a callback.Exceptionpublic final CalciteAssert.AssertThat doWithConnection(Consumer<org.apache.calcite.jdbc.CalciteConnection> fn) throws Exception
CalciteConnection
and executes a callback that returns no result.Exceptionpublic <T> CalciteAssert.AssertThat doWithDataContext(Function<org.apache.calcite.DataContext,T> fn) throws Exception
DataContext and executes a callback.Exceptionpublic Connection connect() throws SQLException
SQLExceptionpublic CalciteAssert.AssertThat enable(boolean enabled)
public CalciteAssert.AssertThat pooled()
public CalciteAssert.AssertMetaData metaData(Function<Connection,ResultSet> function)
Copyright © 2012-2023 Apache Software Foundation. All Rights Reserved.