Package com.facebook.presto.block

Examples of com.facebook.presto.block.Block


    public void addInput(Page page)
    {
        checkNotNull(page, "page is null");
        checkState(!isFinished(), "Operator is already finished");

        Block sourceBlock = page.getBlock(setChannel);
        channelSetBuilder.addBlock(sourceBlock);
    }
View Full Code Here


                while (cursor.advanceNextPosition()) {
                    function.addIntermediate(cursor, input.getField(), intermediateValue, 0);
                }
            }
            else {
                Block block;
                int field = -1;
                if (input != null) {
                    block = page.getBlock(input.getChannel());
                    field = input.getField();
                }
View Full Code Here

            }

            operatorContext.addOutputItems(sourceId, ImmutableSet.of(new MaterializedViewWriterResult(input.get().getShardUuid(), nodeIdentifier)));
        }

        Block block = new BlockBuilder(SINGLE_LONG).append(rowCount).build();
        return new Page(block);
    }
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);
        finalAggregation.addIntermediate(partialBlock);

        Block finalBlock = finalAggregation.evaluateFinal();
        return BlockAssertions.getOnlyValue(finalBlock);
    }
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

    @Test
    public void testAllPositionsNull()
            throws Exception
    {
        Block block = new RunLengthEncodedBlock(nullTuple(getSequenceBlock(0, 10).getTupleInfo()), 10);
        assertAggregation(getFunction(), getExpectedValueIncludingNulls(0, 0, 10), 10, block);
    }
View Full Code Here

    }

    @Test
    public void testMixedNullAndNonNullPositions()
    {
        Block alternatingNullsBlock = createAlternatingNullsBlock(getSequenceBlock(0, 10));
        assertAggregation(getFunction(), getExpectedValueIncludingNulls(0, 10, 20), 20, alternatingNullsBlock);
    }
View Full Code Here

    @Test
    public void testAllPositionsNull()
            throws Exception
    {
        Block block = new RunLengthEncodedBlock(nullTuple(getSequenceBlock(0, 10).getTupleInfo()), 10);
        assertAggregation(getFunction(), getConfidence(), getExpectedValueIncludingNulls(0, 0, 10), 10, block);
    }
View Full Code Here

    }

    @Test
    public void testMixedNullAndNonNullPositions()
    {
        Block alternatingNullsBlock = createAlternatingNullsBlock(getSequenceBlock(0, 10));
        assertAggregation(getFunction(), getConfidence(), getExpectedValueIncludingNulls(0, 10, 20), 20, alternatingNullsBlock);
    }
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.