public static class CalciteAssert.AssertQuery extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
CalciteAssert.AssertQuery |
consumesPreparedStatement(CalciteAssert.PreparedStatementConsumer consumer) |
CalciteAssert.AssertQuery |
convertContains(String expected)
Checks that when the query (which was set using
CalciteAssert.AssertThat.query(String)) is converted to a relational algebra
expression matching the given string. |
CalciteAssert.AssertQuery |
convertMatches(Consumer<org.apache.calcite.rel.RelNode> checker) |
protected Connection |
createConnection() |
CalciteAssert.AssertQuery |
enable(boolean enabled) |
CalciteAssert.AssertQuery |
enableMaterializations(boolean materializationsEnabled) |
CalciteAssert.AssertQuery |
explainContains(String expected) |
CalciteAssert.AssertQuery |
explainHookContains(org.apache.calcite.sql.SqlExplainLevel sqlExplainLevel,
String expectedPlan)
This enables to assert the optimized plan without issuing a separate
explain ... |
CalciteAssert.AssertQuery |
explainHookContains(String expectedPlan)
This enables to assert the optimized plan without issuing a separate
explain ... |
CalciteAssert.AssertQuery |
explainHookMatches(org.hamcrest.Matcher<String> planMatcher)
This enables to assert the optimized plan without issuing a separate
explain ... |
CalciteAssert.AssertQuery |
explainHookMatches(org.apache.calcite.sql.SqlExplainLevel sqlExplainLevel,
org.hamcrest.Matcher<String> planMatcher)
This enables to assert the optimized plan without issuing a separate
explain ... |
CalciteAssert.AssertQuery |
explainHookMatches(String expectedPlan)
This enables to assert the optimized plan without issuing a separate
explain ... |
CalciteAssert.AssertQuery |
explainMatches(String extra,
Consumer<ResultSet> checker) |
CalciteAssert.AssertQuery |
failsAtValidation()
Utility method so that one doesn't have to call
failsAtValidation(java.lang.String) with null. |
CalciteAssert.AssertQuery |
failsAtValidation(String optionalMessage)
Used to check whether a sql statement fails at the SQL Validation phase.
|
CalciteAssert.AssertQuery |
limit(int limit)
Sets a limit on the number of rows returned. -1 means no limit.
|
CalciteAssert.AssertQuery |
planContains(String expected) |
CalciteAssert.AssertQuery |
planHasSql(String expected) |
CalciteAssert.AssertQuery |
planUpdateHasSql(String expected,
int count) |
CalciteAssert.AssertQuery |
queryContains(Consumer<List> predicate1)
Runs the query and applies a checker to the generated third-party
queries.
|
CalciteAssert.AssertQuery |
queryContains(com.google.common.base.Function<List,Void> predicate1)
已过时。
|
CalciteAssert.AssertQuery |
returns(Consumer<ResultSet> checker) |
CalciteAssert.AssertQuery |
returns(String expected) |
protected CalciteAssert.AssertQuery |
returns(String sql,
Consumer<ResultSet> checker) |
CalciteAssert.AssertQuery |
returns2(String expected)
Similar to
returns(java.lang.String), but trims a few values before
comparing. |
CalciteAssert.AssertQuery |
returnsCount(int expectedCount) |
CalciteAssert.AssertQuery |
returnsOrdered(String... lines) |
CalciteAssert.AssertQuery |
returnsStartingWith(String... lines) |
CalciteAssert.AssertQuery |
returnsUnordered(String... lines) |
CalciteAssert.AssertQuery |
returnsValue(String expected) |
CalciteAssert.AssertQuery |
runs() |
void |
sameResultWithMaterializationsDisabled() |
CalciteAssert.AssertQuery |
substitutionMatches(Consumer<org.apache.calcite.rel.RelNode> checker) |
CalciteAssert.AssertQuery |
throws_(String message) |
CalciteAssert.AssertQuery |
typeIs(String expected) |
CalciteAssert.AssertQuery |
updates(int count) |
CalciteAssert.AssertQuery |
withConnection(Consumer<Connection> f)
Performs an action using a connection, and closes the connection
afterwards.
|
<T> CalciteAssert.AssertQuery |
withHook(org.apache.calcite.runtime.Hook hook,
Consumer<T> handler)
Adds a hook and a handler for that hook.
|
<V> CalciteAssert.AssertQuery |
withProperty(org.apache.calcite.runtime.Hook hook,
V value)
Adds a property hook.
|
protected Connection createConnection()
public final CalciteAssert.AssertQuery withConnection(Consumer<Connection> f)
public CalciteAssert.AssertQuery enable(boolean enabled)
public CalciteAssert.AssertQuery returns(String expected)
public CalciteAssert.AssertQuery returns2(String expected)
returns(java.lang.String), but trims a few values before
comparing.public CalciteAssert.AssertQuery returnsValue(String expected)
public CalciteAssert.AssertQuery returnsCount(int expectedCount)
public final CalciteAssert.AssertQuery returns(Consumer<ResultSet> checker)
public final CalciteAssert.AssertQuery updates(int count)
protected CalciteAssert.AssertQuery returns(String sql, Consumer<ResultSet> checker)
public CalciteAssert.AssertQuery returnsUnordered(String... lines)
public CalciteAssert.AssertQuery returnsOrdered(String... lines)
public CalciteAssert.AssertQuery returnsStartingWith(String... lines)
public CalciteAssert.AssertQuery throws_(String message)
public CalciteAssert.AssertQuery failsAtValidation(String optionalMessage)
SqlValidatorException or CalciteException was thrown.optionalMessage - An optional message to check for in the output stacktracepublic CalciteAssert.AssertQuery failsAtValidation()
failsAtValidation(java.lang.String) with null.public CalciteAssert.AssertQuery runs()
public CalciteAssert.AssertQuery typeIs(String expected)
public final CalciteAssert.AssertQuery convertContains(String expected)
CalciteAssert.AssertThat.query(String)) is converted to a relational algebra
expression matching the given string.public CalciteAssert.AssertQuery consumesPreparedStatement(CalciteAssert.PreparedStatementConsumer consumer)
public CalciteAssert.AssertQuery convertMatches(Consumer<org.apache.calcite.rel.RelNode> checker)
public CalciteAssert.AssertQuery substitutionMatches(Consumer<org.apache.calcite.rel.RelNode> checker)
public CalciteAssert.AssertQuery explainContains(String expected)
@API(since="1.22",
status=EXPERIMENTAL)
public CalciteAssert.AssertQuery explainHookContains(String expectedPlan)
explain ...
command. This is especially useful when RelNode is provided via
Hook.STRING_TO_QUERY or CalciteAssert.AssertThat.withRel(Function).
Note: this API does NOT trigger the query, so you need to use something like
returns(String), or returnsUnordered(String...) to trigger query
execution
Note: prefer using explainHookMatches(String) if you assert
the full plan tree as it produces slightly cleaner messages
expectedPlan - expected execution plan. The plan is normalized to LF line endings@API(since="1.22",
status=EXPERIMENTAL)
public CalciteAssert.AssertQuery explainHookContains(org.apache.calcite.sql.SqlExplainLevel sqlExplainLevel,
String expectedPlan)
explain ...
command. This is especially useful when RelNode is provided via
Hook.STRING_TO_QUERY or CalciteAssert.AssertThat.withRel(Function).
Note: this API does NOT trigger the query, so you need to use something like
returns(String), or returnsUnordered(String...) to trigger query
execution
Note: prefer using explainHookMatches(SqlExplainLevel, Matcher) if you assert
the full plan tree as it produces slightly cleaner messages
sqlExplainLevel - the level of explain planexpectedPlan - expected execution plan. The plan is normalized to LF line endings@API(since="1.22",
status=EXPERIMENTAL)
public CalciteAssert.AssertQuery explainHookMatches(String expectedPlan)
explain ...
command. This is especially useful when RelNode is provided via
Hook.STRING_TO_QUERY or CalciteAssert.AssertThat.withRel(Function).
Note: this API does NOT trigger the query, so you need to use something like
returns(String), or returnsUnordered(String...) to trigger query
execution.
expectedPlan - expected execution plan. The plan is normalized to LF line endings@API(since="1.22",
status=EXPERIMENTAL)
public CalciteAssert.AssertQuery explainHookMatches(org.hamcrest.Matcher<String> planMatcher)
explain ...
command. This is especially useful when RelNode is provided via
Hook.STRING_TO_QUERY or CalciteAssert.AssertThat.withRel(Function).
Note: this API does NOT trigger the query, so you need to use something like
returns(String), or returnsUnordered(String...) to trigger query
execution.
planMatcher - execution plan matcher. The plan is normalized to LF line endings@API(since="1.22",
status=EXPERIMENTAL)
public CalciteAssert.AssertQuery explainHookMatches(org.apache.calcite.sql.SqlExplainLevel sqlExplainLevel,
org.hamcrest.Matcher<String> planMatcher)
explain ...
command. This is especially useful when RelNode is provided via
Hook.STRING_TO_QUERY or CalciteAssert.AssertThat.withRel(Function).
Note: this API does NOT trigger the query, so you need to use something like
returns(String), or returnsUnordered(String...) to trigger query
execution.
sqlExplainLevel - the level of explain planplanMatcher - execution plan matcher. The plan is normalized to LF line endingspublic final CalciteAssert.AssertQuery explainMatches(String extra, Consumer<ResultSet> checker)
public CalciteAssert.AssertQuery planContains(String expected)
public CalciteAssert.AssertQuery planUpdateHasSql(String expected, int count)
public CalciteAssert.AssertQuery planHasSql(String expected)
public CalciteAssert.AssertQuery queryContains(Consumer<List> predicate1)
@Deprecated public final CalciteAssert.AssertQuery queryContains(com.google.common.base.Function<List,Void> predicate1)
queryContains(Consumer).public CalciteAssert.AssertQuery limit(int limit)
public void sameResultWithMaterializationsDisabled()
public CalciteAssert.AssertQuery enableMaterializations(boolean materializationsEnabled)
public <T> CalciteAssert.AssertQuery withHook(org.apache.calcite.runtime.Hook hook, Consumer<T> handler)
Hook.addThread(Consumer))
just before running the query, and remove the hook afterwards.public <V> CalciteAssert.AssertQuery withProperty(org.apache.calcite.runtime.Hook hook, V value)
Copyright © 2012-2023 Apache Software Foundation. All Rights Reserved.