Package com.facebook.presto.spi.block

Examples of com.facebook.presto.spi.block.BlockBuilder.build()


    @Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Task exceeded max memory size of 3MB")
    public void testHashBuilderResizeLimit()
    {
        BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());
        builder.appendSlice(Slices.allocate(5_000_000)); // this must be larger than DEFAULT_MAX_BLOCK_SIZE, 64K
        builder.build();

        List<Page> input = rowPagesBuilder(VARCHAR)
                .addSequencePage(10, 100)
                .addBlocksPage(builder.build())
                .addSequencePage(10, 100)
View Full Code Here


        builder.appendSlice(Slices.allocate(5_000_000)); // this must be larger than DEFAULT_MAX_BLOCK_SIZE, 64K
        builder.build();

        List<Page> input = rowPagesBuilder(VARCHAR)
                .addSequencePage(10, 100)
                .addBlocksPage(builder.build())
                .addSequencePage(10, 100)
                .build();

        ConnectorSession session = new ConnectorSession("user", "source", "catalog", "schema", UTC_KEY, Locale.ENGLISH, "address", "agent");
        DriverContext driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, session, new DataSize(3, Unit.MEGABYTE))
View Full Code Here

                for (int i = 0; i < page.getPositionCount(); i++) {
                    builder.appendLong(sampleWeight);
                }
                Block[] blocks = new Block[page.getChannelCount() + 1];
                System.arraycopy(page.getBlocks(), 0, blocks, 0, page.getChannelCount());
                blocks[blocks.length - 1] = builder.build();
                return new Page(blocks);
            }
        }).list();
    }
View Full Code Here

        // project
        projectionFunction.project(channels, builder);

        // extract single value
        Object actualValue = BlockAssertions.getOnlyValue(builder.build());
        assertEquals(actualValue, expectedValue);
    }

    private static BlockCursor createCursor(Type type, Object value)
    {
View Full Code Here

    private static BlockCursor createCursor(Type type, Object value)
    {
        BlockBuilder blockBuilder = type.createBlockBuilder(new BlockBuilderStatus());
        BlockUtils.appendObject(blockBuilder, value);
        BlockCursor cursor = blockBuilder.build().cursor();
        assertTrue(cursor.advanceNextPosition());
        return cursor;
    }
}
View Full Code Here

    public void testBigintSerializedSize()
    {
        BlockBuilder builder = BIGINT.createBlockBuilder(new BlockBuilderStatus());

        // empty page
        Page page = new Page(builder.build());
        int pageSize = serializedSize(page);
        assertEquals(pageSize, 26); // page overhead

        // page with one value
        page = new Page(builder.appendLong(123).build());
View Full Code Here

            else {
                builder.appendSlice(Slices.utf8Slice(value));
            }
        }

        return builder.build();
    }

    public static BlockIterable createStringsBlockIterable(@Nullable String... values)
    {
        return createBlockIterable(createStringsBlock(values));
View Full Code Here

        for (int i = start; i < end; i++) {
            builder.appendSlice(Slices.utf8Slice(String.valueOf(i)));
        }

        return builder.build();
    }

    public static Block createBooleansBlock(Boolean... values)
    {
        checkNotNull(values, "varargs 'values' is null");
View Full Code Here

    public void testVarcharSerializedSize()
    {
        BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());

        // empty page
        Page page = new Page(builder.build());
        int pageSize = serializedSize(page);
        assertEquals(pageSize, 27); // page overhead

        // page with one value
        page = new Page(builder.appendSlice(Slices.utf8Slice("alice")).build());
View Full Code Here

            else {
                builder.appendBoolean(value);
            }
        }

        return builder.build();
    }

    // This method makes it easy to create blocks without having to add an L to every value
    public static Block createLongsBlock(int... values)
    {
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.