Package com.facebook.presto.operator

Examples of com.facebook.presto.operator.Page


        public void addInput(Page page)
        {
            Block[] blocks = Arrays.copyOf(page.getBlocks(), page.getChannelCount());
            for (int i = 0; i < accumulators.size(); i++) {
                blocks[sampleWeightChannel] = resampleWeightBlock(page.getBlock(sampleWeightChannel));
                accumulators.get(i).addInput(new Page(blocks));
            }
        }
View Full Code Here


        public void addIntermediate(Block block)
        {
            BlockCursor cursor = block.cursor();
            checkArgument(cursor.advanceNextPosition());
            SliceInput sliceInput = new BasicSliceInput(cursor.getSlice());
            Page page = Iterators.getOnlyElement(PagesSerde.readPages(sliceInput));
            checkArgument(page.getChannelCount() == accumulators.size(), "number of blocks does not match accumulators");

            for (int i = 0; i < page.getChannelCount(); i++) {
                accumulators.get(i).addIntermediate(page.getBlock(i));
            }
        }
View Full Code Here

                blocks[i] = accumulators.get(i).evaluateIntermediate();
                sizeEstimate += blocks[i].getDataSize().toBytes();
            }

            SliceOutput output = new DynamicSliceOutput(sizeEstimate);
            PagesSerde.writePages(output, new Page(blocks));
            BlockBuilder builder = new BlockBuilder(SINGLE_VARBINARY);
            builder.append(output.slice());
            return builder.build();
        }
View Full Code Here

        public void addInput(GroupByIdBlock groupIdsBlock, Page page)
        {
            Block[] blocks = Arrays.copyOf(page.getBlocks(), page.getChannelCount());
            for (int i = 0; i < accumulators.size(); i++) {
                blocks[sampleWeightChannel] = resampleWeightBlock(page.getBlock(sampleWeightChannel));
                accumulators.get(i).addInput(groupIdsBlock, new Page(blocks));
            }
        }
View Full Code Here

        public void addIntermediate(GroupByIdBlock groupIdsBlock, Block block)
        {
            BlockCursor cursor = block.cursor();
            checkArgument(cursor.advanceNextPosition());
            SliceInput sliceInput = new BasicSliceInput(cursor.getSlice());
            Page page = Iterators.getOnlyElement(PagesSerde.readPages(sliceInput));
            checkArgument(page.getChannelCount() == accumulators.size(), "number of blocks does not match accumulators");

            for (int i = 0; i < page.getChannelCount(); i++) {
                accumulators.get(i).addIntermediate(groupIdsBlock, page.getBlock(i));
            }
        }
View Full Code Here

                blocks[i] = builder.build();
                sizeEstimate += blocks[i].getDataSize().toBytes();
            }

            SliceOutput sliceOutput = new DynamicSliceOutput(sizeEstimate);
            PagesSerde.writePages(sliceOutput, new Page(blocks));
            output.append(sliceOutput.slice());
        }
View Full Code Here

            ImmutableList.Builder<RowIterable> pages = ImmutableList.builder();
            // wait up to max wait for data to arrive; then try to return at least DESIRED_RESULT_BYTES
            int bytes = 0;
            while (bytes < DESIRED_RESULT_BYTES) {
                Page page = exchangeClient.getNextPage(maxWait);
                if (page == null) {
                    break;
                }
                bytes += page.getDataSize().toBytes();
                pages.add(new RowIterable(session, page));

                // only wait on first call
                maxWait = new Duration(0, TimeUnit.MILLISECONDS);
            }
View Full Code Here

            List<String> data = ImmutableList.of("apple", "banana", "cherry", "date");

            // load initial pages
            for (int i = 0; i < initialPages; i++) {
                checkState(sharedBuffer.enqueue(new Page(createStringsBlock(Iterables.concat(Collections.nCopies(i + 1, data))))).isDone(), "Unable to add page to buffer");
            }
            sharedBuffer.finish();
        }
View Full Code Here

                }
                else {
                    throw new AssertionError("Can only handle longs and doubles");
                }
            }
            Page page = new Page(builder.build());
            page = OperatorAssertion.appendSampleWeight(ImmutableList.of(page), 2).get(0);
            Accumulator accumulator = getFunction().createAggregation(Optional.<Integer>absent(), Optional.of(page.getChannelCount() - 1), getConfidence(), 0);

            accumulator.addInput(page);
            Block result = accumulator.evaluateFinal();

            String approxValue = BlockAssertions.toValues(result).get(0).toString();
View Full Code Here

    }

    @Override
    protected void testAggregation(Object expectedValue, Block block)
    {
        Page page = OperatorAssertion.appendSampleWeight(ImmutableList.of(new Page(block)), 2).get(0);
        assertApproximateAggregation(getFunction(), page.getChannelCount() - 1, getConfidence(), (Double) expectedValue, page);
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.operator.Page

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.