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

java.lang.Object
  extended by org.apache.hadoop.hive.ql.parse.RowResolver

public class RowResolver
extends Object

Implementation of the Row Resolver.


Constructor Summary
RowResolver()
           
 
Method Summary
 ColumnInfo get(String tab_alias, String col_alias)
          Gets the column Info to tab_alias.col_alias type of a column reference.
 ArrayList<ColumnInfo> getColumnInfos()
           
 ColumnInfo getExpression(ASTNode node)
          Retrieves the ColumnInfo corresponding to a source expression which exactly matches the string rendering of the given ASTNode.
 ASTNode getExpressionSource(ASTNode node)
          Retrieves the source expression matching a given ASTNode's string rendering exactly.
 HashMap<String,ColumnInfo> getFieldMap(String tabAlias)
           
 boolean getIsExprResolver()
           
 int getPosition(String internalName)
           
 Set<String> getTableNames()
           
 boolean hasTableAlias(String tab_alias)
           
 void put(String tab_alias, String col_alias, ColumnInfo colInfo)
           
 void putExpression(ASTNode node, ColumnInfo colInfo)
          Puts a resolver entry corresponding to a source expression which is to be used for identical expression recognition (e.g.
 String[] reverseLookup(String internalName)
           
 void setIsExprResolver(boolean isExprResolver)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowResolver

public RowResolver()
Method Detail

putExpression

public void putExpression(ASTNode node,
                          ColumnInfo colInfo)
Puts a resolver entry corresponding to a source expression which is to be used for identical expression recognition (e.g. for matching expressions in the SELECT list with the GROUP BY clause). The convention for such entries is an empty-string ("") as the table alias together with the string rendering of the ASTNode as the column alias.


getExpression

public ColumnInfo getExpression(ASTNode node)
                         throws SemanticException
Retrieves the ColumnInfo corresponding to a source expression which exactly matches the string rendering of the given ASTNode.

Throws:
SemanticException

getExpressionSource

public ASTNode getExpressionSource(ASTNode node)
Retrieves the source expression matching a given ASTNode's string rendering exactly.


put

public void put(String tab_alias,
                String col_alias,
                ColumnInfo colInfo)

hasTableAlias

public boolean hasTableAlias(String tab_alias)

get

public ColumnInfo get(String tab_alias,
                      String col_alias)
               throws SemanticException
Gets the column Info to tab_alias.col_alias type of a column reference. I the tab_alias is not provided as can be the case with an non aliased column, this function looks up the column in all the table aliases in this row resolver and returns the match. It also throws an exception if the column is found in multiple table aliases. If no match is found a null values is returned. This allows us to interpret both select t.c1 type of references and select c1 kind of refereneces. The later kind are what we call non aliased column references in the query.

Parameters:
tab_alias - The table alias to match (this is null if the column reference is non aliased)
col_alias - The column name that is being searched for
Returns:
ColumnInfo
Throws:
SemanticException

getColumnInfos

public ArrayList<ColumnInfo> getColumnInfos()

getFieldMap

public HashMap<String,ColumnInfo> getFieldMap(String tabAlias)

getPosition

public int getPosition(String internalName)

getTableNames

public Set<String> getTableNames()

reverseLookup

public String[] reverseLookup(String internalName)

setIsExprResolver

public void setIsExprResolver(boolean isExprResolver)

getIsExprResolver

public boolean getIsExprResolver()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 The Apache Software Foundation