public final class HQLParser extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
HQLParser.ASTNodeVisitor |
static class |
HQLParser.HashableASTNode |
static class |
HQLParser.TreeNode |
Modifier and Type | Field and Description |
---|---|
static Set<Integer> |
ARITHMETIC_OPERATORS |
static Set<Integer> |
BINARY_OPERATORS |
static Set<Integer> |
FILTER_OPERATORS |
static Pattern |
P_WSPACE |
static Set<Integer> |
PRIMITIVE_TYPES |
static Set<Integer> |
UNARY_OPERATORS |
Modifier and Type | Method and Description |
---|---|
static void |
bft(org.apache.hadoop.hive.ql.parse.ASTNode root,
HQLParser.ASTNodeVisitor visitor)
Breadth first traversal of AST
|
static org.apache.hadoop.hive.ql.parse.ASTNode |
copyAST(org.apache.hadoop.hive.ql.parse.ASTNode original) |
static boolean |
equalsAST(org.apache.hadoop.hive.ql.parse.ASTNode n1,
org.apache.hadoop.hive.ql.parse.ASTNode n2) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
findNodeByPath(org.apache.hadoop.hive.ql.parse.ASTNode root,
int... path)
Find a node in the tree rooted at root, given the path of type of tokens from the root's children to the desired
node
|
static String |
getColName(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static Map<Integer,String> |
getHiveTokenMapping() |
static String |
getString(org.apache.hadoop.hive.ql.parse.ASTNode tree) |
static boolean |
hasAggregate(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isAggregateAST(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isArithmeticOp(int tokenType) |
static boolean |
isNonAggregateFunctionAST(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isSelectASTNode(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isTableColumnAST(org.apache.hadoop.hive.ql.parse.ASTNode astNode) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
leftMostChild(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static void |
main(String[] args) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
parseExpr(String expr) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
parseHQL(String query,
org.apache.hadoop.hive.conf.HiveConf conf) |
static void |
printAST(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static void |
printAST(Map<Integer,String> tokenMapping,
org.apache.hadoop.hive.ql.parse.ASTNode node,
int level,
int child)
Debug function for printing query AST to stdout
|
static void |
toInfixString(org.apache.hadoop.hive.ql.parse.ASTNode root,
StringBuilder buf)
Recursively reconstruct query string given a query AST
|
public static final Pattern P_WSPACE
public static boolean isTableColumnAST(org.apache.hadoop.hive.ql.parse.ASTNode astNode)
public static boolean isArithmeticOp(int tokenType)
public static org.apache.hadoop.hive.ql.parse.ASTNode parseHQL(String query, org.apache.hadoop.hive.conf.HiveConf conf) throws LensException
LensException
public static org.apache.hadoop.hive.ql.parse.ASTNode parseExpr(String expr) throws LensException
LensException
public static void printAST(org.apache.hadoop.hive.ql.parse.ASTNode node)
public static void printAST(Map<Integer,String> tokenMapping, org.apache.hadoop.hive.ql.parse.ASTNode node, int level, int child)
node
- level
- public static Map<Integer,String> getHiveTokenMapping() throws Exception
Exception
public static org.apache.hadoop.hive.ql.parse.ASTNode findNodeByPath(org.apache.hadoop.hive.ql.parse.ASTNode root, int... path)
root
- path
- starts at the level of root's childrenpublic static org.apache.hadoop.hive.ql.parse.ASTNode copyAST(org.apache.hadoop.hive.ql.parse.ASTNode original)
public static void bft(org.apache.hadoop.hive.ql.parse.ASTNode root, HQLParser.ASTNodeVisitor visitor) throws LensException
root
- visitor
- LensException
public static void toInfixString(org.apache.hadoop.hive.ql.parse.ASTNode root, StringBuilder buf)
root
- buf
- preallocated builder where the reconstructed string will be writtenpublic static String getString(org.apache.hadoop.hive.ql.parse.ASTNode tree)
public static String getColName(org.apache.hadoop.hive.ql.parse.ASTNode node)
public static boolean isAggregateAST(org.apache.hadoop.hive.ql.parse.ASTNode node)
public static boolean isNonAggregateFunctionAST(org.apache.hadoop.hive.ql.parse.ASTNode node)
public static boolean isSelectASTNode(org.apache.hadoop.hive.ql.parse.ASTNode node)
node
- an ASTNodepublic static boolean hasAggregate(org.apache.hadoop.hive.ql.parse.ASTNode node)
public static boolean equalsAST(org.apache.hadoop.hive.ql.parse.ASTNode n1, org.apache.hadoop.hive.ql.parse.ASTNode n2)
public static org.apache.hadoop.hive.ql.parse.ASTNode leftMostChild(org.apache.hadoop.hive.ql.parse.ASTNode node)
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.