org.apache.hadoop.hive.ql.parse.QBParseInfo.getHavingForClause()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中org.apache.hadoop.hive.ql.parse.QBParseInfo.getHavingForClause方法的一些代码示例,展示了QBParseInfo.getHavingForClause的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QBParseInfo.getHavingForClause方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.parse.QBParseInfo
类名称:QBParseInfo
方法名:getHavingForClause

QBParseInfo.getHavingForClause介绍

暂无

代码示例

代码示例来源:origin: apache/hive

private RelNode genGBHavingLogicalPlan(QB qb, RelNode srcRel, Map<String, RelNode> aliasToRel)
  throws SemanticException {
 RelNode gbFilter = null;
 QBParseInfo qbp = getQBParseInfo(qb);
 String destClauseName = qbp.getClauseNames().iterator().next();
 ASTNode havingClause = qbp.getHavingForClause(qbp.getClauseNames().iterator().next());
 if (havingClause != null) {
  if (!(srcRel instanceof HiveAggregate)) {
   // ill-formed query like select * from t1 having c1 > 0;
   throw new CalciteSemanticException("Having clause without any group-by.",
     UnsupportedFeature.Having_clause_without_any_groupby);
  }
  ASTNode targetNode = (ASTNode) havingClause.getChild(0);
  validateNoHavingReferenceToAlias(qb, targetNode);
  if (!qbp.getDestToGroupBy().isEmpty()) {
   final boolean cubeRollupGrpSetPresent = (!qbp.getDestRollups().isEmpty()
       || !qbp.getDestGroupingSets().isEmpty() || !qbp.getDestCubes().isEmpty());
   // Special handling of grouping function
   targetNode = rewriteGroupingFunctionAST(getGroupByForClause(qbp, destClauseName), targetNode,
     !cubeRollupGrpSetPresent);
  }
  gbFilter = genFilterRelNode(qb, targetNode, srcRel, aliasToRel, null, null, true);
 }
 return gbFilter;
}

代码示例来源:origin: apache/drill

private RelNode genGBHavingLogicalPlan(QB qb, RelNode srcRel, Map<String, RelNode> aliasToRel)
  throws SemanticException {
 RelNode gbFilter = null;
 QBParseInfo qbp = getQBParseInfo(qb);
 String destClauseName = qbp.getClauseNames().iterator().next();
 ASTNode havingClause = qbp.getHavingForClause(qbp.getClauseNames().iterator().next());
 if (havingClause != null) {
  if (!(srcRel instanceof HiveAggregate)) {
   // ill-formed query like select * from t1 having c1 > 0;
   throw new CalciteSemanticException("Having clause without any group-by.",
     UnsupportedFeature.Having_clause_without_any_groupby);
  }
  ASTNode targetNode = (ASTNode) havingClause.getChild(0);
  validateNoHavingReferenceToAlias(qb, targetNode);
  if (!qbp.getDestToGroupBy().isEmpty()) {
   final boolean cubeRollupGrpSetPresent = (!qbp.getDestRollups().isEmpty()
       || !qbp.getDestGroupingSets().isEmpty() || !qbp.getDestCubes().isEmpty());
   // Special handling of grouping function
   targetNode = rewriteGroupingFunctionAST(getGroupByForClause(qbp, destClauseName), targetNode,
     !cubeRollupGrpSetPresent);
  }
  gbFilter = genFilterRelNode(qb, targetNode, srcRel, aliasToRel, null, null, true);
 }
 return gbFilter;
}

代码示例来源:origin: apache/hive

