public class DefaultSqlHandler extends AbstractSqlHandler
Modifier and Type | Class and Description |
---|---|
protected class |
DefaultSqlHandler.ConvertedRelNode |
static class |
DefaultSqlHandler.MetaDataProviderModifier |
Modifier and Type | Field and Description |
---|---|
protected SqlHandlerConfig |
config |
protected QueryContext |
context |
Constructor and Description |
---|
DefaultSqlHandler(SqlHandlerConfig config) |
DefaultSqlHandler(SqlHandlerConfig config,
Pointer<String> textPlan) |
Modifier and Type | Method and Description |
---|---|
protected DrillRel |
addRenamedProject(DrillRel rel,
org.apache.calcite.rel.type.RelDataType validatedRowType) |
protected DrillRel |
convertToDrel(org.apache.calcite.rel.RelNode relNode)
Return Drill Logical RelNode tree for a SELECT statement, when it is executed / explained directly.
|
protected PhysicalPlan |
convertToPlan(PhysicalOperator op) |
protected PhysicalOperator |
convertToPop(Prel prel) |
protected Prel |
convertToPrel(org.apache.calcite.rel.RelNode drel,
org.apache.calcite.rel.type.RelDataType validatedRowType)
Applies physical rules and certain transformations to convert drill relational node into physical one.
|
protected DrillRel |
convertToRawDrel(org.apache.calcite.rel.RelNode relNode)
Given a relNode tree for SELECT statement, convert to Drill Logical RelNode tree.
|
PhysicalPlan |
getPlan(org.apache.calcite.sql.SqlNode sqlNode) |
static List<PhysicalOperator> |
getPops(PhysicalOperator root) |
protected void |
log(PlannerType plannerType,
PlannerPhase phase,
org.apache.calcite.rel.RelNode node,
org.slf4j.Logger logger,
org.apache.drill.shaded.guava.com.google.common.base.Stopwatch watch) |
protected void |
log(String name,
PhysicalPlan plan,
org.slf4j.Logger logger) |
protected void |
log(String description,
org.apache.calcite.rel.RelNode node,
org.slf4j.Logger logger,
org.apache.drill.shaded.guava.com.google.common.base.Stopwatch watch) |
protected void |
logAndSetTextPlan(String description,
Prel prel,
org.slf4j.Logger logger) |
protected org.apache.calcite.sql.SqlNode |
rewrite(org.apache.calcite.sql.SqlNode node)
Rewrite the parse tree.
|
protected org.apache.calcite.rel.RelNode |
transform(PlannerType plannerType,
PlannerPhase phase,
org.apache.calcite.rel.RelNode input,
org.apache.calcite.plan.RelTraitSet targetTraits)
Transform RelNode to a new RelNode, targeting the provided set of traits.
|
protected org.apache.calcite.rel.RelNode |
transform(PlannerType plannerType,
PlannerPhase phase,
org.apache.calcite.rel.RelNode input,
org.apache.calcite.plan.RelTraitSet targetTraits,
boolean log)
Transform RelNode to a new RelNode, targeting the provided set of traits.
|
protected DefaultSqlHandler.ConvertedRelNode |
validateAndConvert(org.apache.calcite.sql.SqlNode sqlNode) |
protected org.apache.calcite.util.Pair<org.apache.calcite.sql.SqlNode,org.apache.calcite.rel.type.RelDataType> |
validateNode(org.apache.calcite.sql.SqlNode sqlNode) |
unwrap
protected final SqlHandlerConfig config
protected final QueryContext context
public DefaultSqlHandler(SqlHandlerConfig config)
public DefaultSqlHandler(SqlHandlerConfig config, Pointer<String> textPlan)
protected void log(PlannerType plannerType, PlannerPhase phase, org.apache.calcite.rel.RelNode node, org.slf4j.Logger logger, org.apache.drill.shaded.guava.com.google.common.base.Stopwatch watch)
protected void log(String description, org.apache.calcite.rel.RelNode node, org.slf4j.Logger logger, org.apache.drill.shaded.guava.com.google.common.base.Stopwatch watch)
protected void logAndSetTextPlan(String description, Prel prel, org.slf4j.Logger logger)
protected void log(String name, PhysicalPlan plan, org.slf4j.Logger logger)
public PhysicalPlan getPlan(org.apache.calcite.sql.SqlNode sqlNode) throws org.apache.calcite.tools.ValidationException, org.apache.calcite.tools.RelConversionException, IOException, ForemanSetupException
getPlan
in class AbstractSqlHandler
org.apache.calcite.tools.ValidationException
org.apache.calcite.tools.RelConversionException
IOException
ForemanSetupException
protected org.apache.calcite.sql.SqlNode rewrite(org.apache.calcite.sql.SqlNode node) throws org.apache.calcite.tools.RelConversionException, ForemanSetupException
node
- sql parse tree to be rewrittenorg.apache.calcite.tools.RelConversionException
ForemanSetupException
protected DefaultSqlHandler.ConvertedRelNode validateAndConvert(org.apache.calcite.sql.SqlNode sqlNode) throws ForemanSetupException, org.apache.calcite.tools.RelConversionException, org.apache.calcite.tools.ValidationException
ForemanSetupException
org.apache.calcite.tools.RelConversionException
org.apache.calcite.tools.ValidationException
protected DrillRel convertToRawDrel(org.apache.calcite.rel.RelNode relNode) throws SqlUnsupportedException
relNode
- relational nodeSqlUnsupportedException
- if query cannot be plannedprotected DrillRel convertToDrel(org.apache.calcite.rel.RelNode relNode) throws SqlUnsupportedException
relNode
- root RelNode corresponds to Calcite Logical RelNode.SqlUnsupportedException
- if query cannot be plannedprotected org.apache.calcite.rel.RelNode transform(PlannerType plannerType, PlannerPhase phase, org.apache.calcite.rel.RelNode input, org.apache.calcite.plan.RelTraitSet targetTraits)
plannerType
- The type of Planner to use.phase
- The transformation phase we're running.input
- The original RelNodetargetTraits
- The traits we are targeting for output.protected org.apache.calcite.rel.RelNode transform(PlannerType plannerType, PlannerPhase phase, org.apache.calcite.rel.RelNode input, org.apache.calcite.plan.RelTraitSet targetTraits, boolean log)
plannerType
- The type of Planner to use.phase
- The transformation phase we're running.input
- The original RelNodetargetTraits
- The traits we are targeting for output.log
- Whether to log the planning phase.protected Prel convertToPrel(org.apache.calcite.rel.RelNode drel, org.apache.calcite.rel.type.RelDataType validatedRowType) throws org.apache.calcite.tools.RelConversionException, SqlUnsupportedException
drel
- relational nodevalidatedRowType
- final output row typeorg.apache.calcite.tools.RelConversionException
SqlUnsupportedException
protected PhysicalOperator convertToPop(Prel prel) throws IOException
IOException
protected PhysicalPlan convertToPlan(PhysicalOperator op)
public static List<PhysicalOperator> getPops(PhysicalOperator root)
protected org.apache.calcite.util.Pair<org.apache.calcite.sql.SqlNode,org.apache.calcite.rel.type.RelDataType> validateNode(org.apache.calcite.sql.SqlNode sqlNode) throws org.apache.calcite.tools.ValidationException, org.apache.calcite.tools.RelConversionException, ForemanSetupException
org.apache.calcite.tools.ValidationException
org.apache.calcite.tools.RelConversionException
ForemanSetupException
Copyright © 1970 The Apache Software Foundation. All rights reserved.