Examples of AggregateCall


Examples of org.eigenbase.rel.AggregateCall

            + aggregate.getGroupSet());
      }
      assert BitSets.contains(tileKey.dimensions, aggregate.getGroupSet());
      final List<AggregateCall> aggCalls = Lists.newArrayList();
      for (AggregateCall aggCall : aggregate.getAggCallList()) {
        final AggregateCall copy = rollUp(aggCall, tileKey);
        if (copy == null) {
          return;
        }
        aggCalls.add(copy);
      }
View Full Code Here

Examples of org.eigenbase.rel.AggregateCall

    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);
    }

    // Second, try to satisfy the aggregation based on group set columns.
  tryGroup:
    {
      List<Integer> newArgs = Lists.newArrayList();
      for (Integer arg : aggregateCall.getArgList()) {
        int z = BitSets.toList(tileKey.dimensions).indexOf(arg);
        if (z < 0) {
          break tryGroup;
        }
        newArgs.add(z);
      }
      return new AggregateCall(aggregation, false, newArgs, aggregateCall.type,
          aggregateCall.name);
    }

    // No roll up possible.
    return null;
View Full Code Here

Examples of org.eigenbase.rel.AggregateCall

        typeFactory.createTypeWithNullability(
            avgInputType,
            avgInputType.isNullable() || nGroups == 0);
    // SqlAggFunction sumAgg = new SqlSumAggFunction(sumType);
    SqlAggFunction sumAgg = new SqlSumEmptyIsZeroAggFunction(sumType);
    AggregateCall sumCall =
        new AggregateCall(
            sumAgg,
            oldCall.isDistinct(),
            oldCall.getArgList(),
            sumType,
            null);
    SqlAggFunction countAgg = SqlStdOperatorTable.COUNT;
    RelDataType countType = countAgg.getReturnType(typeFactory);
    AggregateCall countCall =
        new AggregateCall(
            countAgg,
            oldCall.isDistinct(),
            oldCall.getArgList(),
            countType,
            null);
View Full Code Here

Examples of org.eigenbase.rel.AggregateCall

            arg);
    RelDataType sumType =
        typeFactory.createTypeWithNullability(
            argType, argType.isNullable());
    SqlAggFunction sumZeroAgg = new SqlSumEmptyIsZeroAggFunction(sumType);
    AggregateCall sumZeroCall =
        new AggregateCall(
            sumZeroAgg,
            oldCall.isDistinct(),
            oldCall.getArgList(),
            sumType,
            null);
    SqlAggFunction countAgg = SqlStdOperatorTable.COUNT;
    RelDataType countType = countAgg.getReturnType(typeFactory);
    AggregateCall countCall =
        new AggregateCall(
            countAgg,
            oldCall.isDistinct(),
            oldCall.getArgList(),
            countType,
            null);
View Full Code Here

Examples of org.eigenbase.rel.AggregateCall

    final RelDataType sumType =
        typeFactory.createTypeWithNullability(
            argType,
            true);
    final AggregateCall sumArgSquaredAggCall =
        new AggregateCall(
            new SqlSumAggFunction(sumType),
            oldCall.isDistinct(),
            ImmutableIntList.of(argSquaredOrdinal),
            sumType,
            null);
    final RexNode sumArgSquared =
        rexBuilder.addAggCall(
            sumArgSquaredAggCall,
            nGroups,
            newCalls,
            aggCallMapping,
            ImmutableList.of(argType));

    final AggregateCall sumArgAggCall =
        new AggregateCall(
            new SqlSumAggFunction(sumType),
            oldCall.isDistinct(),
            ImmutableIntList.of(argOrdinal),
            sumType,
            null);
    final RexNode sumArg =
          rexBuilder.addAggCall(
              sumArgAggCall,
              nGroups,
              newCalls,
              aggCallMapping,
              ImmutableList.of(argType));

    final RexNode sumSquaredArg =
          rexBuilder.makeCall(
              SqlStdOperatorTable.MULTIPLY, sumArg, sumArg);

    final SqlAggFunction countAgg = SqlStdOperatorTable.COUNT;
    final RelDataType countType = countAgg.getReturnType(typeFactory);
    final AggregateCall countArgAggCall =
        new AggregateCall(
            countAgg,
            oldCall.isDistinct(),
            oldCall.getArgList(),
            countType,
            null);
View Full Code Here

Examples of org.eigenbase.rel.AggregateCall

      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),
                  aggCall.e.getType(),
                  aggCall.e.getName());

          phase2AggCallList.add(newAggCall);
        } else {
          AggregateCall newAggCall =
              new AggregateCall(
                  aggCall.e.getAggregation(),
                  aggCall.e.isDistinct(),
                  Collections.singletonList(aggExprOrdinal),
                  aggCall.e.getType(),
                  aggCall.e.getName());
View Full Code Here

Examples of org.eigenbase.rel.AggregateCall

  private void gatherAggregateCalls( List<AggregateCall> distincts, List<AggregateCall> concurrents )
    {
    for( int i = 0; i < aggCalls.size(); i++ )
      {
      AggregateCall aggCall = aggCalls.get( i );

      if( aggCall.getName() == null )
        {
        String name = getRowType().getFieldList().get( groupSet.cardinality() + i ).getName();
        // TODO: use AggregateCall.rename(name) when available
        aggCall = new AggregateCall( aggCall.getAggregation(), aggCall.isDistinct(), aggCall.getArgList(), aggCall.getType(), name );
        }

      if( aggCall.isDistinct() )
        distincts.add( aggCall );
      else
        concurrents.add( aggCall );
      }
    }
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.