public KylinAggregateCall(AggregateCall aggCall, FunctionDesc func) { super(aggCall.getAggregation(), aggCall.isDistinct(), aggCall.getArgList(), aggCall.type, aggCall.name); this.func = func; }
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; }
if (!aggCall.isDistinct()) { continue;
if (!aggCall.isDistinct()) { continue;
@Override public void implementOLAP(OLAPImplementor implementor) { implementor.fixSharedOlapTableScan(this); implementor.visitChild(getInput(), this); this.context = implementor.getContext(); this.columnRowType = buildColumnRowType(); this.afterAggregate = this.context.afterAggregate; // only translate the innermost aggregation if (!this.afterAggregate) { addToContextGroupBy(this.groups); this.context.aggregations.addAll(this.aggregations); this.context.aggrOutCols .addAll(columnRowType.getAllColumns().subList(groups.size(), columnRowType.getAllColumns().size())); this.context.afterAggregate = true; if (this.context.afterLimit) { this.context.limitPrecedesAggr = true; } } else { this.context.afterOuterAggregate = true; for (AggregateCall aggCall : aggCalls) { // check if supported by kylin if (aggCall.isDistinct()) { throw new IllegalStateException("Distinct count is only allowed in innermost sub-query."); } } } }
private AggregateCall createAggregateCallWithBinding( RelDataTypeFactory typeFactory, SqlAggFunction aggFunction, RelDataType operandType, Aggregate oldAggRel, AggregateCall oldCall, int argOrdinal) { final Aggregate.AggCallBinding binding = new Aggregate.AggCallBinding(typeFactory, aggFunction, ImmutableList.of(operandType), oldAggRel.getGroupCount(), oldCall.filterArg >= 0); return AggregateCall.create(aggFunction, oldCall.isDistinct(), oldCall.isApproximate(), ImmutableIntList.of(argOrdinal), oldCall.filterArg, aggFunction.inferReturnType(binding), null); }
if (aggregateCall.isDistinct()) { return null;
if (aggregateCall.isDistinct()) { return null;
if (aggregateCall.isDistinct()) { return null;
.stream() .filter(aggregateCall -> aggregateCall.getAggregation().getKind().equals(SqlKind.COUNT) && aggregateCall.isDistinct()) .count(); if (numCountDistinct != 1) { ++filterCount; if (!aggCall.isDistinct()) { ++nonDistinctAggCallCount; final SqlKind aggCallKind = aggCall.getAggregation().getKind();
for (int i = 0; i < aggCalls.size(); i++) { AggregateCall aggCall = aggCalls.get(i); if (aggCall.getAggregation().getKind() == SqlKind.COUNT && !aggCall.isDistinct()) { final List<Integer> args = aggCall.getArgList(); final List<Integer> nullableArgs = new ArrayList<>(args.size());
if (aggregateCall.isDistinct()) { return null;
if (aggregateCall.isDistinct()) {
} else if (aggregateCall.isDistinct()) {
if (aggregateCall.isDistinct()) { return null; aggregateCall.isDistinct(), ImmutableList.of(target.groupSet.cardinality() + i), -1, aggregateCall.type, aggregateCall.name));
AggregateCall.create( new HiveSqlSumAggFunction( oldCall.isDistinct(), ReturnTypes.explicit(sumReturnType), oldCall.getAggregation().getOperandTypeInference(), oldCall.isDistinct(), oldCall.isApproximate(), oldCall.getArgList(),
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())); } }
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");