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 |
protected List<FieldSchema> |
resultSchema |
static String |
SUBQUERY_TAG_1 |
static String |
SUBQUERY_TAG_2 |
protected TableMask |
tableMask |
protected HashMap<String,TableScanOperator> |
topOps |
protected UnparseTranslator |
unparseTranslator |
acidFileSinks, acidInQuery, cContext, columnAccessInfo, conf, console, ctx, db, fetchTask, HIVE_COLUMN_NULLS_FIRST, HIVE_COLUMN_NULLS_LAST, HIVE_COLUMN_ORDER_ASC, HIVE_COLUMN_ORDER_DESC, idToTableNameMap, inputs, linfo, LOG, outputs, queryProperties, queryState, rootTasks, STATIC_LOG, tableAccessInfo, updateColumnAccessInfo
Constructor and Description |
---|
SemanticAnalyzer(QueryState queryState) |
Modifier and Type | Method and Description |
---|---|
void |
analyzeInternal(ASTNode ast) |
protected void |
checkAcidTxnManager(Table table) |
protected boolean |
deleting() |
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) |
void |
doPhase1QBExpr(ASTNode ast,
QBExpr qbexpr,
String id,
String alias,
boolean insideView) |
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,
boolean useCaching) |
ExprNodeDesc |
genExprNodeDesc(ASTNode expr,
RowResolver input,
boolean useCaching,
boolean foldExpr) |
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) |
HashSet<ReadEntity> |
getAllInputs() |
HashSet<WriteEntity> |
getAllOutputs() |
List<Task<? extends Serializable>> |
getAllRootTasks() |
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) |
List<LoadFileDesc> |
getLoadFileWork() |
void |
getMaterializationMetadata(QB qb) |
void |
getMetaData(QB qb) |
void |
getMetaData(QB qb,
boolean enableMaterialization) |
CompilationOpContext |
getOpContext() |
ParseContext |
getParseContext() |
QB |
getQB() |
List<FieldSchema> |
getResultSchema() |
RowResolver |
getRowResolver(Operator opt)
Get the row resolver given an operator.
|
static GenericUDAFEvaluator.Mode |
groupByDescModeToUDAFMode(GroupByDesc.Mode mode,
boolean isDistinct) |
RowResolver |
handleInsertStatementSpec(List<ExprNodeDesc> col_list,
String dest,
RowResolver outputRR,
RowResolver inputRR,
QB qb,
ASTNode selExprList)
This modifies the Select projections when the Select is part of an insert statement and
the insert statement specifies a column list for the target table, e.g.
|
void |
init(boolean clearPartsCache) |
void |
initParseCtx(ParseContext pctx) |
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx |
initPhase1Ctx() |
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) |
ASTNode |
rewriteASTWithMaskAndFilter(ASTNode ast) |
protected void |
setAST(ASTNode newAST) |
static int |
setBit(int bitmap,
int bitIdx) |
void |
setLoadFileWork(List<LoadFileDesc> loadFileWork) |
void |
setQB(QB qb) |
protected boolean |
updating() |
void |
validate() |
analyze, analyzeDDLSkewedValues, analyzeSkewedTablDDLColNames, analyzeStoredAdDirs, charSetString, constructListBucketingCtx, createHiveDB, escapeSQLString, getAcidFileSinks, getAutoCommitValue, getColumnAccessInfo, getColumnNames, getColumnNamesOrder, getColumns, getColumns, getColumns, getDatabase, getDatabase, getDb, getDbTableNamePair, getDotName, getFetchTask, getIdToTableNameMap, getInputs, getLineageInfo, getOutputs, getPartition, getPartitions, getQualifiedTableName, getQueryProperties, getQueryState, getRootTasks, getSkewedValueFromASTNode, getSkewedValuesFromASTNode, getTable, getTable, getTable, getTable, getTable, getTableAccessInfo, getTypeStringFromAST, getUnescapedName, getUnescapedName, getUnescapedUnqualifiedTableName, getUpdateColumnAccessInfo, hasAcidInQuery, initCtx, isValidPrefixSpec, processForeignKeys, processPrimaryKeys, 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,TableScanOperator> topOps
protected LinkedHashMap<Operator<? extends OperatorDesc>,OpParseContext> opParseCtx
protected List<FieldSchema> resultSchema
protected final UnparseTranslator unparseTranslator
protected boolean noscan
protected boolean partialscan
protected volatile boolean disableJoinMerge
protected TableMask tableMask
protected BaseSemanticAnalyzer.AnalyzeRewriteContext analyzeRewrite
public SemanticAnalyzer(QueryState queryState) throws SemanticException
SemanticException
protected void reset(boolean clearPartsCache)
reset
in class BaseSemanticAnalyzer
public void initParseCtx(ParseContext pctx)
public ParseContext getParseContext()
public CompilationOpContext getOpContext()
public void doPhase1QBExpr(ASTNode ast, QBExpr qbexpr, String id, String alias) throws SemanticException
SemanticException
public void doPhase1QBExpr(ASTNode ast, QBExpr qbexpr, String id, String alias, boolean insideView) throws SemanticException
SemanticException
protected void setAST(ASTNode newAST)
public List<Task<? extends Serializable>> getAllRootTasks()
getAllRootTasks
in class BaseSemanticAnalyzer
public HashSet<ReadEntity> getAllInputs()
getAllInputs
in class BaseSemanticAnalyzer
public HashSet<WriteEntity> getAllOutputs()
getAllOutputs
in class BaseSemanticAnalyzer
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 void getMaterializationMetadata(QB qb) throws SemanticException
SemanticException
public void getMetaData(QB qb) throws SemanticException
SemanticException
public void getMetaData(QB qb, boolean enableMaterialization) 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 RowResolver handleInsertStatementSpec(List<ExprNodeDesc> col_list, String dest, RowResolver outputRR, RowResolver inputRR, QB qb, ASTNode selExprList) throws SemanticException
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
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 ASTNode rewriteASTWithMaskAndFilter(ASTNode ast) throws SemanticException
SemanticException
public List<FieldSchema> getResultSchema()
getResultSchema
in class BaseSemanticAnalyzer
public ExprNodeDesc genExprNodeDesc(ASTNode expr, RowResolver input) throws SemanticException
SemanticException
public ExprNodeDesc genExprNodeDesc(ASTNode expr, RowResolver input, boolean useCaching) throws SemanticException
SemanticException
public ExprNodeDesc genExprNodeDesc(ASTNode expr, RowResolver input, boolean useCaching, boolean foldExpr) 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
protected boolean updating()
protected boolean deleting()
protected void checkAcidTxnManager(Table table) throws SemanticException
SemanticException
public static ASTNode genSelectDIAST(RowResolver rr)
public List<LoadFileDesc> getLoadFileWork()
public void setLoadFileWork(List<LoadFileDesc> loadFileWork)
Copyright © 2016 The Apache Software Foundation. All rights reserved.