public final class ParseUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsTokenOfType(ASTNode root,
Integer... tokens) |
static boolean |
containsTokenOfType(ASTNode root,
PTFUtils.Predicate<ASTNode> predicate) |
static ExprNodeDesc |
createConversionCast(ExprNodeDesc column,
PrimitiveTypeInfo tableFieldTypeInfo) |
static String |
ensureClassExists(String className) |
static CharTypeInfo |
getCharTypeInfo(ASTNode node) |
static DecimalTypeInfo |
getDecimalTypeTypeInfo(ASTNode node) |
static String |
getKeywords(Set<String> excludes) |
static VarcharTypeInfo |
getVarcharTypeInfo(ASTNode node) |
static boolean |
isJoinToken(ASTNode node)
Tests whether the parse tree node is a join token.
|
static ASTNode |
parse(String command) |
static ASTNode |
parse(String command,
Context ctx)
Parses the Hive query.
|
static ASTNode |
parse(String command,
Context ctx,
String viewFullyQualifiedName)
Parses the Hive query.
|
static boolean |
sameTree(ASTNode node,
ASTNode otherNode) |
static List<String> |
validateColumnNameUniqueness(List<FieldSchema> fieldSchemas) |
public static ASTNode parse(String command) throws ParseException
ParseException
public static ASTNode parse(String command, Context ctx) throws ParseException
ParseException
public static ASTNode parse(String command, Context ctx, String viewFullyQualifiedName) throws ParseException
ParseException
public static boolean isJoinToken(ASTNode node)
node
- The parse tree nodepublic static List<String> validateColumnNameUniqueness(List<FieldSchema> fieldSchemas) throws SemanticException
SemanticException
public static ExprNodeDesc createConversionCast(ExprNodeDesc column, PrimitiveTypeInfo tableFieldTypeInfo) throws SemanticException
column
- column expression to converttableFieldTypeInfo
- TypeInfo to convert toSemanticException
public static VarcharTypeInfo getVarcharTypeInfo(ASTNode node) throws SemanticException
SemanticException
public static CharTypeInfo getCharTypeInfo(ASTNode node) throws SemanticException
SemanticException
public static DecimalTypeInfo getDecimalTypeTypeInfo(ASTNode node) throws SemanticException
SemanticException
public static String ensureClassExists(String className) throws SemanticException
SemanticException
public static boolean containsTokenOfType(ASTNode root, PTFUtils.Predicate<ASTNode> predicate)
Copyright © 2022 The Apache Software Foundation. All rights reserved.