Package org.apache.calcite.runtime
Enum Hook
- All Implemented Interfaces:
Serializable
,Comparable<Hook>
,Constable
Collection of hooks that can be set by observers and are executed at various
parts of the query preparation process.
For testing and debugging rather than for end-users.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionCalled with the output of sql-to-rel-converter.Called when materialization is created.Called to get the current time.Returns a boolean value, whether the return convention should beBindableConvention
.Called when a constant expression is being reduced.Called with the generated Java plan, just before it is compiled by Janino.Called with the SQL string and parse tree, in an array.Called when a plan is about to be implemented (e.g.Called with the created planner.Called to create a Program to optimize the statement.Called with a query that has been generated to send to a back-end system.Returns a boolean value, whether RelBuilder should simplify expressions.Called before SqlToRelConverter is built.Called to get stdin, stdout, stderr.Converts a SQL string to aCalcitePrepare.Query
object.Called by the planner after substituting a materialization.Called after de-correlation and field trimming, but before optimization. -
Method Summary
Modifier and TypeMethodDescription<T> Hook.Closeable
Deprecated.this installs a global hook (cross-thread), so it might have greater impact than expected.<T,
R> Hook.Closeable Deprecated.Useadd(Consumer)
.<T,
R> Hook.Closeable addThread
(com.google.common.base.Function<T, R> handler) Deprecated.UseaddThread(Consumer)
.<T> Hook.Closeable
Adds a handler for this thread.<V> V
get
(V defaultValue) Returns the value of a property hook.property
(V v) Deprecated.UsepropertyJ(V)
.propertyJ
(V v) Returns a function that, when a hook is called, will "return" a given value.void
Runs all handlers registered for this Hook, with the given argument.static Hook
Returns the enum constant of this type with the specified name.static Hook[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
CURRENT_TIME
Called to get the current time. Use this to return a predictable time in tests. -
STANDARD_STREAMS
Called to get stdin, stdout, stderr. Use this to re-assign streams in tests. -
REL_BUILDER_SIMPLIFY
Returns a boolean value, whether RelBuilder should simplify expressions. Default true. -
ENABLE_BINDABLE
Returns a boolean value, whether the return convention should beBindableConvention
. Default false. -
PARSE_TREE
Called with the SQL string and parse tree, in an array. -
STRING_TO_QUERY
Converts a SQL string to aCalcitePrepare.Query
object. This hook is an opportunity to execute aRelNode
query plan in the JDBC driver rather than the usual SQL string. -
JAVA_PLAN
Called with the generated Java plan, just before it is compiled by Janino. -
SQL2REL_CONVERTER_CONFIG_BUILDER
Called before SqlToRelConverter is built. -
CONVERTED
Called with the output of sql-to-rel-converter. -
PLANNER
Called with the created planner. -
TRIMMED
Called after de-correlation and field trimming, but before optimization. -
SUB
Called by the planner after substituting a materialization. -
EXPRESSION_REDUCER
Called when a constant expression is being reduced. -
PROGRAM
Called to create a Program to optimize the statement. -
CREATE_MATERIALIZATION
Called when materialization is created. -
QUERY_PLAN
Called with a query that has been generated to send to a back-end system. The query might be a SQL string (for the JDBC adapter), a list of Mongo pipeline expressions (for the MongoDB adapter), et cetera. -
PLAN_BEFORE_IMPLEMENTATION
Called when a plan is about to be implemented (e.g. implemented via Enumerable, Bindable, and so on). The hook suppliesRelRoot
as an argument.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
add
Deprecated.this installs a global hook (cross-thread), so it might have greater impact than expected. Use with caution. Prefer thread-local hooks.Adds a handler for this Hook.Returns a
Hook.Closeable
so that you can use the following try-finally pattern to prevent leaks:final Hook.Closeable closeable = Hook.FOO.add(HANDLER); try { ... } finally { closeable.close(); }
- See Also:
-
add
Deprecated.Useadd(Consumer)
. -
addThread
Adds a handler for this thread. -
addThread
Deprecated.UseaddThread(Consumer)
. -
property
Deprecated.UsepropertyJ(V)
. -
propertyJ
Returns a function that, when a hook is called, will "return" a given value. (Because of the way hooks work, it "returns" the value by writing into aHolder
. -
run
Runs all handlers registered for this Hook, with the given argument. -
get
public <V> V get(V defaultValue) Returns the value of a property hook. (Property hooks take aHolder
as an argument.)
-