org.apache.hadoop.hive.ql.parse
Class SemanticAnalyzer
java.lang.Object
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer
- Direct Known Subclasses:
- ColumnStatsSemanticAnalyzer
public class SemanticAnalyzer
- extends BaseSemanticAnalyzer
Implementation of the semantic analyzer.
Fields inherited from class org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer |
COLUMNAR_SERDE, conf, console, ctx, db, fetchTask, HIVE_COLUMN_ORDER_ASC, HIVE_COLUMN_ORDER_DESC, idToTableNameMap, inputs, linfo, LOG, outputs, queryProperties, RCFILE_INPUT, RCFILE_OUTPUT, rootTasks, SEQUENCEFILE_INPUT, SEQUENCEFILE_OUTPUT, tableAccessInfo, TEXTFILE_INPUT, TEXTFILE_OUTPUT |
Method Summary |
void |
analyzeInternal(ASTNode ast)
|
boolean |
doPhase1(ASTNode ast,
QB qb,
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx ctx_1)
Phase 1: (including, but not limited to):
1. |
void |
doPhase1QBExpr(ASTNode ast,
QBExpr qbexpr,
String id,
String alias)
|
static String |
generateErrorMessage(ASTNode ast,
String message)
|
ExprNodeDesc |
genExprNodeDesc(ASTNode expr,
RowResolver input)
Generates an expression node descriptor for the expression passed in the
arguments. |
ExprNodeDesc |
genExprNodeDesc(ASTNode expr,
RowResolver input,
TypeCheckCtx tcCtx)
Generates an expression node descriptor for the expression passed in the
arguments. |
Operator |
genPlan(QB qb)
|
static String |
getColumnInternalName(int pos)
|
void |
getMetaData(QB qb)
|
ParseContext |
getParseContext()
|
QB |
getQB()
|
List<FieldSchema> |
getResultSchema()
|
RowResolver |
getRowResolver(Operator opt)
Get the row resolver given an operator. |
void |
init()
|
void |
initParseCtx(ParseContext pctx)
|
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx |
initPhase1Ctx()
|
|
putOpInsertMap(Operator<T> op,
RowResolver rr)
|
protected void |
reset()
|
void |
setQB(QB qb)
|
void |
validate()
|
Methods inherited from class org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer |
analyze, analyzeDDLSkewedValues, analyzeSkewedTablDDLColNames, analyzeStoredAdDirs, charSetString, extractPartitionSpecs, getColumnNames, getColumnNamesOrder, getColumns, getColumns, getDb, getFetchTask, getIdToTableNameMap, getInputs, getLineageInfo, getOutputs, getQueryProperties, getRootTasks, getSkewedValueFromASTNode, getSkewedValuesFromASTNode, getTableAccessInfo, getTypeStringFromAST, getUnescapedName, getUnescapedName, getUnescapedUnqualifiedTableName, handleGenericFileFormat, initCtx, isValidPrefixSpec, readProps, setFetchTask, setLineageInfo, setTableAccessInfo, stripQuotes, unescapeIdentifier, unescapeSQLString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SemanticAnalyzer
public SemanticAnalyzer(HiveConf conf)
throws SemanticException
- Throws:
SemanticException
reset
protected void reset()
- Overrides:
reset
in class BaseSemanticAnalyzer
initParseCtx
public void initParseCtx(ParseContext pctx)
getParseContext
public ParseContext getParseContext()
doPhase1QBExpr
public void doPhase1QBExpr(ASTNode ast,
QBExpr qbexpr,
String id,
String alias)
throws SemanticException
- Throws:
SemanticException
generateErrorMessage
public static String generateErrorMessage(ASTNode ast,
String message)
doPhase1
public boolean doPhase1(ASTNode ast,
QB qb,
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx ctx_1)
throws SemanticException
- Phase 1: (including, but not limited to):
1. Gets all the aliases for all the tables / subqueries and makes the
appropriate mapping in aliasToTabs, aliasToSubq 2. Gets the location of the
destination and names the clase "inclause" + i 3. Creates a map from a
string representation of an aggregation tree to the actual aggregation AST
4. Creates a mapping from the clause name to the select expression AST in
destToSelExpr 5. Creates a mapping from a table alias to the lateral view
AST's in aliasToLateralViews
- Parameters:
ast
- qb
- ctx_1
-
- Throws:
SemanticException
getMetaData
public void getMetaData(QB qb)
throws SemanticException
- Throws:
SemanticException
putOpInsertMap
public <T extends OperatorDesc> Operator<T> putOpInsertMap(Operator<T> op,
RowResolver rr)
getColumnInternalName
public static String getColumnInternalName(int pos)
genPlan
public Operator genPlan(QB qb)
throws SemanticException
- Throws:
SemanticException
initPhase1Ctx
public org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.Phase1Ctx initPhase1Ctx()
init
public void init()
- Overrides:
init
in class BaseSemanticAnalyzer
analyzeInternal
public void analyzeInternal(ASTNode ast)
throws SemanticException
- Specified by:
analyzeInternal
in class BaseSemanticAnalyzer
- Throws:
SemanticException
getResultSchema
public List<FieldSchema> getResultSchema()
- Overrides:
getResultSchema
in class BaseSemanticAnalyzer
- Returns:
- the schema for the fields which will be produced
when the statement is executed, or null if not known
genExprNodeDesc
public ExprNodeDesc genExprNodeDesc(ASTNode expr,
RowResolver input)
throws SemanticException
- Generates an expression node descriptor for the expression passed in the
arguments. This function uses the row resolver and the metadata information
that are passed as arguments to resolve the column names to internal names.
- Parameters:
expr
- The expressioninput
- The row resolver
- Returns:
- exprNodeDesc
- Throws:
SemanticException
genExprNodeDesc
public ExprNodeDesc genExprNodeDesc(ASTNode expr,
RowResolver input,
TypeCheckCtx tcCtx)
throws SemanticException
- Generates an expression node descriptor for the expression passed in the
arguments. This function uses the row resolver and the metadata information
that are passed as arguments to resolve the column names to internal names.
- Parameters:
expr
- The expressioninput
- The row resolvertcCtx
- Customized type-checking context
- Returns:
- exprNodeDesc
- Throws:
SemanticException
validate
public void validate()
throws SemanticException
- Overrides:
validate
in class BaseSemanticAnalyzer
- Throws:
SemanticException
getRowResolver
public RowResolver getRowResolver(Operator opt)
- Get the row resolver given an operator.
getQB
public QB getQB()
setQB
public void setQB(QB qb)
Copyright © 2013 The Apache Software Foundation