public class PlannerUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PlannerUtil.JoinKeyPairFinder |
static class |
PlannerUtil.LogicalNodeReplaceVisitor |
static class |
PlannerUtil.RelationFinderVisitor |
| Modifier and Type | Field and Description |
|---|---|
static AggregationFunctionCallEval[] |
EMPTY_AGG_FUNCS |
static Column[] |
EMPTY_COLUMNS |
| Constructor and Description |
|---|
PlannerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
applySessionToTableProperties(OverridableConf sessionVars,
CatalogProtos.StoreType storeType,
KeyValueSet tableProperties) |
static void |
applySystemDefaultToTableProperties(OverridableConf systemConf,
TableMeta meta)
This method sets a set of table properties by System default configs.
|
static String |
buildExplainString(LogicalNode node)
Generate an explain string of a LogicalNode and its descendant nodes.
|
static boolean |
checkIfDDLPlan(LogicalNode node) |
static boolean |
checkIfNonFromQuery(LogicalPlan plan)
Checks whether the query has 'from clause' or not.
|
static boolean |
checkIfQueryTargetIsVirtualTable(LogicalPlan plan)
Checks whether the target of this query is a virtual table or not.
|
static boolean |
checkIfSetSession(LogicalNode node) |
static boolean |
checkIfSimpleQuery(LogicalPlan plan)
Checks whether the query is simple or not.
|
static <T extends LogicalNode> |
clone(LogicalPlan plan,
LogicalNode node) |
static SortSpec[] |
columnsToSortSpecs(Collection<Column> columns) |
static SortSpec[] |
columnsToSortSpecs(Column[] columns) |
static LogicalNode |
deleteNode(LogicalNode parent,
LogicalNode tobeRemoved)
Delete the logical node from a plan.
|
static boolean |
existsAggregationFunction(Expr expr) |
static boolean |
existsDistinctAggregationFunction(Expr expr) |
static LogicalNode[] |
findAllNodes(LogicalNode node,
NodeType... type)
Find the all logical node matched to type from the given node
|
static <T extends LogicalNode> |
findMostBottomNode(LogicalNode node,
NodeType type)
Find the most bottom logical node matched to type from the given node
|
static <T extends LogicalNode> |
findTopNode(LogicalNode node,
NodeType type)
Find the top logical node matched to type from the given node
|
static <T extends LogicalNode> |
findTopParentNode(LogicalNode node,
NodeType type)
Find a parent node of a given-typed operator.
|
static List<Column[]> |
getJoinKeyPairs(EvalNode joinQual,
Schema leftSchema,
Schema rightSchema,
boolean includeThetaJoin) |
static String[] |
getRelationLineage(LogicalNode from)
Get all RelationNodes which are descendant of a given LogicalNode.
|
static Collection<String> |
getRelationLineageWithinQueryBlock(LogicalPlan plan,
LogicalNode from)
Get all RelationNodes which are descendant of a given LogicalNode.
|
static SortSpec[][] |
getSortKeysFromJoinQual(EvalNode joinQual,
Schema outer,
Schema inner) |
static String |
getStoreTableName(LogicalPlan plan) |
static CatalogProtos.StoreType |
getStoreType(LogicalPlan plan) |
static TableDesc |
getTableDesc(CatalogService catalog,
LogicalNode node) |
static boolean |
isCommutativeJoin(JoinType joinType) |
static boolean |
isFileStorageType(CatalogProtos.StoreType storageType) |
static boolean |
isFileStorageType(String storageType) |
static Column[][] |
joinJoinKeyForEachTable(EvalNode joinQual,
Schema leftSchema,
Schema rightSchema,
boolean includeThetaJoin) |
static void |
replaceNode(LogicalNode plan,
LogicalNode newNode,
NodeType type) |
static void |
replaceNode(LogicalPlan plan,
LogicalNode startNode,
LogicalNode oldNode,
LogicalNode newNode) |
static SortSpec[] |
schemaToSortSpecs(Schema schema) |
static Target[] |
schemaToTargets(Schema schema) |
static void |
schemaToTargets(Schema schema,
Target[] targets)
fill targets with FieldEvals from a given schema
|
static Target[] |
schemaToTargetsWithGeneratedFields(Schema schema) |
static Schema |
sortSpecsToSchema(SortSpec[] sortSpecs) |
static Target[] |
stripTarget(Target[] sourceTargets)
It removes all table names from FieldEvals in targets
|
static Schema |
targetToSchema(Collection<Target> targets) |
static Schema |
targetToSchema(Target[] targets) |
static Collection<String> |
toQualifiedFieldNames(Collection<String> fieldNames,
String qualifier) |
public static final Column[] EMPTY_COLUMNS
public static final AggregationFunctionCallEval[] EMPTY_AGG_FUNCS
public static boolean checkIfSetSession(LogicalNode node)
public static boolean checkIfDDLPlan(LogicalNode node)
public static boolean checkIfSimpleQuery(LogicalPlan plan)
plan - The logical planpublic static boolean checkIfQueryTargetIsVirtualTable(LogicalPlan plan)
public static boolean checkIfNonFromQuery(LogicalPlan plan)
plan - The logical planpublic static String[] getRelationLineage(LogicalNode from)
from - The LogicalNode to start visiting LogicalNodes.public static Collection<String> getRelationLineageWithinQueryBlock(LogicalPlan plan, LogicalNode from) throws PlanningException
from - The LogicalNode to start visiting LogicalNodes.PlanningExceptionpublic static LogicalNode deleteNode(LogicalNode parent, LogicalNode tobeRemoved)
parent - this node must be a parent node of one node to be removed.tobeRemoved - this node must be a child node of the parent.public static void replaceNode(LogicalPlan plan, LogicalNode startNode, LogicalNode oldNode, LogicalNode newNode)
public static void replaceNode(LogicalNode plan, LogicalNode newNode, NodeType type)
public static <T extends LogicalNode> T findTopNode(LogicalNode node, NodeType type)
node - start nodetype - to findpublic static <T extends LogicalNode> T findMostBottomNode(LogicalNode node, NodeType type)
node - start nodetype - to findpublic static LogicalNode[] findAllNodes(LogicalNode node, NodeType... type)
node - start nodetype - to findpublic static <T extends LogicalNode> T findTopParentNode(LogicalNode node, NodeType type)
node - start nodetype - to findpublic static void schemaToTargets(Schema schema, Target[] targets)
schema - to be transformed to targetstargets - to be filledpublic static Target[] schemaToTargetsWithGeneratedFields(Schema schema)
public static SortSpec[] columnsToSortSpecs(Collection<Column> columns)
public static SortSpec[][] getSortKeysFromJoinQual(EvalNode joinQual, Schema outer, Schema inner)
public static Column[][] joinJoinKeyForEachTable(EvalNode joinQual, Schema leftSchema, Schema rightSchema, boolean includeThetaJoin)
public static List<Column[]> getJoinKeyPairs(EvalNode joinQual, Schema leftSchema, Schema rightSchema, boolean includeThetaJoin)
public static Schema targetToSchema(Collection<Target> targets)
public static Target[] stripTarget(Target[] sourceTargets)
sourceTargets - The targets to be strippedpublic static <T extends LogicalNode> T clone(LogicalPlan plan, LogicalNode node)
public static boolean isCommutativeJoin(JoinType joinType)
public static boolean existsAggregationFunction(Expr expr) throws PlanningException
PlanningExceptionpublic static boolean existsDistinctAggregationFunction(Expr expr) throws PlanningException
PlanningExceptionpublic static Collection<String> toQualifiedFieldNames(Collection<String> fieldNames, String qualifier)
public static String buildExplainString(LogicalNode node)
node - The LogicalNode instance to be startedpublic static void applySessionToTableProperties(OverridableConf sessionVars, CatalogProtos.StoreType storeType, KeyValueSet tableProperties)
public static void applySystemDefaultToTableProperties(OverridableConf systemConf, TableMeta meta)
systemConf - System configurationmeta - TableMeta to be setpublic static boolean isFileStorageType(String storageType)
public static boolean isFileStorageType(CatalogProtos.StoreType storageType)
public static CatalogProtos.StoreType getStoreType(LogicalPlan plan)
public static String getStoreTableName(LogicalPlan plan)
public static TableDesc getTableDesc(CatalogService catalog, LogicalNode node) throws IOException
IOExceptionCopyright © 2015 Apache Software Foundation. All Rights Reserved.