public class HiveCalciteUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HiveCalciteUtil.ConstantFinder
Walks over an expression and determines whether it is constant.
|
static class |
HiveCalciteUtil.JoinLeafPredicateInfo
JoinLeafPredicateInfo represents leaf predicate in Join condition
(conjuctive lement).
|
static class |
HiveCalciteUtil.JoinPredicateInfo
JoinPredicateInfo represents Join condition; JoinPredicate Info uses
JoinLeafPredicateInfo to represent individual conjunctive elements in the
predicate.
JoinPredicateInfo = JoinLeafPredicateInfo1 and JoinLeafPredicateInfo2... |
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Function<org.apache.calcite.rex.RexNode,String> |
REX_STR_FN |
Constructor and Description |
---|
HiveCalciteUtil() |
Modifier and Type | Method and Description |
---|---|
static HiveProject |
createProjectWithoutColumn(org.apache.calcite.rel.RelNode input,
Set<Integer> positions) |
static org.apache.calcite.rel.core.AggregateCall |
createSingleArgAggCall(String funcName,
org.apache.calcite.plan.RelOptCluster cluster,
PrimitiveTypeInfo typeInfo,
Integer pos,
org.apache.calcite.rel.type.RelDataType aggFnRetType) |
static HiveTableFunctionScan |
createUDTFForSetOp(org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.rel.RelNode input) |
static <T> com.google.common.collect.ImmutableMap<Integer,T> |
getColInfoMap(List<T> hiveCols,
int startIndx) |
static com.google.common.collect.ImmutableMap<String,Integer> |
getColNameIndxMap(List<FieldSchema> tableFields) |
List<org.apache.calcite.rex.RexNode> |
getDeterministicFuncWithSingleInputRef(List<org.apache.calcite.rex.RexNode> exprs,
Set<Integer> validInputRefs) |
static ExprNodeDesc |
getExprNode(Integer inputRefIndx,
org.apache.calcite.rel.RelNode inputRel,
ExprNodeConverter exprConv) |
static List<ExprNodeDesc> |
getExprNodes(List<Integer> inputRefs,
org.apache.calcite.rel.RelNode inputRel,
String inputTabAlias) |
static List<String> |
getFieldNames(List<Integer> inputRefs,
org.apache.calcite.rel.RelNode inputRel) |
static com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
getInputRef(List<Integer> inputRefs,
org.apache.calcite.rel.RelNode inputRel) |
static Set<Integer> |
getInputRefs(org.apache.calcite.rex.RexNode expr) |
static com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
getPredsNotPushedAlready(org.apache.calcite.rel.RelNode inp,
List<org.apache.calcite.rex.RexNode> predsToPushDown) |
static com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
getPredsNotPushedAlready(Set<String> predicatesToExclude,
org.apache.calcite.rel.RelNode inp,
List<org.apache.calcite.rex.RexNode> predsToPushDown)
Given a list of predicates to push down, this methods returns the set of predicates
that still need to be pushed.
|
static List<org.apache.calcite.rex.RexNode> |
getProjsFromBelowAsInputRef(org.apache.calcite.rel.RelNode rel) |
static com.google.common.collect.ImmutableMap<String,Integer> |
getRowColNameIndxMap(List<org.apache.calcite.rel.type.RelDataTypeField> rowFields) |
static org.apache.calcite.util.Pair<org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode> |
getTopLevelSelect(org.apache.calcite.rel.RelNode rootRel)
Get top level select starting from root.
|
static org.apache.calcite.rex.RexNode |
getTypeSafePred(org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.rex.RexNode rex,
org.apache.calcite.rel.type.RelDataType rType) |
static com.google.common.collect.ImmutableMap<Integer,VirtualColumn> |
getVColsMap(List<VirtualColumn> hiveVCols,
int startIndx) |
static List<Integer> |
getVirtualCols(List<? extends org.apache.calcite.rex.RexNode> exps)
Get list of virtual columns from the given list of projections.
|
static boolean |
isComparisonOp(org.apache.calcite.rex.RexCall call) |
static boolean |
isDeterministic(org.apache.calcite.rex.RexNode expr) |
static boolean |
isDeterministicFuncOnLiterals(org.apache.calcite.rex.RexNode expr) |
static boolean |
isDeterministicFuncWithSingleInputRef(org.apache.calcite.rex.RexNode expr,
Set<Integer> validInputRefs) |
static boolean |
limitRelNode(org.apache.calcite.rel.RelNode rel) |
static boolean |
orderRelNode(org.apache.calcite.rel.RelNode rel) |
static org.apache.calcite.rex.RexNode |
projectNonColumnEquiConditions(org.apache.calcite.rel.core.RelFactories.ProjectFactory factory,
org.apache.calcite.rel.RelNode[] inputRels,
List<org.apache.calcite.rex.RexNode> leftJoinKeys,
List<org.apache.calcite.rex.RexNode> rightJoinKeys,
int systemColCount,
List<Integer> leftKeys,
List<Integer> rightKeys)
Push any equi join conditions that are not column references as Projections
on top of the children.
|
static boolean |
pureLimitRelNode(org.apache.calcite.rel.RelNode rel) |
static boolean |
pureOrderRelNode(org.apache.calcite.rel.RelNode rel) |
static com.google.common.collect.ImmutableSet<Integer> |
shiftVColsSet(Set<Integer> hiveVCols,
int shift) |
static List<Integer> |
translateBitSetToProjIndx(org.apache.calcite.util.ImmutableBitSet projBitSet) |
static boolean |
validateASTForUnsupportedTokens(ASTNode ast) |
public static final com.google.common.base.Function<org.apache.calcite.rex.RexNode,String> REX_STR_FN
public static List<Integer> getVirtualCols(List<? extends org.apache.calcite.rex.RexNode> exps)
exps
- list of rex nodes representing projectionspublic static boolean validateASTForUnsupportedTokens(ASTNode ast)
public static List<org.apache.calcite.rex.RexNode> getProjsFromBelowAsInputRef(org.apache.calcite.rel.RelNode rel)
public static List<Integer> translateBitSetToProjIndx(org.apache.calcite.util.ImmutableBitSet projBitSet)
public static org.apache.calcite.rex.RexNode projectNonColumnEquiConditions(org.apache.calcite.rel.core.RelFactories.ProjectFactory factory, org.apache.calcite.rel.RelNode[] inputRels, List<org.apache.calcite.rex.RexNode> leftJoinKeys, List<org.apache.calcite.rex.RexNode> rightJoinKeys, int systemColCount, List<Integer> leftKeys, List<Integer> rightKeys)
factory
- Project factory to use.inputRels
- inputs to a joinleftJoinKeys
- expressions for LHS of join keyrightJoinKeys
- expressions for RHS of join keysystemColCount
- number of system columns, usually zero. These columns are
projected at the leading edge of the output row.leftKeys
- on return this contains the join key positions from the new
project rel on the LHS.rightKeys
- on return this contains the join key positions from the new
project rel on the RHS.public static boolean pureLimitRelNode(org.apache.calcite.rel.RelNode rel)
public static boolean pureOrderRelNode(org.apache.calcite.rel.RelNode rel)
public static boolean limitRelNode(org.apache.calcite.rel.RelNode rel)
public static boolean orderRelNode(org.apache.calcite.rel.RelNode rel)
public static org.apache.calcite.util.Pair<org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode> getTopLevelSelect(org.apache.calcite.rel.RelNode rootRel)
rootRel
- public static boolean isComparisonOp(org.apache.calcite.rex.RexCall call)
public static com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> getPredsNotPushedAlready(org.apache.calcite.rel.RelNode inp, List<org.apache.calcite.rex.RexNode> predsToPushDown)
public static com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> getPredsNotPushedAlready(Set<String> predicatesToExclude, org.apache.calcite.rel.RelNode inp, List<org.apache.calcite.rex.RexNode> predsToPushDown)
predicatesToExclude
- String representation of predicates that should be excludedinp
- root of the subtreepredsToPushDown
- candidate predicates to push down through the subtreepublic static org.apache.calcite.rex.RexNode getTypeSafePred(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.rex.RexNode rex, org.apache.calcite.rel.type.RelDataType rType)
public static boolean isDeterministic(org.apache.calcite.rex.RexNode expr)
public static boolean isDeterministicFuncOnLiterals(org.apache.calcite.rex.RexNode expr)
public List<org.apache.calcite.rex.RexNode> getDeterministicFuncWithSingleInputRef(List<org.apache.calcite.rex.RexNode> exprs, Set<Integer> validInputRefs)
public static boolean isDeterministicFuncWithSingleInputRef(org.apache.calcite.rex.RexNode expr, Set<Integer> validInputRefs)
public static <T> com.google.common.collect.ImmutableMap<Integer,T> getColInfoMap(List<T> hiveCols, int startIndx)
public static com.google.common.collect.ImmutableSet<Integer> shiftVColsSet(Set<Integer> hiveVCols, int shift)
public static com.google.common.collect.ImmutableMap<Integer,VirtualColumn> getVColsMap(List<VirtualColumn> hiveVCols, int startIndx)
public static com.google.common.collect.ImmutableMap<String,Integer> getColNameIndxMap(List<FieldSchema> tableFields)
public static com.google.common.collect.ImmutableMap<String,Integer> getRowColNameIndxMap(List<org.apache.calcite.rel.type.RelDataTypeField> rowFields)
public static com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> getInputRef(List<Integer> inputRefs, org.apache.calcite.rel.RelNode inputRel)
public static ExprNodeDesc getExprNode(Integer inputRefIndx, org.apache.calcite.rel.RelNode inputRel, ExprNodeConverter exprConv)
public static List<ExprNodeDesc> getExprNodes(List<Integer> inputRefs, org.apache.calcite.rel.RelNode inputRel, String inputTabAlias)
public static List<String> getFieldNames(List<Integer> inputRefs, org.apache.calcite.rel.RelNode inputRel)
public static org.apache.calcite.rel.core.AggregateCall createSingleArgAggCall(String funcName, org.apache.calcite.plan.RelOptCluster cluster, PrimitiveTypeInfo typeInfo, Integer pos, org.apache.calcite.rel.type.RelDataType aggFnRetType)
public static HiveTableFunctionScan createUDTFForSetOp(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.rel.RelNode input) throws SemanticException
SemanticException
public static HiveProject createProjectWithoutColumn(org.apache.calcite.rel.RelNode input, Set<Integer> positions) throws CalciteSemanticException
CalciteSemanticException
Copyright © 2021 The Apache Software Foundation. All rights reserved.