Package com.facebook.presto.spi.block

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


    @Test
    public void testHashBuilderResize()
    {
        BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());
        VARCHAR.writeSlice(builder, Slices.allocate(200_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


        VARCHAR.writeSlice(builder, Slices.allocate(200_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();

        DriverContext driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION, new DataSize(10, Unit.MEGABYTE))
                .addPipelineContext(true, true)
View Full Code Here

    @Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Task exceeded max memory size of 3MB")
    public void testHashBuilderResizeLimit()
    {
        BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());
        VARCHAR.writeSlice(builder, 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

        VARCHAR.writeSlice(builder, 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();

        DriverContext driverContext = new TaskContext(new TaskId("query", "stage", "task"), executor, TEST_SESSION, new DataSize(3, Unit.MEGABYTE))
                .addPipelineContext(true, true)
View Full Code Here

        // project
        projectionFunction.project(position, blocks, builder);

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

    private static Block createBlock(Type type, Object value)
    {
View Full Code Here

    private static Block createBlock(Type type, Object value)
    {
        BlockBuilder blockBuilder = type.createBlockBuilder(new BlockBuilderStatus());
        BlockUtils.appendObject(type, blockBuilder, value);
        return blockBuilder.build();
    }
}
View Full Code Here

            else {
                throw new RuntimeException("Unsupported Java type " + type.getJavaType());
            }
            nullsBlockBuilder.appendNull();
        }
        return nullsBlockBuilder.build();
    }

    @Test
    public void testBlock()
    {
View Full Code Here

        assertPositionValue(block.getRegion(0, position + 1), position, expectedStackValue, hash, expectedObjectValue);
        assertPositionValue(block.getRegion(position, block.getPositionCount() - position), 0, expectedStackValue, hash, expectedObjectValue);

        BlockBuilder blockBuilder = type.createBlockBuilder(new BlockBuilderStatus());
        type.appendTo(block, position, blockBuilder);
        assertPositionValue(blockBuilder.build(), 0, expectedStackValue, hash, expectedObjectValue);
    }

    private void assertPositionValue(Block block, int position, Object expectedStackValue, int expectedHash, Object expectedObjectValue)
    {
        Object objectValue = type.getObjectValue(SESSION, block, position);
View Full Code Here

            type.writeSlice(blockBuilder, slice, 0, slice.length());
        }
        else {
            throw new UnsupportedOperationException("not yet implemented: " + javaType);
        }
        return blockBuilder.build();
    }

    protected abstract Object getGreaterValue(Object value);

    protected Object getNonNullValue()
View Full Code Here

            type.writeSlice(blockBuilder, slice, 0, slice.length());
        }
        else {
            throw new UnsupportedOperationException("not yet implemented: " + javaType);
        }
        return blockBuilder.build();
    }

    private static SortedMap<Integer, Object> indexStackValues(Type type, Block block)
    {
        SortedMap<Integer, Object> values = new TreeMap<>();
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.