public class HiveParserUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HiveParserUtils.CorrelationCollector
A visitor to collect correlation IDs and required columns.
|
static class |
HiveParserUtils.LateralViewInfo
Information needed to generate logical plan for a lateral view.
|
Modifier and Type | Field and Description |
---|---|
static String |
BRIDGING_SQL_FUNCTION_CLZ_NAME |
Modifier and Type | Method and Description |
---|---|
static org.apache.hadoop.hive.ql.hooks.ReadEntity |
addInput(Set<org.apache.hadoop.hive.ql.hooks.ReadEntity> inputs,
org.apache.hadoop.hive.ql.hooks.ReadEntity newInput,
boolean mergeIsDirectFlag) |
static org.apache.calcite.util.NlsString |
asUnicodeString(String text) |
static String |
canHandleQbForCbo(org.apache.hadoop.hive.ql.QueryProperties queryProperties) |
static List<org.apache.hadoop.hive.metastore.api.FieldSchema> |
convertRowSchemaToResultSetSchema(HiveParserRowResolver rr,
boolean useTabAliasIfAvailable) |
static void |
extractColumns(Set<String> colNamesExprs,
org.apache.hadoop.hive.ql.plan.ExprNodeDesc exprNode) |
static HiveParserUtils.LateralViewInfo |
extractLateralViewInfo(HiveParserASTNode lateralView,
HiveParserRowResolver inputRR,
HiveParserSemanticAnalyzer hiveAnalyzer,
org.apache.calcite.tools.FrameworkConfig frameworkConfig,
org.apache.calcite.plan.RelOptCluster cluster) |
static String |
generateErrorMessage(HiveParserASTNode ast,
String message) |
static Map<HiveParserASTNode,org.apache.hadoop.hive.ql.plan.ExprNodeDesc> |
genExprNode(HiveParserASTNode expr,
HiveParserTypeCheckCtx tcCtx) |
static org.apache.calcite.rel.RelNode |
genFilterRelNode(org.apache.calcite.rel.RelNode relNode,
org.apache.calcite.rex.RexNode rexNode,
Collection<org.apache.calcite.rel.core.CorrelationId> variables) |
static HiveParserASTNode |
genSelectDIAST(HiveParserRowResolver rr) |
static org.apache.calcite.rel.RelNode |
genValuesRelNode(org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.rel.type.RelDataType rowType,
List<List<org.apache.calcite.rex.RexLiteral>> rows) |
static org.apache.calcite.sql.SqlOperator |
getAnySqlOperator(String funcName,
org.apache.calcite.sql.SqlOperatorTable opTable) |
static String[] |
getColAlias(HiveParserASTNode selExpr,
String defaultName,
HiveParserRowResolver inputRR,
boolean includeFuncName,
int colNum) |
static org.apache.hadoop.hive.ql.exec.FunctionInfo |
getFunctionInfo(String funcName) |
static org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator |
getGenericUDAFEvaluator(String aggName,
ArrayList<org.apache.hadoop.hive.ql.plan.ExprNodeDesc> aggParameters,
HiveParserASTNode aggTree,
boolean isDistinct,
boolean isAllColumns,
org.apache.calcite.sql.SqlOperatorTable opTable) |
static HiveParserBaseSemanticAnalyzer.GenericUDAFInfo |
getGenericUDAFInfo(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator evaluator,
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.Mode emode,
ArrayList<org.apache.hadoop.hive.ql.plan.ExprNodeDesc> aggParameters)
Returns the GenericUDAFInfo struct for the aggregation.
|
static List<org.apache.calcite.rex.RexNode> |
getProjsFromBelowAsInputRef(org.apache.calcite.rel.RelNode rel) |
static HiveShim |
getSessionHiveShim() |
static org.apache.calcite.sql.SqlOperator |
getSqlOperator(String funcName,
org.apache.calcite.sql.SqlOperatorTable opTable,
org.apache.calcite.sql.SqlFunctionCategory category) |
static String |
getStandardDisplayString(String name,
String[] children) |
static ArrayList<org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector> |
getWritableObjectInspector(ArrayList<org.apache.hadoop.hive.ql.plan.ExprNodeDesc> exprs)
Convert exprNodeDesc array to ObjectInspector array.
|
static org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.Mode |
groupByDescModeToUDAFMode(org.apache.hadoop.hive.ql.plan.GroupByDesc.Mode mode,
boolean isDistinct) |
static boolean |
hasCommonElement(Set<String> set1,
Set<String> set2) |
static org.apache.calcite.rel.type.RelDataType |
inferReturnTypeForOperands(org.apache.calcite.sql.SqlOperator sqlOperator,
List<org.apache.calcite.rex.RexNode> operands,
org.apache.calcite.rel.type.RelDataTypeFactory dataTypeFactory) |
static org.apache.calcite.rel.type.RelDataType |
inferReturnTypeForOperandsTypes(org.apache.calcite.sql.SqlOperator sqlOperator,
List<org.apache.calcite.rel.type.RelDataType> types,
List<org.apache.calcite.rex.RexNode> operands,
org.apache.calcite.rel.type.RelDataTypeFactory dataTypeFactory) |
static boolean |
isBridgingSqlFunction(org.apache.calcite.sql.SqlOperator sqlOperator) |
static boolean |
isFromTimeStampToDecimal(org.apache.calcite.rel.type.RelDataType srcType,
org.apache.calcite.rel.type.RelDataType targetType) |
static boolean |
isIdentityProject(org.apache.calcite.rel.RelNode input,
List<org.apache.calcite.rex.RexNode> exprs,
List<String> aliases) |
static boolean |
isJoinToken(HiveParserASTNode node) |
static boolean |
isNative(org.apache.calcite.sql.SqlOperator sqlOperator) |
static boolean |
isOuterJoinToken(HiveParserASTNode node) |
static boolean |
isRegex(String pattern,
HiveConf conf)
Returns whether the pattern is a regex expression (instead of a normal string).
|
static boolean |
isSkewedCol(String alias,
HiveParserQB qb,
String colName) |
static boolean |
isUDAF(org.apache.calcite.sql.SqlOperator sqlOperator) |
static boolean |
isUDTF(org.apache.calcite.sql.SqlOperator sqlOperator) |
static boolean |
isValuesTempTable(String tableName)
Check if the table is the temporary table created by VALUES() syntax.
|
static boolean |
legacyGrouping(org.apache.hadoop.conf.Configuration conf) |
static org.apache.calcite.rex.RexNode |
makeOver(org.apache.calcite.rex.RexBuilder rexBuilder,
org.apache.calcite.rel.type.RelDataType type,
org.apache.calcite.sql.SqlAggFunction operator,
List<org.apache.calcite.rex.RexNode> exprs,
List<org.apache.calcite.rex.RexNode> partitionKeys,
List<org.apache.calcite.rex.RexFieldCollation> orderKeys,
org.apache.calcite.rex.RexWindowBound lowerBound,
org.apache.calcite.rex.RexWindowBound upperBound,
boolean physical,
boolean allowPartial,
boolean nullWhenCountZero,
boolean distinct,
boolean ignoreNulls)
Proxy to
RexBuilder.makeOver(RelDataType, SqlAggFunction, List, List,
com.google.common.collect.ImmutableList, RexWindowBound, RexWindowBound, boolean, boolean,
boolean, boolean, boolean) . |
static boolean |
pivotResult(String functionName) |
static org.apache.calcite.rex.RexNode |
projectNonColumnEquiConditions(org.apache.calcite.rel.core.RelFactories.ProjectFactory factory,
org.apache.calcite.rel.RelNode[] inputRels,
List<org.apache.calcite.rex.RexNode> leftJoinKeys,
List<org.apache.calcite.rex.RexNode> rightJoinKeys,
int systemColCount,
List<Integer> leftKeys,
List<Integer> rightKeys)
Push any equi join conditions that are not column references as Projections on top of the
children.
|
static void |
removeASTChild(HiveParserASTNode node) |
static HiveParserASTNode |
rewriteGroupingFunctionAST(List<HiveParserASTNode> grpByAstExprs,
HiveParserASTNode targetNode,
boolean noneSet) |
static org.apache.calcite.rex.RexSubQuery |
rexSubQueryIn(org.apache.calcite.rel.RelNode relNode,
Collection<org.apache.calcite.rex.RexNode> rexNodes)
Proxy to
RexSubQuery.in(RelNode, com.google.common.collect.ImmutableList) . |
static void |
saveViewDefinition(List<org.apache.hadoop.hive.metastore.api.FieldSchema> resultSchema,
HiveParserCreateViewInfo createViewInfo,
org.antlr.runtime.TokenRewriteStream tokenRewriteStream,
HiveParserUnparseTranslator unparseTranslator,
HiveConf conf) |
static org.apache.calcite.rel.core.AggregateCall |
toAggCall(HiveParserBaseSemanticAnalyzer.AggInfo aggInfo,
HiveParserRexNodeConverter converter,
Map<String,Integer> rexNodeToPos,
int groupCount,
org.apache.calcite.rel.RelNode input,
org.apache.calcite.plan.RelOptCluster cluster,
SqlFunctionConverter funcConverter) |
static DataType |
toDataType(org.apache.calcite.rel.type.RelDataType relDataType) |
static org.apache.calcite.rel.type.RelDataType |
toRelDataType(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo typeInfo,
org.apache.calcite.rel.type.RelDataTypeFactory relTypeFactory) |
static int |
unsetBit(int bitmap,
int bitIdx) |
static void |
verifyCanHandleAst(HiveParserASTNode ast,
HiveParserQB qb,
org.apache.hadoop.hive.ql.QueryProperties queryProperties) |
static void |
writeAsText(String text,
org.apache.hadoop.fs.FSDataOutputStream out)
Convert a string to Text format and write its bytes in the same way TextOutputFormat would
do.
|
public static final String BRIDGING_SQL_FUNCTION_CLZ_NAME
public static void removeASTChild(HiveParserASTNode node)
public static org.apache.calcite.util.NlsString asUnicodeString(String text)
public static String canHandleQbForCbo(org.apache.hadoop.hive.ql.QueryProperties queryProperties)
public static org.apache.calcite.rel.type.RelDataType toRelDataType(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo typeInfo, org.apache.calcite.rel.type.RelDataTypeFactory relTypeFactory) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static org.apache.calcite.rex.RexNode makeOver(org.apache.calcite.rex.RexBuilder rexBuilder, org.apache.calcite.rel.type.RelDataType type, org.apache.calcite.sql.SqlAggFunction operator, List<org.apache.calcite.rex.RexNode> exprs, List<org.apache.calcite.rex.RexNode> partitionKeys, List<org.apache.calcite.rex.RexFieldCollation> orderKeys, org.apache.calcite.rex.RexWindowBound lowerBound, org.apache.calcite.rex.RexWindowBound upperBound, boolean physical, boolean allowPartial, boolean nullWhenCountZero, boolean distinct, boolean ignoreNulls)
RexBuilder.makeOver(RelDataType, SqlAggFunction, List, List,
com.google.common.collect.ImmutableList, RexWindowBound, RexWindowBound, boolean, boolean,
boolean, boolean, boolean)
.public static org.apache.calcite.rel.RelNode genValuesRelNode(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.rel.type.RelDataType rowType, List<List<org.apache.calcite.rex.RexLiteral>> rows)
public static org.apache.calcite.rel.RelNode genFilterRelNode(org.apache.calcite.rel.RelNode relNode, org.apache.calcite.rex.RexNode rexNode, Collection<org.apache.calcite.rel.core.CorrelationId> variables)
public static org.apache.calcite.rex.RexSubQuery rexSubQueryIn(org.apache.calcite.rel.RelNode relNode, Collection<org.apache.calcite.rex.RexNode> rexNodes)
RexSubQuery.in(RelNode, com.google.common.collect.ImmutableList)
.public static boolean isValuesTempTable(String tableName)
tableName
- table namepublic static org.apache.hadoop.hive.ql.hooks.ReadEntity addInput(Set<org.apache.hadoop.hive.ql.hooks.ReadEntity> inputs, org.apache.hadoop.hive.ql.hooks.ReadEntity newInput, boolean mergeIsDirectFlag)
public static Map<HiveParserASTNode,org.apache.hadoop.hive.ql.plan.ExprNodeDesc> genExprNode(HiveParserASTNode expr, HiveParserTypeCheckCtx tcCtx) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static String generateErrorMessage(HiveParserASTNode ast, String message)
public static void writeAsText(String text, org.apache.hadoop.fs.FSDataOutputStream out) throws IOException
IOException
public static HiveParserASTNode genSelectDIAST(HiveParserRowResolver rr)
public static org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.Mode groupByDescModeToUDAFMode(org.apache.hadoop.hive.ql.plan.GroupByDesc.Mode mode, boolean isDistinct)
public static boolean isSkewedCol(String alias, HiveParserQB qb, String colName)
public static boolean isJoinToken(HiveParserASTNode node)
public static boolean isOuterJoinToken(HiveParserASTNode node)
public static void extractColumns(Set<String> colNamesExprs, org.apache.hadoop.hive.ql.plan.ExprNodeDesc exprNode)
public static HiveParserBaseSemanticAnalyzer.GenericUDAFInfo getGenericUDAFInfo(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator evaluator, org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.Mode emode, ArrayList<org.apache.hadoop.hive.ql.plan.ExprNodeDesc> aggParameters) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static ArrayList<org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector> getWritableObjectInspector(ArrayList<org.apache.hadoop.hive.ql.plan.ExprNodeDesc> exprs)
public static org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator getGenericUDAFEvaluator(String aggName, ArrayList<org.apache.hadoop.hive.ql.plan.ExprNodeDesc> aggParameters, HiveParserASTNode aggTree, boolean isDistinct, boolean isAllColumns, org.apache.calcite.sql.SqlOperatorTable opTable) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static boolean isBridgingSqlFunction(org.apache.calcite.sql.SqlOperator sqlOperator)
public static boolean isRegex(String pattern, HiveConf conf)
public static String[] getColAlias(HiveParserASTNode selExpr, String defaultName, HiveParserRowResolver inputRR, boolean includeFuncName, int colNum)
public static int unsetBit(int bitmap, int bitIdx)
public static HiveParserASTNode rewriteGroupingFunctionAST(List<HiveParserASTNode> grpByAstExprs, HiveParserASTNode targetNode, boolean noneSet)
public static boolean legacyGrouping(org.apache.hadoop.conf.Configuration conf)
public static org.apache.calcite.sql.SqlOperator getAnySqlOperator(String funcName, org.apache.calcite.sql.SqlOperatorTable opTable)
public static org.apache.calcite.sql.SqlOperator getSqlOperator(String funcName, org.apache.calcite.sql.SqlOperatorTable opTable, org.apache.calcite.sql.SqlFunctionCategory category)
public static org.apache.calcite.rel.type.RelDataType inferReturnTypeForOperandsTypes(org.apache.calcite.sql.SqlOperator sqlOperator, List<org.apache.calcite.rel.type.RelDataType> types, List<org.apache.calcite.rex.RexNode> operands, org.apache.calcite.rel.type.RelDataTypeFactory dataTypeFactory)
public static org.apache.calcite.rel.type.RelDataType inferReturnTypeForOperands(org.apache.calcite.sql.SqlOperator sqlOperator, List<org.apache.calcite.rex.RexNode> operands, org.apache.calcite.rel.type.RelDataTypeFactory dataTypeFactory)
public static DataType toDataType(org.apache.calcite.rel.type.RelDataType relDataType)
public static HiveParserUtils.LateralViewInfo extractLateralViewInfo(HiveParserASTNode lateralView, HiveParserRowResolver inputRR, HiveParserSemanticAnalyzer hiveAnalyzer, org.apache.calcite.tools.FrameworkConfig frameworkConfig, org.apache.calcite.plan.RelOptCluster cluster) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static boolean isUDAF(org.apache.calcite.sql.SqlOperator sqlOperator)
public static boolean isUDTF(org.apache.calcite.sql.SqlOperator sqlOperator)
public static boolean isNative(org.apache.calcite.sql.SqlOperator sqlOperator)
public static org.apache.calcite.rex.RexNode projectNonColumnEquiConditions(org.apache.calcite.rel.core.RelFactories.ProjectFactory factory, org.apache.calcite.rel.RelNode[] inputRels, List<org.apache.calcite.rex.RexNode> leftJoinKeys, List<org.apache.calcite.rex.RexNode> rightJoinKeys, int systemColCount, List<Integer> leftKeys, List<Integer> rightKeys)
public static List<org.apache.calcite.rex.RexNode> getProjsFromBelowAsInputRef(org.apache.calcite.rel.RelNode rel)
public static boolean pivotResult(String functionName) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static org.apache.hadoop.hive.ql.exec.FunctionInfo getFunctionInfo(String funcName) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static List<org.apache.hadoop.hive.metastore.api.FieldSchema> convertRowSchemaToResultSetSchema(HiveParserRowResolver rr, boolean useTabAliasIfAvailable)
public static void saveViewDefinition(List<org.apache.hadoop.hive.metastore.api.FieldSchema> resultSchema, HiveParserCreateViewInfo createViewInfo, org.antlr.runtime.TokenRewriteStream tokenRewriteStream, HiveParserUnparseTranslator unparseTranslator, HiveConf conf) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static HiveShim getSessionHiveShim()
public static String getStandardDisplayString(String name, String[] children)
public static void verifyCanHandleAst(HiveParserASTNode ast, HiveParserQB qb, org.apache.hadoop.hive.ql.QueryProperties queryProperties) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static boolean isIdentityProject(org.apache.calcite.rel.RelNode input, List<org.apache.calcite.rex.RexNode> exprs, List<String> aliases)
public static org.apache.calcite.rel.core.AggregateCall toAggCall(HiveParserBaseSemanticAnalyzer.AggInfo aggInfo, HiveParserRexNodeConverter converter, Map<String,Integer> rexNodeToPos, int groupCount, org.apache.calcite.rel.RelNode input, org.apache.calcite.plan.RelOptCluster cluster, SqlFunctionConverter funcConverter) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public static boolean isFromTimeStampToDecimal(org.apache.calcite.rel.type.RelDataType srcType, org.apache.calcite.rel.type.RelDataType targetType)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.