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 SummaryNested ClassesNested classes/interfaces inherited from class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum ConstantsEnum 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.Queryobject.Called by the planner after substituting a materialization.Called after de-correlation and field trimming, but before optimization.
- 
Method SummaryModifier and TypeMethodDescription<T> Hook.CloseableDeprecated.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.CloseableAdds a handler for this thread.<V> Vget(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.voidRuns all handlers registered for this Hook, with the given argument.static HookReturns 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_TIMECalled to get the current time. Use this to return a predictable time in tests.
- 
STANDARD_STREAMSCalled to get stdin, stdout, stderr. Use this to re-assign streams in tests.
- 
REL_BUILDER_SIMPLIFYReturns a boolean value, whether RelBuilder should simplify expressions. Default true.
- 
ENABLE_BINDABLEReturns a boolean value, whether the return convention should beBindableConvention. Default false.
- 
PARSE_TREECalled with the SQL string and parse tree, in an array.
- 
STRING_TO_QUERYConverts a SQL string to aCalcitePrepare.Queryobject. This hook is an opportunity to execute aRelNodequery plan in the JDBC driver rather than the usual SQL string.
- 
JAVA_PLANCalled with the generated Java plan, just before it is compiled by Janino.
- 
SQL2REL_CONVERTER_CONFIG_BUILDERCalled before SqlToRelConverter is built.
- 
CONVERTEDCalled with the output of sql-to-rel-converter.
- 
PLANNERCalled with the created planner.
- 
TRIMMEDCalled after de-correlation and field trimming, but before optimization.
- 
SUBCalled by the planner after substituting a materialization.
- 
EXPRESSION_REDUCERCalled when a constant expression is being reduced.
- 
PROGRAMCalled to create a Program to optimize the statement.
- 
CREATE_MATERIALIZATIONCalled when materialization is created.
- 
QUERY_PLANCalled 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_IMPLEMENTATIONCalled when a plan is about to be implemented (e.g. implemented via Enumerable, Bindable, and so on). The hook suppliesRelRootas an argument.
 
- 
- 
Method Details- 
valuesReturns 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
 
- 
valueOfReturns 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 name
- NullPointerException- if the argument is null
 
- 
addDeprecated.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.Closeableso 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:
 
- 
addDeprecated.Useadd(Consumer).
- 
addThreadAdds a handler for this thread.
- 
addThreadDeprecated.UseaddThread(Consumer).
- 
propertyDeprecated.UsepropertyJ(V).
- 
propertyJReturns 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.
- 
runRuns all handlers registered for this Hook, with the given argument.
- 
getpublic <V> V get(V defaultValue) Returns the value of a property hook. (Property hooks take aHolderas an argument.)
 
-