org.apache.hadoop.hive.ql.parse
Class BaseSemanticAnalyzer

java.lang.Object
  extended by org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer
Direct Known Subclasses:
DDLSemanticAnalyzer, ExplainSemanticAnalyzer, FunctionSemanticAnalyzer, LoadSemanticAnalyzer, SemanticAnalyzer

public abstract class BaseSemanticAnalyzer
extends Object


Nested Class Summary
static class BaseSemanticAnalyzer.tableSpec
           
 
Field Summary
protected static String COLUMNAR_SERDE
           
protected  HiveConf conf
           
protected  SessionState.LogHelper console
           
protected  Context ctx
           
protected  Hive db
           
protected  Task<? extends Serializable> fetchTask
           
protected  boolean fetchTaskInit
           
protected  HashMap<String,String> idToTableNameMap
           
protected  Set<ReadEntity> inputs
          ReadEntitites that are passed to the hooks.
protected  org.apache.commons.logging.Log LOG
           
protected  Set<WriteEntity> outputs
          List of WriteEntities that are passed to the hooks.
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 static String TEXTFILE_INPUT
           
protected static String TEXTFILE_OUTPUT
           
 
Constructor Summary
BaseSemanticAnalyzer(HiveConf conf)
           
 
Method Summary
 void analyze(ASTNode ast, Context ctx)
           
abstract  void analyzeInternal(ASTNode ast)
           
static String charSetString(String charSetName, String charSetString)
           
protected  List<String> getColumnNames(ASTNode ast)
           
protected  List<Order> getColumnNamesOrder(ASTNode ast)
           
protected  List<FieldSchema> getColumns(ASTNode ast)
          Get the list of FieldSchema out of the ASTNode.
 Task<? extends Serializable> getFetchTask()
           
 boolean getFetchTaskInit()
           
 HashMap<String,String> getIdToTableNameMap()
           
 Set<ReadEntity> getInputs()
           
 Set<WriteEntity> getOutputs()
           
 List<Task<? extends Serializable>> getRootTasks()
           
protected static String getTypeStringFromAST(ASTNode typeNode)
           
protected  void reset()
           
 void setFetchTask(Task<? extends Serializable> fetchTask)
           
 void setFetchTaskInit(boolean fetchTaskInit)
           
static String stripQuotes(String val)
           
static String unescapeIdentifier(String val)
          Remove the encapsulating "`" pair from the identifier.
static String unescapeSQLString(String b)
           
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

protected final Hive db

conf

protected final HiveConf conf

rootTasks

protected List<Task<? extends Serializable>> rootTasks

fetchTask

protected Task<? extends Serializable> fetchTask

fetchTaskInit

protected boolean fetchTaskInit

LOG

protected final org.apache.commons.logging.Log LOG

console

protected final SessionState.LogHelper console

ctx

protected Context ctx

idToTableNameMap

protected HashMap<String,String> idToTableNameMap

inputs

protected Set<ReadEntity> inputs
ReadEntitites that are passed to the hooks.


outputs

protected Set<WriteEntity> outputs
List of WriteEntities that are passed to the hooks.


TEXTFILE_INPUT

protected static final String TEXTFILE_INPUT

TEXTFILE_OUTPUT

protected static final String TEXTFILE_OUTPUT

SEQUENCEFILE_INPUT

protected static final String SEQUENCEFILE_INPUT

SEQUENCEFILE_OUTPUT

protected static final String SEQUENCEFILE_OUTPUT

RCFILE_INPUT

protected static final String RCFILE_INPUT

RCFILE_OUTPUT

protected static final String RCFILE_OUTPUT

COLUMNAR_SERDE

protected static final String COLUMNAR_SERDE
Constructor Detail

BaseSemanticAnalyzer

public BaseSemanticAnalyzer(HiveConf conf)
                     throws SemanticException
Throws:
SemanticException
Method Detail

getIdToTableNameMap

public HashMap<String,String> getIdToTableNameMap()

analyzeInternal

public abstract void analyzeInternal(ASTNode ast)
                              throws SemanticException
Throws:
SemanticException

analyze

public void analyze(ASTNode ast,
                    Context ctx)
             throws SemanticException
Throws:
SemanticException

validate

public void validate()
              throws SemanticException
Throws:
SemanticException

getRootTasks

public List<Task<? extends Serializable>> getRootTasks()

getFetchTask

public Task<? extends Serializable> getFetchTask()
Returns:
the fetchTask

setFetchTask

public void setFetchTask(Task<? extends Serializable> fetchTask)
Parameters:
fetchTask - the fetchTask to set

getFetchTaskInit

public boolean getFetchTaskInit()

setFetchTaskInit

public void setFetchTaskInit(boolean fetchTaskInit)

reset

protected void reset()

stripQuotes

public static String stripQuotes(String val)
                          throws SemanticException
Throws:
SemanticException

charSetString

public static String charSetString(String charSetName,
                                   String charSetString)
                            throws SemanticException
Throws:
SemanticException

unescapeIdentifier

public static String unescapeIdentifier(String val)
Remove the encapsulating "`" pair from the identifier. We allow users to use "`" to escape identifier for table names, column names and aliases, in case that coincide with Hive language keywords.


unescapeSQLString

public static String unescapeSQLString(String b)

getInputs

public Set<ReadEntity> getInputs()

getOutputs

public Set<WriteEntity> getOutputs()

getColumns

protected List<FieldSchema> getColumns(ASTNode ast)
                                throws SemanticException
Get the list of FieldSchema out of the ASTNode.

Throws:
SemanticException

getColumnNames

protected List<String> getColumnNames(ASTNode ast)

getColumnNamesOrder

protected List<Order> getColumnNamesOrder(ASTNode ast)

getTypeStringFromAST

protected static String getTypeStringFromAST(ASTNode typeNode)
                                      throws SemanticException
Throws:
SemanticException


Copyright © 2009 The Apache Software Foundation