static String getSqlFuncName(AggregateCall aggCall) { String sqlName = aggCall.getAggregation().getName(); if (aggCall.isDistinct()) { sqlName = sqlName + "_DISTINCT"; } return sqlName; }
/** * Returns the number of count DISTINCT * * @return the number of count DISTINCT */ private int getNumCountDistinctCall(Aggregate hiveAggregate) { int cnt = 0; for (AggregateCall aggCall : hiveAggregate.getAggCallList()) { if (aggCall.isDistinct() && (aggCall.getAggregation().getName().equalsIgnoreCase("count"))) { cnt++; } } return cnt; }
/** * Returns the number of count DISTINCT * * @return the number of count DISTINCT */ private int getNumCountDistinctCall(Aggregate hiveAggregate) { int cnt = 0; for (AggregateCall aggCall : hiveAggregate.getAggCallList()) { if (aggCall.isDistinct() && (aggCall.getAggregation().getName().equalsIgnoreCase("count"))) { cnt++; } } return cnt; }
.createSqlType(SqlTypeName.INTEGER), HiveGroupingID.INSTANCE.getName()); aggregateCalls.add(aggCall); return new HiveAggregate(cluster, cluster.traitSetOf(HiveRelNode.CONVENTION),
inputOpAf.tabAlias); udafAttrs.udafParams.addAll(argExps); udafAttrs.udafName = aggCall.getAggregation().getName(); udafAttrs.argList = aggCall.getArgList(); udafAttrs.isDistinctUDAF = aggCall.isDistinct();
inputOpAf.tabAlias); udafAttrs.udafParams.addAll(argExps); udafAttrs.udafName = aggCall.getAggregation().getName(); udafAttrs.argList = aggCall.getArgList(); udafAttrs.isDistinctUDAF = aggCall.isDistinct();
false, new ImmutableList.Builder<Integer>().build(), this.cluster.getTypeFactory().createSqlType(SqlTypeName.INTEGER), HiveGroupingID.INSTANCE.getName()); aggregateCalls.add(aggCall);
(op instanceof CalciteUDAF && op.getName().equalsIgnoreCase(SqlStdOperatorTable.AVG.getName()))) { if (children.size() == 0) { node = (ASTNode) ParseDriver.adaptor.create(HiveParser.TOK_FUNCTIONSTAR,
(op instanceof CalciteUDAF && op.getName().equalsIgnoreCase(SqlStdOperatorTable.AVG.getName()))) { if (children.size() == 0) { node = (ASTNode) ParseDriver.adaptor.create(HiveParser.TOK_FUNCTIONSTAR,
Schema(Schema src, Aggregate gBy) { for (int i : gBy.getGroupSet()) { ColumnInfo cI = src.get(i); add(cI); } List<AggregateCall> aggs = gBy.getAggCallList(); for (AggregateCall agg : aggs) { if (agg.getAggregation() == HiveGroupingID.INSTANCE) { add(new ColumnInfo(null,VirtualColumn.GROUPINGID.getName())); continue; } int argCount = agg.getArgList().size(); ASTBuilder b = agg.isDistinct() ? ASTBuilder.construct(HiveParser.TOK_FUNCTIONDI, "TOK_FUNCTIONDI") : argCount == 0 ? ASTBuilder.construct(HiveParser.TOK_FUNCTIONSTAR, "TOK_FUNCTIONSTAR") : ASTBuilder.construct(HiveParser.TOK_FUNCTION, "TOK_FUNCTION"); b.add(HiveParser.Identifier, agg.getAggregation().getName()); for (int i : agg.getArgList()) { RexInputRef iRef = new RexInputRef(i, gBy.getCluster().getTypeFactory() .createSqlType(SqlTypeName.ANY)); b.add(iRef.accept(new RexVisitor(src, false, gBy.getCluster().getRexBuilder()))); } add(new ColumnInfo(null, b.node())); } }
"TOK_FUNCTIONDI") : argCount == 0 ? ASTBuilder.construct(HiveParser.TOK_FUNCTIONSTAR, "TOK_FUNCTIONSTAR") : ASTBuilder.construct(HiveParser.TOK_FUNCTION, "TOK_FUNCTION"); b.add(HiveParser.Identifier, agg.getAggregation().getName()); for (int i : agg.getArgList()) { RexInputRef iRef = new RexInputRef(i, gBy.getCluster().getTypeFactory()
private String reserveAggVarName(AggregateCall call) { String varName; if ((varName = aggregateCallVarNames.get(call)) == null) { varName = call.getAggregation().getName() + ++nameCount; aggregateCallVarNames.put(call, varName); } return varName; }
public DrillCalciteSqlAggFunctionWrapper( SqlAggFunction sqlAggFunction, List<DrillFuncHolder> functions) { this(sqlAggFunction, TypeInferenceUtils.getDrillSqlReturnTypeInference( sqlAggFunction.getName(), functions)); }
public static LogicalExpression toExpr(AggregateCall call, List<String> fn, LogicalPlanImplementor implementor) { List<LogicalExpression> args = Lists.newArrayList(); for(Integer i : call.getArgList()) { args.add(new FieldReference(fn.get(i))); } // for count(1). if (args.isEmpty()) { args.add(new ValueExpressions.LongExpression(1l)); } LogicalExpression expr = FunctionCallFactory.createExpression(call.getAggregation().getName().toLowerCase(), args); return expr; }
private static LogicalExpression toExpr(AggregateCall call, List<String> fn) { List<LogicalExpression> args = Lists.newArrayList(); for (Integer i : call.getArgList()) { args.add(FieldReference.getWithQuotedRef(fn.get(i))); } // for count(1). if (args.isEmpty()) { args.add(new ValueExpressions.LongExpression(1l)); } LogicalExpression expr = new FunctionCall(call.getAggregation().getName().toLowerCase(), args ); return expr; }
protected LogicalExpression toExpr(AggregateCall call, List<String> fn) { List<LogicalExpression> args = Lists.newArrayList(); for (Integer i : call.getArgList()) { args.add(new FieldReference(fn.get(i))); } // for count(1). if (args.isEmpty()) { args.add(new ValueExpressions.LongExpression(1l)); } LogicalExpression expr = new FunctionCall(call.getAggregation().getName().toLowerCase(), args); return expr; } }
static String getSqlFuncName(AggregateCall aggCall) { String sqlName = aggCall.getAggregation().getName(); if (aggCall.isDistinct()) { sqlName = sqlName + "_DISTINCT"; } return sqlName; }
public static LogicalExpression toDrill(AggregateCall call, List<String> fn, DrillImplementor implementor) { List<LogicalExpression> args = Lists.newArrayList(); for(Integer i : call.getArgList()) { args.add(new FieldReference(fn.get(i))); } // for count(1). if (args.isEmpty()) { args.add(new ValueExpressions.LongExpression(1L)); } return FunctionCallFactory.createExpression(call.getAggregation().getName().toLowerCase(), ExpressionPosition.UNKNOWN, args); }