throws SemanticException {
ASTNode havingExpr = qb.getParseInfo().getHavingForClause(dest);

代码示例来源:origin: apache/drill

throws SemanticException {
ASTNode havingExpr = qb.getParseInfo().getHavingForClause(dest);

代码示例来源:origin: apache/hive

if (qbp.getHavingForClause(dest) != null) {
 if (getGroupByForClause(qbp, dest).size() == 0) {
  throw new SemanticException("HAVING specified without GROUP BY");

代码示例来源:origin: apache/drill

if (qbp.getHavingForClause(dest) != null) {
 if (getGroupByForClause(qbp, dest).size() == 0) {
  throw new SemanticException("HAVING specified without GROUP BY");

代码示例来源:origin: org.apache.lens/lens-cube

builder.append("\n sel expr: ").append(parseInfo.getSelForClause(clause).dump());
if (parseInfo.getHavingForClause(clause) != null) {
 builder.append("\n having expr: ").append(parseInfo.getHavingForClause(clause).dump());

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private RelNode genGBHavingLogicalPlan(QB qb, RelNode srcRel, Map<String, RelNode> aliasToRel)
  throws SemanticException {
 RelNode gbFilter = null;
 QBParseInfo qbp = getQBParseInfo(qb);
 ASTNode havingClause = qbp.getHavingForClause(qbp.getClauseNames().iterator().next());
 if (havingClause != null) {
  if (!(srcRel instanceof HiveAggregate)) {
   // ill-formed query like select * from t1 having c1 > 0;
   throw new CalciteSemanticException("Having clause without any group-by.",
     UnsupportedFeature.Having_clause_without_any_groupby);
  }
  validateNoHavingReferenceToAlias(qb, (ASTNode) havingClause.getChild(0));
  gbFilter = genFilterRelNode(qb, (ASTNode) havingClause.getChild(0), srcRel, aliasToRel,
    true);
 }
 return gbFilter;
}

代码示例来源:origin: apache/lens

builder.append("\n sel expr: ").append(parseInfo.getSelForClause(clause).dump());
if (parseInfo.getHavingForClause(clause) != null) {
 builder.append("\n having expr: ").append(parseInfo.getHavingForClause(clause).dump());

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@SuppressWarnings("nls")
private Operator genHavingPlan(String dest, QB qb, Operator input,
  Map<String, Operator> aliasToOpInfo)
  throws SemanticException {
 ASTNode havingExpr = qb.getParseInfo().getHavingForClause(dest);
 OpParseContext inputCtx = opParseCtx.get(input);
 RowResolver inputRR = inputCtx.getRowResolver();
 Map<ASTNode, String> exprToColumnAlias = qb.getParseInfo().getAllExprToColumnAlias();
 for (ASTNode astNode : exprToColumnAlias.keySet()) {
  if (inputRR.getExpression(astNode) != null) {
   inputRR.put("", exprToColumnAlias.get(astNode), inputRR.getExpression(astNode));
  }
 }
 ASTNode condn = (ASTNode) havingExpr.getChild(0);
 /*
  * Now a having clause can contain a SubQuery predicate;
  * so we invoke genFilterPlan to handle SubQuery algebraic transformation,
  * just as is done for SubQuery predicates appearing in the Where Clause.
  */
 Operator output = genFilterPlan(condn, qb, input, aliasToOpInfo, true);
 output = putOpInsertMap(output, inputRR);
 return output;
}

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

@SuppressWarnings("nls")
private Operator genHavingPlan(String dest, QB qb, Operator input)
  throws SemanticException {
 ASTNode havingExpr = qb.getParseInfo().getHavingForClause(dest);
 OpParseContext inputCtx = opParseCtx.get(input);
 RowResolver inputRR = inputCtx.getRowResolver();
 Map<ASTNode, String> exprToColumnAlias = qb.getParseInfo().getAllExprToColumnAlias();
 for (ASTNode astNode : exprToColumnAlias.keySet()) {
  if (inputRR.getExpression(astNode) != null) {
   inputRR.put("", exprToColumnAlias.get(astNode), inputRR.getExpression(astNode));
  }
 }
 ASTNode condn = (ASTNode) havingExpr.getChild(0);
 Operator output = putOpInsertMap(OperatorFactory.getAndMakeChild(
   new FilterDesc(genExprNodeDesc(condn, inputRR), false), new RowSchema(
   inputRR.getColumnInfos()), input), inputRR);
 return output;
}

代码示例来源:origin: apache/lens

this.whereAST = qb.getParseInfo().getWhrForClause(clauseName);
if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
 this.havingAST = qb.getParseInfo().getHavingForClause(clauseName);

代码示例来源:origin: org.apache.lens/lens-cube

this.whereAST = qb.getParseInfo().getWhrForClause(clauseName);
if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
 this.havingAST = qb.getParseInfo().getHavingForClause(clauseName);

代码示例来源:origin: org.apache.lens/lens-driver-jdbc

if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
 this.havingAST = qb.getParseInfo().getHavingForClause(clauseName);

代码示例来源:origin: apache/lens

if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
 this.havingAST = qb.getParseInfo().getHavingForClause(clauseName);

代码示例来源:origin: apache/lens

if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
 this.havingTree = HQLParser.getString(qb.getParseInfo().getHavingForClause(clauseName));
 this.havingAST = qb.getParseInfo().getHavingForClause(clauseName);

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

if (qbp.getHavingForClause(dest) != null) {
 if (getGroupByForClause(qbp, dest).size() == 0) {
  throw new SemanticException("HAVING specified without GROUP BY");

代码示例来源:origin: org.apache.lens/lens-driver-jdbc

if (qb.getParseInfo().getHavingForClause(clauseName) != null) {
 this.havingTree = HQLParser.getString(qb.getParseInfo().getHavingForClause(clauseName));
 this.havingAST = qb.getParseInfo().getHavingForClause(clauseName);

代码示例来源:origin: com.facebook.presto.hive/hive-apache

if (qbp.getHavingForClause(dest) != null) {
 if (getGroupByForClause(qbp, dest).size() == 0) {
  throw new SemanticException("HAVING specified without GROUP BY");

相关文章

微信公众号

最新文章

更多

QBParseInfo类方法