public class ColumnarSQLRewriter extends Object implements QueryRewriter
| Constructor and Description | 
|---|
| ColumnarSQLRewriter()Instantiates a new columnar sql rewriter. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | analyzeInternal(org.apache.hadoop.conf.Configuration conf,
               org.apache.hadoop.hive.conf.HiveConf hconf)Analyze internal. | 
| void | buildQuery(org.apache.hadoop.conf.Configuration conf,
          org.apache.hadoop.hive.conf.HiveConf hconf)Builds the query. | 
| void | buildSubqueries(org.apache.hadoop.hive.ql.parse.ASTNode node)Builds the subqueries. | 
| StringBuilder | constructJoinChain()Construct join chain | 
| void | factFilterPushDown(org.apache.hadoop.hive.ql.parse.ASTNode node)Get fact filters for pushdown | 
| ArrayList<String> | getAggregateColumns(org.apache.hadoop.hive.ql.parse.ASTNode node)Gets the aggregate columns. | 
| void | getAllFactKeys()Get all fact keys used in all ASTs | 
| void | getAllFilters(org.apache.hadoop.hive.ql.parse.ASTNode node)Gets the all filters. | 
| String | getClause() | 
| int | getColumnCount(org.apache.hadoop.hive.ql.parse.ASTNode node)Get the count of columns in a given select expression | 
| String | getFactAlias()Get the fact alias | 
| void | getFactKeysFromNode(org.apache.hadoop.hive.ql.parse.ASTNode node)Get fact keys used in the AST | 
| String | getFactNameAlias(org.apache.hadoop.hive.ql.parse.ASTNode fromAST)Gets the fact name alias. | 
| void | getFilterInJoinCond(org.apache.hadoop.hive.ql.parse.ASTNode node)Gets the filter in join cond. | 
| void | getJoinCond(org.apache.hadoop.hive.ql.parse.ASTNode node)Gets the join cond. | 
| String | getLimitClause(org.apache.hadoop.hive.ql.parse.ASTNode node)Gets the limit clause. | 
| String | getTableFromTabRefNode(org.apache.hadoop.hive.ql.parse.ASTNode tree)Gets the table from tab ref node. | 
| String | getTableOrAlias(String keyString,
               String type)Get the table or alias from the given key string | 
| ArrayList<String> | getTablesAndColumns(org.apache.hadoop.hive.ql.parse.ASTNode node)Gets the tables and columns. | 
| void | init(org.apache.hadoop.conf.Configuration conf)Set conf for the rewriter | 
| boolean | isExpressionsUsed(org.apache.hadoop.hive.ql.parse.ASTNode node)Check if expression is used in select | 
| void | replaceAliasInAST()Replace alias in AST trees | 
| String | replaceUDFForDB(String query)Replace udf for db. | 
| void | reset()Reset. | 
| String | rewrite(String query,
       org.apache.hadoop.conf.Configuration conf,
       org.apache.hadoop.hive.conf.HiveConf metastoreConf)Rewrite. | 
public ColumnarSQLRewriter()
public void init(org.apache.hadoop.conf.Configuration conf)
QueryRewriterinit in interface QueryRewriterconf - Configuration required for rewriter initpublic String getClause()
public void analyzeInternal(org.apache.hadoop.conf.Configuration conf,
                   org.apache.hadoop.hive.conf.HiveConf hconf)
                     throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException - the semantic exceptionpublic String getTableFromTabRefNode(org.apache.hadoop.hive.ql.parse.ASTNode tree)
tree - the treepublic void getJoinCond(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic StringBuilder constructJoinChain()
public int getColumnCount(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - public boolean isExpressionsUsed(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - public void getFilterInJoinCond(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic String getFactAlias()
public void factFilterPushDown(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - public void getFactKeysFromNode(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - public void getAllFactKeys()
public void buildSubqueries(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic String getTableOrAlias(String keyString, String type)
keyString - type - public ArrayList<String> getAggregateColumns(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic ArrayList<String> getTablesAndColumns(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic String getLimitClause(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic void getAllFilters(org.apache.hadoop.hive.ql.parse.ASTNode node)
node - the nodepublic String getFactNameAlias(org.apache.hadoop.hive.ql.parse.ASTNode fromAST)
fromAST - the from astpublic void reset()
public String replaceUDFForDB(String query)
query - the querypublic void replaceAliasInAST()
public void buildQuery(org.apache.hadoop.conf.Configuration conf,
              org.apache.hadoop.hive.conf.HiveConf hconf)
                throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticExceptionpublic String rewrite(String query, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hive.conf.HiveConf metastoreConf) throws LensException
QueryRewriterrewrite in interface QueryRewriterquery - the queryconf - the query configurationmetastoreConf - The metastore configuration. If rewriters requires to access metastore, this configuration
  needs to passedLensException - the lens exceptionCopyright © 2014–2015 Apache Software Foundation. All rights reserved.