public abstract class DrillRelOptUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DrillRelOptUtil.InputRefVisitor
InputRefVisitor is a utility class used to collect all the RexInputRef nodes in a
RexNode.
|
static class |
DrillRelOptUtil.ProjectPushInfo
Stores information about fields, their names and types.
|
static class |
DrillRelOptUtil.RexFieldsTransformer
RexFieldsTransformer is a utility class used to convert column refs in a RexNode
based on inputRefMap (input to output ref map).
|
Modifier and Type | Field and Description |
---|---|
static String |
IMPLICIT_COLUMN |
Constructor and Description |
---|
DrillRelOptUtil() |
Modifier and Type | Method and Description |
---|---|
static List<org.apache.calcite.util.Pair<Integer,Integer>> |
analyzeSimpleEquiJoin(org.apache.calcite.rel.core.Join join) |
static boolean |
analyzeSimpleEquiJoin(org.apache.calcite.rel.core.Join join,
int[] joinFieldOrdinals)
Returns whether the join condition is a simple equi-join or not.
|
static boolean |
areRowTypesCompatible(org.apache.calcite.rel.type.RelDataType rowType1,
org.apache.calcite.rel.type.RelDataType rowType2,
boolean compareNames,
boolean allowSubstring) |
static org.apache.calcite.rel.RelNode |
createRename(org.apache.calcite.rel.RelNode rel,
List<String> fieldNames)
Returns a relational expression which has the same fields as the
underlying expression, but the fields have different names.
|
static List<org.apache.calcite.rex.RexInputRef> |
findAllRexInputRefs(org.apache.calcite.rex.RexNode node) |
static org.apache.calcite.rex.RexCall |
findOperators(org.apache.calcite.rex.RexNode node,
List<org.apache.calcite.rex.RexNode> projExprs,
Collection<String> operators)
Travesal RexNode to find at least one operator in the given collection.
|
static org.apache.calcite.rel.core.TableScan |
findScan(org.apache.calcite.rel.RelNode... rels) |
static DrillTable |
getDrillTable(org.apache.calcite.rel.core.TableScan scan) |
static DrillRelOptUtil.ProjectPushInfo |
getFieldsInformation(org.apache.calcite.rel.type.RelDataType rowType,
List<org.apache.calcite.rex.RexNode> projects) |
static boolean |
guessRows(org.apache.calcite.rel.RelNode rel)
Returns whether statistics-based estimates or guesses are used by the optimizer
for the
RelNode rel. |
static boolean |
isLimit0(org.apache.calcite.rex.RexNode fetch) |
static boolean |
isProjectFlatten(org.apache.calcite.rel.RelNode project) |
static boolean |
isProjectOutputRowcountUnknown(org.apache.calcite.rel.core.Project project)
Find whether the given project rel can produce non-scalar output (hence unknown rowcount).
|
static boolean |
isProjectOutputSchemaUnknown(org.apache.calcite.rel.core.Project project)
Find whether the given project rel has unknown output schema.
|
static boolean |
isTrivialProject(org.apache.calcite.rel.core.Project project,
boolean useNamesInIdentityProjCalc) |
static Map<Integer,Integer> |
rightShiftColsInRowType(org.apache.calcite.rel.type.RelDataType rowType)
For a given row type return a map between old field indices and one index right shifted fields.
|
static org.apache.calcite.rex.RexNode |
transformExpr(org.apache.calcite.rex.RexBuilder builder,
org.apache.calcite.rex.RexNode expr,
Map<Integer,Integer> corrMap)
Given a of rexnode it transforms the rexnode by changing the expr to use new index mapped to the old index.
|
static List<org.apache.calcite.rex.RexNode> |
transformExprs(org.apache.calcite.rex.RexBuilder builder,
List<org.apache.calcite.rex.RexNode> exprs,
Map<Integer,Integer> corrMap)
Given a list of rexnodes it transforms the rexnodes by changing the expr to use new index mapped to the old index.
|
static org.apache.calcite.rel.type.RelDataType |
uniqifyFieldName(org.apache.calcite.rel.type.RelDataType rowType,
org.apache.calcite.rel.type.RelDataTypeFactory typeFactory)
Returns a rowType having all unique field name.
|
public static final String IMPLICIT_COLUMN
public static boolean areRowTypesCompatible(org.apache.calcite.rel.type.RelDataType rowType1, org.apache.calcite.rel.type.RelDataType rowType2, boolean compareNames, boolean allowSubstring)
public static org.apache.calcite.rel.RelNode createRename(org.apache.calcite.rel.RelNode rel, List<String> fieldNames)
rel
- Relational expressionfieldNames
- Field namespublic static boolean isTrivialProject(org.apache.calcite.rel.core.Project project, boolean useNamesInIdentityProjCalc)
public static org.apache.calcite.rel.type.RelDataType uniqifyFieldName(org.apache.calcite.rel.type.RelDataType rowType, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory)
rowType
- input rowTypetypeFactory
- type factory used to create a new row type.public static org.apache.calcite.rex.RexCall findOperators(org.apache.calcite.rex.RexNode node, List<org.apache.calcite.rex.RexNode> projExprs, Collection<String> operators)
node
- RexNode to searchprojExprs
- the list of project expressions. Empty list means there is No project operator underneath.operators
- collection of operators to findpublic static boolean isLimit0(org.apache.calcite.rex.RexNode fetch)
public static boolean isProjectOutputRowcountUnknown(org.apache.calcite.rel.core.Project project)
project
- The project relpublic static boolean isProjectOutputSchemaUnknown(org.apache.calcite.rel.core.Project project)
project
- The project relpublic static org.apache.calcite.rel.core.TableScan findScan(org.apache.calcite.rel.RelNode... rels)
public static Map<Integer,Integer> rightShiftColsInRowType(org.apache.calcite.rel.type.RelDataType rowType)
rowType
- row type to be right shifted.public static List<org.apache.calcite.rex.RexNode> transformExprs(org.apache.calcite.rex.RexBuilder builder, List<org.apache.calcite.rex.RexNode> exprs, Map<Integer,Integer> corrMap)
builder
- RexBuilder from the planner.exprs
- RexNodes to be transformed.corrMap
- Mapping between old index to new index.public static org.apache.calcite.rex.RexNode transformExpr(org.apache.calcite.rex.RexBuilder builder, org.apache.calcite.rex.RexNode expr, Map<Integer,Integer> corrMap)
builder
- RexBuilder from the planner.expr
- RexNode to be transformed.corrMap
- Mapping between old index to new index.public static boolean isProjectFlatten(org.apache.calcite.rel.RelNode project)
public static DrillRelOptUtil.ProjectPushInfo getFieldsInformation(org.apache.calcite.rel.type.RelDataType rowType, List<org.apache.calcite.rex.RexNode> projects)
public static boolean guessRows(org.apache.calcite.rel.RelNode rel)
RelNode
rel.rel
- inputpublic static boolean analyzeSimpleEquiJoin(org.apache.calcite.rel.core.Join join, int[] joinFieldOrdinals)
join
- input joinjoinFieldOrdinals
- join field ordinal w.r.t. the underlying inputs to the joinpublic static DrillTable getDrillTable(org.apache.calcite.rel.core.TableScan scan)
public static List<org.apache.calcite.util.Pair<Integer,Integer>> analyzeSimpleEquiJoin(org.apache.calcite.rel.core.Join join)
public static List<org.apache.calcite.rex.RexInputRef> findAllRexInputRefs(org.apache.calcite.rex.RexNode node)
Copyright © 1970 The Apache Software Foundation. All rights reserved.