Package com.facebook.presto.block

Examples of com.facebook.presto.block.Block


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

        return withinErrorBound(BlockAssertions.toValues(result).get(0).toString(), expectedValue);
    }
View Full Code Here


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

        Block partialBlock = partialAccumulator.evaluateIntermediate();

        Accumulator finalAggregation = function.createDeterministicIntermediateAggregation(confidence, 0);
        finalAggregation.addIntermediate(partialBlock);

        Block finalBlock = finalAggregation.evaluateFinal();

        return withinErrorBound(BlockAssertions.toValues(finalBlock).get(0).toString(), expectedValue);
    }
View Full Code Here

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

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

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

        Block partialBlock = partialAggregation.evaluateIntermediate();

        Accumulator finalAggregation = function.createIntermediateAggregation(confidence);
        // Test handling of empty intermediate blocks
        Block emptyBlock = function.createAggregation(Optional.<Integer>absent(), Optional.<Integer>absent(), confidence, args).evaluateIntermediate();
        finalAggregation.addIntermediate(emptyBlock);
        finalAggregation.addIntermediate(partialBlock);

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

                        0.5));
    }

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

        if (values.length == 0) {
            valuesBlock = new UncompressedBlock(0, SINGLE_DOUBLE, EMPTY_SLICE);
            percentilesBlock = new UncompressedBlock(0, SINGLE_DOUBLE, EMPTY_SLICE);
        }
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 = new UncompressedBlock(0, SINGLE_LONG, EMPTY_SLICE);
            percentilesBlock = new UncompressedBlock(0, SINGLE_DOUBLE, EMPTY_SLICE);
        }
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 = new UncompressedBlock(0, SINGLE_LONG, EMPTY_SLICE);
            weightsBlock = new UncompressedBlock(0, SINGLE_LONG, EMPTY_SLICE);
            percentilesBlock = new UncompressedBlock(0, SINGLE_DOUBLE, EMPTY_SLICE);
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 = new UncompressedBlock(0, SINGLE_DOUBLE, EMPTY_SLICE);
            weightsBlock = new UncompressedBlock(0, SINGLE_LONG, EMPTY_SLICE);
            percentilesBlock = new UncompressedBlock(0, SINGLE_DOUBLE, EMPTY_SLICE);
View Full Code Here

                }
            }
            Accumulator accumulator = getFunction().createAggregation(Optional.<Integer>absent(), Optional.<Integer>absent(), getConfidence(), 0);

            accumulator.addInput(new Page(builder.build()));
            Block result = accumulator.evaluateFinal();

            String approxValue = BlockAssertions.toValues(result).get(0).toString();
            double approxAvg = Double.parseDouble(approxValue.split(" ")[0]);
            double error = Double.parseDouble(approxValue.split(" ")[2]);
View Full Code Here

                if (blockEncodings == null) {
                    Block[] blocks = page.getBlocks();
                    blockEncodings = new BlockEncoding[blocks.length];
                    sliceOutput.writeInt(blocks.length);
                    for (int i = 0; i < blocks.length; i++) {
                        Block block = blocks[i];
                        BlockEncoding blockEncoding = block.getEncoding();
                        blockEncodings[i] = blockEncoding;
                        BlockEncodings.writeBlockEncoding(sliceOutput, blockEncoding);
                    }
                }
View Full Code Here

TOP

Related Classes of com.facebook.presto.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.