Examples of Aggregation


Examples of mondrian.rolap.agg.Aggregation

                        it = destAggregations.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<AggregationKey, Aggregation> e =
                        it.next();
                    AggregationKey aggregationKey = e.getKey();
                    Aggregation aggregation = e.getValue();

                    if (localAggregationKey.equals(aggregationKey)) {
                        if (localAggregation.getCreationTimestamp().after(
                            aggregation.getCreationTimestamp()))
                        {
                            it.remove();
                        } else {
                            // Entry is newer, do not replace
                            found = true;
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

    @Override
    public void implementNotNullAdd(AggContext info, AggAddContext add) {
      Expression acc = add.accumulator().get(0);
      Expression arg = add.arguments().get(0);
      Aggregation aggregation = info.aggregation();
      Expression next = Expressions.call(
          SqlFunctions.class,
          aggregation == MIN ? "lesser" : "greater",
          acc,
          Expressions.unbox(arg));
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

    @Override
    public void implementNotNullAdd(AggContext info, AggAddContext add) {
      Expression acc = add.accumulator().get(0);
      Expression arg = add.arguments().get(0);
      Aggregation aggregation = info.aggregation();
      Expression next = Expressions.call(
          SqlFunctions.class,
          aggregation == MIN ? "lesser" : "greater",
          acc,
          Expressions.unbox(arg));
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

      aggExprs.add(ne);

      if (getOperatorPhase() == OperatorPhase.PHASE_1of2) {
        if (aggCall.e.getAggregation().getName().equals("COUNT")) {
          // If we are doing a COUNT aggregate in Phase1of2, then in Phase2of2 we should SUM the COUNTs,
          Aggregation sumAggFun = new SqlSumCountAggFunction(aggCall.e.getType());
          AggregateCall newAggCall =
              new AggregateCall(
                  sumAggFun,
                  aggCall.e.isDistinct(),
                  Collections.singletonList(aggExprOrdinal),
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

    HiveAggregateRel oldAggRel = (HiveAggregateRel) rel;
    RelDataTypeFactory typeFactory = oldAggRel.getCluster().getTypeFactory();
    RelDataType longType = TypeConverter.convert(TypeInfoFactory.longTypeInfo, typeFactory);
    RelDataType intType = TypeConverter.convert(TypeInfoFactory.intTypeInfo, typeFactory);
    // Create the dummy aggregation.
    Aggregation countFn = (Aggregation) SqlFunctionConverter.getOptiqAggFn("count",
        ImmutableList.of(intType), longType);
    // TODO: Using 0 might be wrong; might need to walk down to find the
    // proper index of a dummy.
    List<Integer> argList = ImmutableList.of(0);
    AggregateCall dummyCall = new AggregateCall(countFn, false, argList, longType, null);
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

        aggArgRelDTBldr.add(TypeConverter.convert(expr.getTypeInfo(), dtFactory));
      }

      // 3. Get Aggregation FN from Optiq given name, ret type and input arg
      // type
      final Aggregation aggregation = SqlFunctionConverter.getOptiqAggFn(agg.m_udfName,
          aggArgRelDTBldr.build(), aggFnRetType);

      return new AggregateCall(aggregation, agg.m_distinct, argList, aggFnRetType, null);
    }
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

      aggExprs.add(ne);

      if (getOperatorPhase() == OperatorPhase.PHASE_1of2) {
        if (aggCall.e.getAggregation().getName().equals("COUNT")) {
          // If we are doing a COUNT aggregate in Phase1of2, then in Phase2of2 we should SUM the COUNTs,
          Aggregation sumAggFun = new SqlSumCountAggFunction(aggCall.e.getType());
          AggregateCall newAggCall =
              new AggregateCall(
                  sumAggFun,
                  aggCall.e.isDistinct(),
                  Collections.singletonList(aggExprOrdinal),
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

        topGroupSet.set(BitSets.toList(newGroupSet).indexOf(c));
      }
      final List<AggregateCall> topAggCallList = Lists.newArrayList();
      int i = newGroupSet.cardinality();
      for (AggregateCall aggregateCall : aggregate.getAggCallList()) {
        final Aggregation rollup =
            SubstitutionVisitor.getRollup(aggregateCall.getAggregation());
        if (rollup == null) {
          // This aggregate cannot be rolled up.
          return;
        }
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

    call.transformTo(rel);
  }

  private static AggregateCall rollUp(AggregateCall aggregateCall,
      MaterializationService.TileKey tileKey) {
    final Aggregation aggregation = aggregateCall.getAggregation();
    final Pair<Aggregation, List<Integer>> seek =
        Pair.of(aggregation, aggregateCall.getArgList());
    final int offset = tileKey.dimensions.cardinality();
    final ImmutableList<Lattice.Measure> measures = tileKey.measures;

    // First, try to satisfy the aggregation by rolling up an aggregate in the
    // materialization.
    final int i = find(measures, seek);
  tryRoll:
    if (i >= 0) {
      final Aggregation roll = SubstitutionVisitor.getRollup(aggregation);
      if (roll == null) {
        break tryRoll;
      }
      return new AggregateCall(roll, false, ImmutableList.of(offset + i),
          aggregateCall.type, aggregateCall.name);
View Full Code Here

Examples of org.eigenbase.rel.Aggregation

    @Override
    public void implementNotNullAdd(AggContext info, AggAddContext add) {
      Expression acc = add.accumulator().get(0);
      Expression arg = add.arguments().get(0);
      Aggregation aggregation = info.aggregation();
      Expression next = Expressions.call(
          SqlFunctions.class,
          aggregation == MIN ? "lesser" : "greater",
          acc,
          Expressions.unbox(arg));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.