public final class HQLParser extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HQLParser.AppendMode |
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 Set<Integer> |
N_ARY_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 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 Set<String> |
getColsInExpr(String tableAlias,
org.apache.hadoop.hive.ql.parse.ASTNode expr) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
getDotAST(String tableAlias,
String fieldAlias) |
static Map<Integer,String> |
getHiveTokenMapping() |
static String |
getString(org.apache.hadoop.hive.ql.parse.ASTNode tree) |
static String |
getString(org.apache.hadoop.hive.ql.parse.ASTNode tree,
HQLParser.AppendMode appendMode) |
static boolean |
hasAggregate(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isAggregateAST(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isNonAggregateFunctionAST(org.apache.hadoop.hive.ql.parse.ASTNode node) |
static boolean |
isPrimitiveBooleanExpression(org.apache.hadoop.hive.ql.parse.ASTNode ast) |
static boolean |
isPrimitiveBooleanFunction(org.apache.hadoop.hive.ql.parse.ASTNode ast) |
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 org.apache.hadoop.hive.ql.parse.ASTNode |
parseExpr(String expr) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
parseExpr(String expr,
org.apache.hadoop.conf.Configuration conf) |
static org.apache.hadoop.hive.ql.parse.ASTNode |
parseExpression(String command,
org.apache.hadoop.conf.Configuration conf) |
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) |
static void |
toInfixString(org.apache.hadoop.hive.ql.parse.ASTNode root,
StringBuilder buf,
HQLParser.AppendMode appendMode)
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 isPrimitiveBooleanExpression(org.apache.hadoop.hive.ql.parse.ASTNode ast)
public static boolean isPrimitiveBooleanFunction(org.apache.hadoop.hive.ql.parse.ASTNode ast)
public static org.apache.hadoop.hive.ql.parse.ASTNode getDotAST(String tableAlias, String fieldAlias)
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 org.apache.hadoop.hive.ql.parse.ASTNode parseExpr(String expr, org.apache.hadoop.conf.Configuration conf) throws LensException
LensException
public static org.apache.hadoop.hive.ql.parse.ASTNode parseExpression(String command, org.apache.hadoop.conf.Configuration conf) throws org.apache.hadoop.hive.ql.parse.ParseException, org.antlr.runtime.RecognitionException
org.apache.hadoop.hive.ql.parse.ParseException
org.antlr.runtime.RecognitionException
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)
tokenMapping
- token mappingnode
- nodelevel
- levelchild
- childpublic 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
- node from which searching is to be startedpath
- starts at the level of root's childrenpublic static void bft(org.apache.hadoop.hive.ql.parse.ASTNode root, HQLParser.ASTNodeVisitor visitor) throws LensException
root
- node from where to start bftvisitor
- action to take on each visitLensException
public static void toInfixString(org.apache.hadoop.hive.ql.parse.ASTNode root, StringBuilder buf)
public static void toInfixString(org.apache.hadoop.hive.ql.parse.ASTNode root, StringBuilder buf, HQLParser.AppendMode appendMode)
root
- root nodebuf
- preallocated builder where the reconstructed string will be writtenpublic static String getString(org.apache.hadoop.hive.ql.parse.ASTNode tree, HQLParser.AppendMode appendMode)
public 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 Set<String> getColsInExpr(String tableAlias, org.apache.hadoop.hive.ql.parse.ASTNode expr) throws LensException
LensException
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–2018 Apache Software Foundation. All rights reserved.