public abstract class Prepare extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Prepare.CatalogReader
Interface by which validator and planner can read table metadata.
|
static class |
Prepare.Materialization
Describes that a given SQL query is materialized by a given table.
|
static class |
Prepare.PreparedExplain
PreparedExplanation is a PreparedResult for an EXPLAIN PLAN statement.
|
static interface |
Prepare.PreparedResult
|
static class |
Prepare.PreparedResultImpl
Abstract implementation of
Prepare.PreparedResult. |
static interface |
Prepare.PreparingTable
Definition of a table, for the purposes of the validator and planner.
|
| Modifier and Type | Field and Description |
|---|---|
protected Prepare.CatalogReader |
catalogReader |
protected CalcitePrepare.Context |
context |
protected List<List<String>> |
fieldOrigins |
protected static Logger |
LOGGER |
protected RelDataType |
parameterRowType |
protected String |
queryString |
protected Convention |
resultConvention
Convention via which results should be returned by execution.
|
static ThreadLocal<Boolean> |
THREAD_TRIM |
protected CalciteTimingTracer |
timingTracer |
| Constructor and Description |
|---|
Prepare(CalcitePrepare.Context context,
Prepare.CatalogReader catalogReader,
Convention resultConvention) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Prepare.PreparedResult |
createPreparedExplanation(RelDataType resultType,
RelDataType parameterRowType,
RelNode rootRel,
boolean explainAsXml,
SqlExplainLevel detailLevel) |
protected abstract RelNode |
decorrelate(SqlToRelConverter sqlToRelConverter,
SqlNode query,
RelNode rootRel) |
RelNode |
expandView(RelDataType rowType,
String queryString,
List<String> schemaPath)
Returns a relational expression which is to be substituted for an access
to a SQL view.
|
abstract RelNode |
flattenTypes(RelNode rootRel,
boolean restructure) |
protected RelTraitSet |
getDesiredRootTraitSet(RelNode rootRel) |
protected abstract SqlToRelConverter |
getSqlToRelConverter(SqlValidator validator,
Prepare.CatalogReader catalogReader)
Protected method to allow subclasses to override construction of
SqlToRelConverter.
|
protected abstract SqlValidator |
getSqlValidator() |
protected abstract Prepare.PreparedResult |
implement(RelDataType rowType,
RelNode rootRel,
SqlKind sqlKind)
Implements a physical query plan.
|
protected abstract void |
init(Class runtimeContextClass) |
protected TableModify.Operation |
mapTableModOp(boolean isDml,
SqlKind sqlKind) |
protected RelNode |
optimize(RelNode rootRel,
List<Prepare.Materialization> materializations,
List<CalciteSchema.LatticeEntry> lattices)
Optimizes a query plan.
|
Prepare.PreparedResult |
prepareSql(SqlNode sqlQuery,
Class runtimeContextClass,
SqlValidator validator,
boolean needsValidation,
List<Prepare.Materialization> materializations,
List<CalciteSchema.LatticeEntry> lattices) |
Prepare.PreparedResult |
prepareSql(SqlNode sqlQuery,
SqlNode sqlNodeOriginal,
Class runtimeContextClass,
SqlValidator validator,
boolean needsValidation,
List<Prepare.Materialization> materializations,
List<CalciteSchema.LatticeEntry> lattices) |
protected RelNode |
trimUnusedFields(RelNode rootRel)
Walks over a tree of relational expressions, replacing each
RelNode with a 'slimmed down' relational
expression that projects
only the columns required by its consumer. |
protected static final Logger LOGGER
protected final CalcitePrepare.Context context
protected final Prepare.CatalogReader catalogReader
protected String queryString
protected final Convention resultConvention
protected CalciteTimingTracer timingTracer
protected RelDataType parameterRowType
public static final ThreadLocal<Boolean> THREAD_TRIM
public Prepare(CalcitePrepare.Context context, Prepare.CatalogReader catalogReader, Convention resultConvention)
protected abstract Prepare.PreparedResult createPreparedExplanation(RelDataType resultType, RelDataType parameterRowType, RelNode rootRel, boolean explainAsXml, SqlExplainLevel detailLevel)
protected RelNode optimize(RelNode rootRel, List<Prepare.Materialization> materializations, List<CalciteSchema.LatticeEntry> lattices)
rootRel - root of a relational expressionmaterializations - Tables known to be populated with a given querylattices - Latticesprotected RelTraitSet getDesiredRootTraitSet(RelNode rootRel)
protected abstract Prepare.PreparedResult implement(RelDataType rowType, RelNode rootRel, SqlKind sqlKind)
rowType - original row type returned by query validatorrootRel - root of the relational expression.sqlKind - SqlKind of the original statement.public Prepare.PreparedResult prepareSql(SqlNode sqlQuery, Class runtimeContextClass, SqlValidator validator, boolean needsValidation, List<Prepare.Materialization> materializations, List<CalciteSchema.LatticeEntry> lattices)
public Prepare.PreparedResult prepareSql(SqlNode sqlQuery, SqlNode sqlNodeOriginal, Class runtimeContextClass, SqlValidator validator, boolean needsValidation, List<Prepare.Materialization> materializations, List<CalciteSchema.LatticeEntry> lattices)
protected TableModify.Operation mapTableModOp(boolean isDml, SqlKind sqlKind)
protected abstract SqlToRelConverter getSqlToRelConverter(SqlValidator validator, Prepare.CatalogReader catalogReader)
protected abstract RelNode decorrelate(SqlToRelConverter sqlToRelConverter, SqlNode query, RelNode rootRel)
protected RelNode trimUnusedFields(RelNode rootRel)
RelNode with a 'slimmed down' relational
expression that projects
only the columns required by its consumer.rootRel - Relational expression that is at the root of the treepublic RelNode expandView(RelDataType rowType, String queryString, List<String> schemaPath)
rowType - Row type of the viewqueryString - Body of the viewschemaPath - List of schema names wherein to find referenced tablesprotected abstract void init(Class runtimeContextClass)
protected abstract SqlValidator getSqlValidator()
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.