Class SqlParameterizerShuttle
- All Implemented Interfaces:
org.apache.calcite.sql.util.SqlVisitor<org.apache.calcite.sql.SqlNode>
SqlDynamicParam encountered in an SqlNode tree
with a SqlLiteral if a value binding exists for the parameter, if
possible. This is used in tandem with RelParameterizerShuttle.
It is preferable that all parameters are placed here to pick up as many
optimizations as possible, but the facilities to convert jdbc types to
SqlLiteral are a bit less rich here than exist for converting a
RexDynamicParam to
RexLiteral, which is why
SqlParameterizerShuttle and RelParameterizerShuttle
both exist.
As it turns out, most parameters will be replaced in this shuttle.
The one exception are DATE types expressed as integers. For reasons
known only to Calcite, the RexBuilder.clean() method, used by
RelParameterizerShuttle, handles integer values for dates,
but the SqlTypeName.createLiteral() method used here does
not. As a result, DATE parameters will be left as parameters to be
filled in later. Fortunately, this does not affect optimizations as
there are no rules that optimize based on the value of a DATE.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.sql.util.SqlShuttle
org.apache.calcite.sql.util.SqlShuttle.CallCopyingArgHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.calcite.sql.SqlNodevisit(org.apache.calcite.sql.SqlDynamicParam param) Methods inherited from class org.apache.calcite.sql.util.SqlShuttle
visit, visit, visit, visit, visit, visitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.sql.util.SqlVisitor
visitNode
-
Constructor Details
-
SqlParameterizerShuttle
-
-
Method Details
-
visit
public org.apache.calcite.sql.SqlNode visit(org.apache.calcite.sql.SqlDynamicParam param) - Specified by:
visitin interfaceorg.apache.calcite.sql.util.SqlVisitor<org.apache.calcite.sql.SqlNode>- Overrides:
visitin classorg.apache.calcite.sql.util.SqlShuttle
-