Examples of Aggregation


Examples of io.crate.planner.symbol.Aggregation

        countImpl = (AggregationFunction) functions.get(countAggIdent);
    }

    @Test
    public void testAggregationFromPartial() {
        Aggregation aggregation = new Aggregation(
                countImpl.info(),
                Arrays.<Symbol>asList(new InputColumn(0)),
                Aggregation.Step.PARTIAL,
                Aggregation.Step.FINAL
        );
View Full Code Here

Examples of io.crate.planner.symbol.Aggregation

        assertThat((Long)result, is(20L));
    }

    @Test
    public void testAggregationFromIterToFinal() {
        Aggregation aggregation = new Aggregation(
                countImpl.info(),
                Arrays.<Symbol>asList(new InputColumn(0)),
                Aggregation.Step.ITER,
                Aggregation.Step.FINAL
        );
View Full Code Here

Examples of io.crate.planner.symbol.Aggregation

        minAggFunction = (AggregationFunction<MinimumAggregation.MinimumAggState>) functions.get(minAggIdent);

        groupProjection = new GroupProjection();
        groupProjection.keys(Arrays.<DataTypeSymbol>asList(new InputColumn(0, DataTypes.INTEGER)));
        groupProjection.values(Arrays.asList(
                new Aggregation(minAggInfo, Arrays.<Symbol>asList(new InputColumn(1)),
                        Aggregation.Step.PARTIAL, Aggregation.Step.FINAL)
        ));
    }
View Full Code Here

Examples of io.crate.planner.symbol.Aggregation

        ImmutableList<Input<?>> keys = ImmutableList.<Input<?>>of(
                new DummyInput("one", "one", "three"));


        FunctionInfo countInfo = new FunctionInfo(new FunctionIdent("count", ImmutableList.<DataType>of()), DataTypes.LONG);
        Aggregation countAggregation =
                new Aggregation(countInfo, ImmutableList.<Symbol>of(), Aggregation.Step.ITER, Aggregation.Step.PARTIAL);

        Functions functions = new ModulesBuilder()
                .add(new AggregationImplModule()).createInjector().getInstance(Functions.class);

        AggregationContext aggregationContext = new AggregationContext(
View Full Code Here

Examples of io.crate.planner.symbol.Aggregation

    public void testStreaming2() throws Exception {
        Reference nameRef = createReference("name", DataTypes.STRING);
        GroupProjection groupProjection = new GroupProjection();
        groupProjection.keys(Arrays.<DataTypeSymbol>asList(nameRef));
        groupProjection.values(Arrays.asList(
                new Aggregation(
                        new FunctionInfo(new FunctionIdent(CountAggregation.NAME, ImmutableList.<DataType>of()), DataTypes.LONG),
                        ImmutableList.<Symbol>of(),
                        Aggregation.Step.PARTIAL,
                        Aggregation.Step.FINAL
                )
View Full Code Here

Examples of io.crate.planner.symbol.Aggregation

        }
        return result;
    }

    private Plan genCountStarPlan(TableInfo table) {
        Aggregation countAggregationPartial = new Aggregation(
                CountAggregation.COUNT_STAR_FUNCTION,
                ImmutableList.<Symbol>of(),
                Aggregation.Step.ITER,
                Aggregation.Step.PARTIAL);
        Aggregation countAggregationFinal = new Aggregation(
                CountAggregation.COUNT_STAR_FUNCTION,
                ImmutableList.<Symbol>of(new InputColumn(0, DataTypes.LONG)),
                Aggregation.Step.PARTIAL,
                Aggregation.Step.FINAL);
View Full Code Here

Examples of mondrian.rolap.agg.Aggregation

     * @param aggregationKey this is the contrained column bitkey
     */
    public Aggregation lookupOrCreateAggregation(
        AggregationKey aggregationKey)
    {
        Aggregation aggregation = lookupAggregation(aggregationKey);

        if (aggregation == null) {
            aggregation = new Aggregation(aggregationKey);

            this.localAggregations.get().put(aggregationKey, aggregation);

            // Let the change listener get the opportunity to register the
            // first time the aggregation is used
View Full Code Here

Examples of mondrian.rolap.agg.Aggregation

     *
     * <p>Must be called from synchronized context.
     */
    public Aggregation lookupAggregation(AggregationKey aggregationKey) {
        // First try thread local cache
        Aggregation aggregation = localAggregations.get().get(aggregationKey);
        if (aggregation != null) {
            return aggregation;
        }

        if (cacheAggregations && !RolapStar.disableCaching) {
View Full Code Here

Examples of mondrian.rolap.agg.Aggregation

                    for (Map.Entry<AggregationKey, Aggregation> e
                        : sharedAggregations.entrySet())
                    {
                        AggregationKey aggregationKey = e.getKey();

                        Aggregation aggregation = e.getValue();
                        if (changeListener.isAggregationChanged(aggregation)) {
                            // Create new thread local aggregation
                            // This thread will renew aggregations
                            // And these will be checked in if all queries
                            // that are currently using these aggregates
                            // are finished
                            aggregation = new Aggregation(aggregationKey);

                            localAggregations.get().put(
                                aggregationKey, aggregation);
                        }
                    }
View Full Code Here

Examples of mondrian.rolap.agg.Aggregation

                Iterator<Map.Entry<AggregationKey, Aggregation>>
                    it = pendingAggregations.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<AggregationKey, Aggregation> e = it.next();
                    AggregationKey aggregationKey = e.getKey();
                    Aggregation aggregation = e.getValue();
                    // In case this aggregation is not requested by anyone
                    // this aggregation may be pushed into global cache
                    // otherwise put it in pending cache, that will be pushed
                    // when another query finishes
                    if (!isAggregationRequested(aggregationKey)) {
                        pushAggregateModification(
                            aggregationKey, aggregation, sharedAggregations);
                        it.remove();
                    }
                }
                // Push thread local modifications
                it = localAggregations.get().entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<AggregationKey, Aggregation> e = it.next();
                    AggregationKey aggregationKey = e.getKey();
                    Aggregation aggregation = e.getValue();
                    // In case this aggregation is not requested by anyone
                    // this aggregation may be pushed into global cache
                    // otherwise put it in pending cache, that will be pushed
                    // when another query finishes
                    Map<AggregationKey, Aggregation> targetMap;
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.