|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer
public abstract class BaseSemanticAnalyzer
BaseSemanticAnalyzer.
| Nested Class Summary | |
|---|---|
static class |
BaseSemanticAnalyzer.tableSpec
tableSpec. |
| Field Summary | |
|---|---|
protected ColumnAccessInfo |
columnAccessInfo
|
protected HiveConf |
conf
|
protected SessionState.LogHelper |
console
|
protected Context |
ctx
|
protected Hive |
db
|
protected FetchTask |
fetchTask
|
static int |
HIVE_COLUMN_ORDER_ASC
|
static int |
HIVE_COLUMN_ORDER_DESC
|
protected HashMap<String,String> |
idToTableNameMap
|
protected HashSet<ReadEntity> |
inputs
ReadEntitites that are passed to the hooks. |
protected LineageInfo |
linfo
Lineage information for the query. |
protected org.apache.commons.logging.Log |
LOG
|
protected static String |
ORCFILE_INPUT
|
protected static String |
ORCFILE_OUTPUT
|
protected static String |
ORCFILE_SERDE
|
protected HashSet<WriteEntity> |
outputs
List of WriteEntities that are passed to the hooks. |
protected static String |
PARQUETFILE_INPUT
|
protected static String |
PARQUETFILE_OUTPUT
|
protected static String |
PARQUETFILE_SERDE
|
protected QueryProperties |
queryProperties
|
protected static String |
RCFILE_INPUT
|
protected static String |
RCFILE_OUTPUT
|
protected List<Task<? extends Serializable>> |
rootTasks
|
protected static String |
SEQUENCEFILE_INPUT
|
protected static String |
SEQUENCEFILE_OUTPUT
|
protected TableAccessInfo |
tableAccessInfo
|
protected static String |
TEXTFILE_INPUT
|
protected static String |
TEXTFILE_OUTPUT
|
| Constructor Summary | |
|---|---|
BaseSemanticAnalyzer(HiveConf conf)
|
|
BaseSemanticAnalyzer(HiveConf conf,
Hive db)
|
|
| Method Summary | |
|---|---|
void |
analyze(ASTNode ast,
Context ctx)
|
protected void |
analyzeDDLSkewedValues(List<List<String>> skewedValues,
ASTNode child)
Handle skewed values in DDL. |
abstract void |
analyzeInternal(ASTNode ast)
|
protected List<String> |
analyzeSkewedTablDDLColNames(List<String> skewedColNames,
ASTNode child)
Analyze list bucket column names |
protected boolean |
analyzeStoredAdDirs(ASTNode child)
process stored as directories |
static String |
charSetString(String charSetName,
String charSetString)
|
protected ListBucketingCtx |
constructListBucketingCtx(List<String> skewedColNames,
List<List<String>> skewedValues,
Map<List<String>,String> skewedColValueLocationMaps,
boolean isStoredAsSubDirectories,
HiveConf conf)
Construct list bucketing context. |
protected static Hive |
createHiveDB(HiveConf conf)
|
protected HashMap<String,String> |
extractPartitionSpecs(org.antlr.runtime.tree.Tree partspec)
|
ColumnAccessInfo |
getColumnAccessInfo()
Gets the column access information. |
static List<String> |
getColumnNames(ASTNode ast)
|
protected List<Order> |
getColumnNamesOrder(ASTNode ast)
|
protected List<FieldSchema> |
getColumns(ASTNode ast)
|
static List<FieldSchema> |
getColumns(ASTNode ast,
boolean lowerCase)
Get the list of FieldSchema out of the ASTNode. |
protected Database |
getDatabase(String dbName)
|
protected Database |
getDatabase(String dbName,
boolean throwException)
|
Hive |
getDb()
|
FetchTask |
getFetchTask()
|
HashMap<String,String> |
getIdToTableNameMap()
|
HashSet<ReadEntity> |
getInputs()
|
LineageInfo |
getLineageInfo()
Gets the lineage information. |
HashSet<WriteEntity> |
getOutputs()
|
protected Partition |
getPartition(Table table,
Map<String,String> partSpec,
boolean throwException)
|
protected List<Partition> |
getPartitions(Table table,
Map<String,String> partSpec,
boolean throwException)
|
QueryProperties |
getQueryProperties()
|
List<FieldSchema> |
getResultSchema()
|
List<Task<? extends Serializable>> |
getRootTasks()
|
protected List<String> |
getSkewedValueFromASTNode(ASTNode ast)
Given a ASTNode, return list of values. |
protected List<String> |
getSkewedValuesFromASTNode(Node node)
Retrieve skewed values from ASTNode. |
protected Table |
getTable(String tblName)
|
protected Table |
getTable(String tblName,
boolean throwException)
|
protected Table |
getTable(String database,
String tblName,
boolean throwException)
|
TableAccessInfo |
getTableAccessInfo()
Gets the table access information. |
protected Table |
getTableWithQN(String qnName,
boolean throwException)
|
protected static String |
getTypeStringFromAST(ASTNode typeNode)
|
static String |
getUnescapedName(ASTNode tableOrColumnNode)
Get dequoted name from a table/column node. |
static String |
getUnescapedName(ASTNode tableOrColumnNode,
String currentDatabase)
|
static String |
getUnescapedUnqualifiedTableName(ASTNode node)
Get the unqualified name from a table node. |
protected void |
handleGenericFileFormat(ASTNode node)
|
void |
init()
|
void |
initCtx(Context ctx)
|
boolean |
isValidPrefixSpec(Table tTable,
Map<String,String> spec)
Checks if given specification is proper specification for prefix of partition cols, for table partitioned by ds, hr, min valid ones are (ds='2008-04-08'), (ds='2008-04-08', hr='12'), (ds='2008-04-08', hr='12', min='30') invalid one is for example (ds='2008-04-08', min='30') |
static void |
readProps(ASTNode prop,
Map<String,String> mapProp)
Converts parsed key/value properties pairs into a map. |
protected void |
reset()
|
void |
setColumnAccessInfo(ColumnAccessInfo columnAccessInfo)
Sets the column access information. |
void |
setFetchTask(FetchTask fetchTask)
|
void |
setLineageInfo(LineageInfo linfo)
Sets the lineage information. |
void |
setTableAccessInfo(TableAccessInfo tableAccessInfo)
Sets the table access information. |
static String |
stripIdentifierQuotes(String val)
|
static String |
stripQuotes(String val)
|
protected String |
toMessage(ErrorMsg message,
Object detail)
|
static String |
unescapeIdentifier(String val)
Remove the encapsulating "`" pair from the identifier. |
static String |
unescapeSQLString(String b)
|
void |
validate()
|
static void |
validatePartSpec(Table tbl,
Map<String,String> partSpec,
ASTNode astNode,
HiveConf conf,
boolean shouldBeFull)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Hive db
protected final HiveConf conf
protected List<Task<? extends Serializable>> rootTasks
protected FetchTask fetchTask
protected final org.apache.commons.logging.Log LOG
protected final SessionState.LogHelper console
protected Context ctx
protected HashMap<String,String> idToTableNameMap
protected QueryProperties queryProperties
public static int HIVE_COLUMN_ORDER_ASC
public static int HIVE_COLUMN_ORDER_DESC
protected HashSet<ReadEntity> inputs
protected HashSet<WriteEntity> outputs
protected LineageInfo linfo
protected TableAccessInfo tableAccessInfo
protected ColumnAccessInfo columnAccessInfo
protected static final String TEXTFILE_INPUT
protected static final String TEXTFILE_OUTPUT
protected static final String SEQUENCEFILE_INPUT
protected static final String SEQUENCEFILE_OUTPUT
protected static final String RCFILE_INPUT
protected static final String RCFILE_OUTPUT
protected static final String ORCFILE_INPUT
protected static final String ORCFILE_OUTPUT
protected static final String ORCFILE_SERDE
protected static final String PARQUETFILE_INPUT
protected static final String PARQUETFILE_OUTPUT
protected static final String PARQUETFILE_SERDE
| Constructor Detail |
|---|
public BaseSemanticAnalyzer(HiveConf conf)
throws SemanticException
SemanticException
public BaseSemanticAnalyzer(HiveConf conf,
Hive db)
throws SemanticException
SemanticException| Method Detail |
|---|
protected static Hive createHiveDB(HiveConf conf)
throws SemanticException
SemanticExceptionpublic HashMap<String,String> getIdToTableNameMap()
public abstract void analyzeInternal(ASTNode ast)
throws SemanticException
SemanticExceptionpublic void init()
public void initCtx(Context ctx)
public void analyze(ASTNode ast,
Context ctx)
throws SemanticException
SemanticException
public void validate()
throws SemanticException
SemanticExceptionpublic List<Task<? extends Serializable>> getRootTasks()
public FetchTask getFetchTask()
public void setFetchTask(FetchTask fetchTask)
fetchTask - the fetchTask to setprotected void reset()
public static String stripIdentifierQuotes(String val)
public static String stripQuotes(String val)
public static String charSetString(String charSetName,
String charSetString)
throws SemanticException
SemanticExceptionpublic static String getUnescapedName(ASTNode tableOrColumnNode)
tableOrColumnNode - the table or column node
public static String getUnescapedName(ASTNode tableOrColumnNode,
String currentDatabase)
public static String getUnescapedUnqualifiedTableName(ASTNode node)
node - the table node
public static String unescapeIdentifier(String val)
public static void readProps(ASTNode prop,
Map<String,String> mapProp)
prop - ASTNode parent of the key/value pairsmapProp - property map which receives the mappingspublic static String unescapeSQLString(String b)
public HashSet<ReadEntity> getInputs()
public HashSet<WriteEntity> getOutputs()
public List<FieldSchema> getResultSchema()
protected List<FieldSchema> getColumns(ASTNode ast)
throws SemanticException
SemanticException
protected void handleGenericFileFormat(ASTNode node)
throws SemanticException
SemanticException
public static List<FieldSchema> getColumns(ASTNode ast,
boolean lowerCase)
throws SemanticException
SemanticExceptionpublic static List<String> getColumnNames(ASTNode ast)
protected List<Order> getColumnNamesOrder(ASTNode ast)
protected static String getTypeStringFromAST(ASTNode typeNode)
throws SemanticException
SemanticExceptionpublic LineageInfo getLineageInfo()
public void setLineageInfo(LineageInfo linfo)
linfo - The LineageInfo structure that is set in the optimization phase.public TableAccessInfo getTableAccessInfo()
public void setTableAccessInfo(TableAccessInfo tableAccessInfo)
taInfo - The TableAccessInfo structure that is set in the optimization phase.public ColumnAccessInfo getColumnAccessInfo()
public void setColumnAccessInfo(ColumnAccessInfo columnAccessInfo)
columnAccessInfo - The ColumnAccessInfo structure that is set immediately after
the optimization phase.
protected HashMap<String,String> extractPartitionSpecs(org.antlr.runtime.tree.Tree partspec)
throws SemanticException
SemanticException
public final boolean isValidPrefixSpec(Table tTable,
Map<String,String> spec)
throws HiveException
spec - specification key-value map
HiveExceptionpublic Hive getDb()
public QueryProperties getQueryProperties()
protected ListBucketingCtx constructListBucketingCtx(List<String> skewedColNames,
List<List<String>> skewedValues,
Map<List<String>,String> skewedColValueLocationMaps,
boolean isStoredAsSubDirectories,
HiveConf conf)
skewedColNames - skewedValues - skewedColValueLocationMaps - isStoredAsSubDirectories -
protected List<String> getSkewedValueFromASTNode(ASTNode ast)
ast -
protected List<String> getSkewedValuesFromASTNode(Node node)
throws SemanticException
node -
SemanticException
protected List<String> analyzeSkewedTablDDLColNames(List<String> skewedColNames,
ASTNode child)
throws SemanticException
skewedColNames - child -
SemanticException
protected void analyzeDDLSkewedValues(List<List<String>> skewedValues,
ASTNode child)
throws SemanticException
skewedValues - child -
SemanticExceptionprotected boolean analyzeStoredAdDirs(ASTNode child)
child -
public static void validatePartSpec(Table tbl,
Map<String,String> partSpec,
ASTNode astNode,
HiveConf conf,
boolean shouldBeFull)
throws SemanticException
SemanticException
protected Database getDatabase(String dbName)
throws SemanticException
SemanticException
protected Database getDatabase(String dbName,
boolean throwException)
throws SemanticException
SemanticException
protected Table getTable(String tblName)
throws SemanticException
SemanticException
protected Table getTable(String tblName,
boolean throwException)
throws SemanticException
SemanticException
protected Table getTableWithQN(String qnName,
boolean throwException)
throws SemanticException
SemanticException
protected Table getTable(String database,
String tblName,
boolean throwException)
throws SemanticException
SemanticException
protected Partition getPartition(Table table,
Map<String,String> partSpec,
boolean throwException)
throws SemanticException
SemanticException
protected List<Partition> getPartitions(Table table,
Map<String,String> partSpec,
boolean throwException)
throws SemanticException
SemanticException
protected String toMessage(ErrorMsg message,
Object detail)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||