Package com.facebook.presto.spi.block

Examples of com.facebook.presto.spi.block.Block


    {
        Accumulator accumulator = function.bind(ImmutableList.of(0), Optional.<Integer>absent(), Optional.of(sampleWeightChannel), confidence).createAccumulator();
        for (Page page : pages) {
            accumulator.addInput(page);
        }
        Block result = accumulator.evaluateFinal();

        if (expectedValue == null) {
            return BlockAssertions.toValues(function.getFinalType(), result).get(0) == null;
        }
View Full Code Here


            if (page.getPositionCount() > 0) {
                partialAccumulator.addInput(page);
            }
        }

        Block partialBlock = partialAccumulator.evaluateIntermediate();

        Accumulator finalAggregation = factory.createIntermediateAccumulator();
        finalAggregation.addIntermediate(partialBlock);

        Block finalBlock = finalAggregation.evaluateFinal();

        if (expectedValue == null) {
            return BlockAssertions.toValues(function.getFinalType(), finalBlock).get(0) == null;
        }
View Full Code Here

            if (page.getPositionCount() > 0) {
                aggregation.addInput(page);
            }
        }

        Block block = aggregation.evaluateFinal();
        return BlockAssertions.getOnlyValue(aggregation.getFinalType(), block);
    }
View Full Code Here

            if (page.getPositionCount() > 0) {
                partialAggregation.addInput(page);
            }
        }

        Block partialBlock = partialAggregation.evaluateIntermediate();

        Accumulator finalAggregation = factory.createIntermediateAccumulator();
        // Test handling of empty intermediate blocks
        Block emptyBlock = factory.createAccumulator().evaluateIntermediate();
        finalAggregation.addIntermediate(emptyBlock);
        finalAggregation.addIntermediate(partialBlock);

        Block finalBlock = finalAggregation.evaluateFinal();
        return BlockAssertions.getOnlyValue(finalAggregation.getFinalType(), finalBlock);
    }
View Full Code Here

            partialAggregation.addInput(createGroupByIdBlock(0, page.getPositionCount()), page);
        }

        BlockBuilder partialOut = partialAggregation.getIntermediateType().createBlockBuilder(new BlockBuilderStatus());
        partialAggregation.evaluateIntermediate(0, partialOut);
        Block partialBlock = partialOut.build();

        GroupedAccumulator finalAggregation = factory.createGroupedIntermediateAccumulator();
        // Add an empty block to test the handling of empty intermediates
        GroupedAccumulator emptyAggregation = factory.createGroupedAccumulator();
        BlockBuilder emptyOut = emptyAggregation.getIntermediateType().createBlockBuilder(new BlockBuilderStatus());
        emptyAggregation.evaluateIntermediate(0, emptyOut);
        Block emptyBlock = emptyOut.build();
        finalAggregation.addIntermediate(createGroupByIdBlock(0, emptyBlock.getPositionCount()), emptyBlock);

        finalAggregation.addIntermediate(createGroupByIdBlock(0, partialBlock.getPositionCount()), partialBlock);

        return getGroupValue(finalAggregation, 0);
    }
View Full Code Here

        return newPages;
    }

    private static RunLengthEncodedBlock createNullRLEBlock(int positionCount)
    {
        Block value = BOOLEAN.createBlockBuilder(new BlockBuilderStatus())
                .appendNull()
                .build();

        return new RunLengthEncodedBlock(value, positionCount);
    }
View Full Code Here

                        0.5));
    }

    private static Page createPage(Double[] values, double percentile)
    {
        Block valuesBlock;
        Block percentilesBlock;

        if (values.length == 0) {
            valuesBlock = EMPTY_DOUBLE_BLOCK;
            percentilesBlock = EMPTY_DOUBLE_BLOCK;
        }
View Full Code Here

        return new Page(valuesBlock, percentilesBlock);
    }

    private static Page createPage(Long[] values, double percentile)
    {
        Block valuesBlock;
        Block percentilesBlock;

        if (values.length == 0) {
            valuesBlock = EMPTY_LONG_BLOCK;
            percentilesBlock = EMPTY_DOUBLE_BLOCK;
        }
View Full Code Here

    private static Page createPage(Long[] values, Long[] weights, double percentile)
    {
        Preconditions.checkArgument(values.length == weights.length, "values.length must match weights.length");

        Block valuesBlock;
        Block weightsBlock;
        Block percentilesBlock;

        if (values.length == 0) {
            valuesBlock = EMPTY_LONG_BLOCK;
            weightsBlock = EMPTY_LONG_BLOCK;
            percentilesBlock = EMPTY_DOUBLE_BLOCK;
View Full Code Here

    private static Page createPage(Double[] values, Long[] weights, double percentile)
    {
        Preconditions.checkArgument(values.length == weights.length, "values.length must match weights.length");

        Block valuesBlock;
        Block weightsBlock;
        Block percentilesBlock;

        if (values.length == 0) {
            valuesBlock = EMPTY_DOUBLE_BLOCK;
            weightsBlock = EMPTY_LONG_BLOCK;
            percentilesBlock = EMPTY_DOUBLE_BLOCK;
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.block.Block

Copyright © 2018 www.massapicom. 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.