public class SemanticAnalyzer extends BaseSemanticAnalyzer
Modifier and Type | Class and Description |
---|---|
static class |
SemanticAnalyzer.GenericUDAFInfo
Class to store GenericUDAF related information.
|
BaseSemanticAnalyzer.AnalyzeRewriteContext, BaseSemanticAnalyzer.TableSpec
Modifier and Type | Field and Description |
---|---|
protected BaseSemanticAnalyzer.AnalyzeRewriteContext |
analyzeRewrite |
protected boolean |
disableJoinMerge |
static String |
DUMMY_DATABASE |
static String |
DUMMY_TABLE |
protected boolean |
noscan |
protected LinkedHashMap<Operator<? extends OperatorDesc>,OpParseContext> |
opParseCtx |
protected boolean |
partialscan |
static String |
SUBQUERY_TAG_1 |
static String |
SUBQUERY_TAG_2 |
protected HashMap<String,Operator<? extends OperatorDesc>> |
topOps |
protected UnparseTranslator |
unparseTranslator |
acidFileSinks, columnAccessInfo, conf, console, ctx, db, fetchTask, HIVE_COLUMN_ORDER_ASC, HIVE_COLUMN_ORDER_DESC, idToTableNameMap, inputs, linfo, LOG, outputs, queryProperties, rootTasks, STATIC_LOG, tableAccessInfo, updateColumnAccessInfo
Constructor and Description |
---|
SemanticAnalyzer(HiveConf conf) |
Modifier and Type | Method and Description |
---|---|
void |
analyzeInternal(ASTNode ast) |
protected boolean |
deleting() |
protected static boolean |
distinctExprsExists(QB qb) |
boolean |
doPhase1(ASTNode ast,
QB qb,
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx ctx_1,
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.PlannerContext plannerCtx)
Phase 1: (including, but not limited to):
1.
|
void |
doPhase1QBExpr(ASTNode ast,
QBExpr qbexpr,
String id,
String alias) |
Map<ASTNode,ExprNodeDesc> |
genAllExprNodeDesc(ASTNode expr,
RowResolver input)
Generates an expression node descriptors for the expression and children of it
with default TypeCheckCtx.
|
Map<ASTNode,ExprNodeDesc> |
genAllExprNodeDesc(ASTNode expr,
RowResolver input,
TypeCheckCtx tcCtx)
Generates all of the expression node descriptors for the expression and children of it
passed in the arguments.
|
static String |
generateErrorMessage(ASTNode ast,
String message) |
ExprNodeDesc |
genExprNodeDesc(ASTNode expr,
RowResolver input)
Generates an expression node descriptor for the expression with TypeCheckCtx.
|
ExprNodeDesc |
genExprNodeDesc(ASTNode expr,
RowResolver input,
TypeCheckCtx tcCtx)
Returns expression node descriptor for the expression.
|
protected Operator |
genFileSinkPlan(String dest,
QB qb,
Operator input) |
Operator |
genPlan(QB qb) |
Operator |
genPlan(QB qb,
boolean skipAmbiguityCheck) |
static ASTNode |
genSelectDIAST(RowResolver rr) |
protected String |
getAliasId(String alias,
QB qb) |
static String |
getColumnInternalName(int pos) |
static GenericUDAFEvaluator |
getGenericUDAFEvaluator(String aggName,
ArrayList<ExprNodeDesc> aggParameters,
ASTNode aggTree,
boolean isDistinct,
boolean isAllColumns)
Returns the GenericUDAFEvaluator for the aggregation.
|
static SemanticAnalyzer.GenericUDAFInfo |
getGenericUDAFInfo(GenericUDAFEvaluator evaluator,
GenericUDAFEvaluator.Mode emode,
ArrayList<ExprNodeDesc> aggParameters)
Returns the GenericUDAFInfo struct for the aggregation.
|
protected List<Integer> |
getGroupingSets(List<ASTNode> groupByExpr,
QBParseInfo parseInfo,
String dest) |
protected List<Integer> |
getGroupingSetsForCube(int size) |
protected List<Integer> |
getGroupingSetsForRollup(int size) |
void |
getMetaData(QB qb) |
void |
getMetaData(QB qb,
ReadEntity parentInput) |
ParseContext |
getParseContext() |
QB |
getQB() |
List<FieldSchema> |
getResultSchema() |
RowResolver |
getRowResolver(Operator opt)
Get the row resolver given an operator.
|
Table |
getTable(TableScanOperator ts) |
static GenericUDAFEvaluator.Mode |
groupByDescModeToUDAFMode(GroupByDesc.Mode mode,
boolean isDistinct) |
void |
init(boolean clearPartsCache) |
void |
initParseCtx(ParseContext pctx) |
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx |
initPhase1Ctx() |
static boolean |
isAcidTable(Table tab) |
static ExprNodeDesc |
isConstantParameterInAggregationParameters(String internalName,
List<ExprNodeDesc> reduceValues)
Check if the given internalName represents a constant parameter in aggregation parameters
of an aggregation tree.
|
static ArrayList<WindowingSpec.WindowExpressionSpec> |
parseSelect(String selectExprStr) |
protected void |
processNoScanCommand(ASTNode tree)
process analyze ...
|
protected void |
processPartialScanCommand(ASTNode tree)
process analyze ...
|
<T extends OperatorDesc> |
putOpInsertMap(Operator<T> op,
RowResolver rr) |
protected void |
reset(boolean clearPartsCache) |
protected void |
setAST(ASTNode newAST) |
static int |
setBit(int bitmap,
int bitIdx) |
void |
setQB(QB qb) |
protected boolean |
updating() |
void |
validate() |
analyze, analyzeDDLSkewedValues, analyzeSkewedTablDDLColNames, analyzeStoredAdDirs, charSetString, constructListBucketingCtx, createHiveDB, escapeSQLString, getAcidFileSinks, getColumnAccessInfo, getColumnNames, getColumnNamesOrder, getColumns, getColumns, getDatabase, getDatabase, getDb, getDbTableNamePair, getDotName, getFetchTask, getIdToTableNameMap, getInputs, getLineageInfo, getOutputs, getPartition, getPartitions, getQualifiedTableName, getQueryProperties, getRootTasks, getSkewedValueFromASTNode, getSkewedValuesFromASTNode, getTable, getTable, getTable, getTable, getTable, getTableAccessInfo, getTypeStringFromAST, getUnescapedName, getUnescapedName, getUnescapedUnqualifiedTableName, getUpdateColumnAccessInfo, initCtx, isValidPrefixSpec, readProps, setColumnAccessInfo, setFetchTask, setLineageInfo, setTableAccessInfo, setUpdateColumnAccessInfo, skipAuthorization, stripIdentifierQuotes, stripQuotes, toMessage, toReadEntity, toReadEntity, toWriteEntity, toWriteEntity, unescapeIdentifier, unescapeSQLString, validatePartColumnType, validatePartSpec
public static final String DUMMY_DATABASE
public static final String DUMMY_TABLE
public static final String SUBQUERY_TAG_1
public static final String SUBQUERY_TAG_2
protected HashMap<String,Operator<? extends OperatorDesc>> topOps
protected LinkedHashMap<Operator<? extends OperatorDesc>,OpParseContext> opParseCtx
protected final UnparseTranslator unparseTranslator
protected boolean noscan
protected boolean partialscan
protected volatile boolean disableJoinMerge
protected BaseSemanticAnalyzer.AnalyzeRewriteContext analyzeRewrite
public SemanticAnalyzer(HiveConf conf) throws SemanticException
SemanticException
protected void reset(boolean clearPartsCache)
reset
in class BaseSemanticAnalyzer
public void initParseCtx(ParseContext pctx)
public ParseContext getParseContext()
public void doPhase1QBExpr(ASTNode ast, QBExpr qbexpr, String id, String alias) throws SemanticException
SemanticException
protected void setAST(ASTNode newAST)
public boolean doPhase1(ASTNode ast, QB qb, org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx ctx_1, org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.PlannerContext plannerCtx) throws SemanticException
ast
- qb
- ctx_1
- SemanticException
public Table getTable(TableScanOperator ts)
public void getMetaData(QB qb) throws SemanticException
SemanticException
public void getMetaData(QB qb, ReadEntity parentInput) throws SemanticException
SemanticException
public <T extends OperatorDesc> Operator<T> putOpInsertMap(Operator<T> op, RowResolver rr)
public static String getColumnInternalName(int pos)
protected List<Integer> getGroupingSets(List<ASTNode> groupByExpr, QBParseInfo parseInfo, String dest) throws SemanticException
SemanticException
public static int setBit(int bitmap, int bitIdx)
public static GenericUDAFEvaluator getGenericUDAFEvaluator(String aggName, ArrayList<ExprNodeDesc> aggParameters, ASTNode aggTree, boolean isDistinct, boolean isAllColumns) throws SemanticException
SemanticException
public static SemanticAnalyzer.GenericUDAFInfo getGenericUDAFInfo(GenericUDAFEvaluator evaluator, GenericUDAFEvaluator.Mode emode, ArrayList<ExprNodeDesc> aggParameters) throws SemanticException
aggName
- The name of the UDAF.aggParameters
- The exprNodeDesc of the original parametersaggTree
- The ASTNode node of the UDAF in the query.SemanticException
- when the UDAF is not found or has problems.public static GenericUDAFEvaluator.Mode groupByDescModeToUDAFMode(GroupByDesc.Mode mode, boolean isDistinct)
public static ExprNodeDesc isConstantParameterInAggregationParameters(String internalName, List<ExprNodeDesc> reduceValues)
reduceValues
- value columns of the corresponding ReduceSinkOperatorinternalName
- the internal name of this parameterprotected Operator genFileSinkPlan(String dest, QB qb, Operator input) throws SemanticException
SemanticException
protected static boolean distinctExprsExists(QB qb)
public Operator genPlan(QB qb) throws SemanticException
SemanticException
public Operator genPlan(QB qb, boolean skipAmbiguityCheck) throws SemanticException
SemanticException
public org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx initPhase1Ctx()
public void init(boolean clearPartsCache)
init
in class BaseSemanticAnalyzer
public void analyzeInternal(ASTNode ast) throws SemanticException
analyzeInternal
in class BaseSemanticAnalyzer
SemanticException
public List<FieldSchema> getResultSchema()
getResultSchema
in class BaseSemanticAnalyzer
public ExprNodeDesc genExprNodeDesc(ASTNode expr, RowResolver input) throws SemanticException
SemanticException
public Map<ASTNode,ExprNodeDesc> genAllExprNodeDesc(ASTNode expr, RowResolver input) throws SemanticException
SemanticException
public ExprNodeDesc genExprNodeDesc(ASTNode expr, RowResolver input, TypeCheckCtx tcCtx) throws SemanticException
SemanticException
public Map<ASTNode,ExprNodeDesc> genAllExprNodeDesc(ASTNode expr, RowResolver input, TypeCheckCtx tcCtx) throws SemanticException
expr
- The expressioninput
- The row resolvertcCtx
- Customized type-checking contextSemanticException
- Failed to evaluate expressionpublic void validate() throws SemanticException
validate
in class BaseSemanticAnalyzer
SemanticException
public RowResolver getRowResolver(Operator opt)
protected void processPartialScanCommand(ASTNode tree) throws SemanticException
tree
- SemanticException
protected void processNoScanCommand(ASTNode tree) throws SemanticException
tree
- SemanticException
public QB getQB()
public void setQB(QB qb)
public static ArrayList<WindowingSpec.WindowExpressionSpec> parseSelect(String selectExprStr) throws SemanticException
SemanticException
public static boolean isAcidTable(Table tab)
protected boolean updating()
protected boolean deleting()
public static ASTNode genSelectDIAST(RowResolver rr)
Copyright © 2017 The Apache Software Foundation. All rights reserved.