Package com.facebook.presto.tuple

Examples of com.facebook.presto.tuple.TupleInfo


                },
                ImmutableList.of(concat(singleColumn(VARIABLE_BINARY, 0, 0), singleColumn(FIXED_INT_64, 1, 0))));

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = resultBuilder(new TupleInfo(VARIABLE_BINARY, FIXED_INT_64))
                .row("10", 10)
                .row("11", 11)
                .row("12", 12)
                .row("13", 13)
                .row("14", 14)
View Full Code Here


        ImmutableList.Builder<Type> types = ImmutableList.builder();
        for (TupleInfo sourceTupleInfo : checkNotNull(sourceTupleInfos, "sourceTupleInfos is null")) {
            types.addAll(sourceTupleInfo.getTypes());
        }
        resultBuilder = MaterializedResult.resultBuilder(new TupleInfo(types.build()));
    }
View Full Code Here

    @Test
    public void testMultiFieldKey()
            throws Exception
    {
        TupleInfo tupleInfo = new TupleInfo(VARIABLE_BINARY, FIXED_INT_64);
        List<Page> input = rowPagesBuilder(tupleInfo)
                .row("a", 1)
                .row("b", 2)
                .pageBreak()
                .row("b", 3)
View Full Code Here

    }

    @Test
    public void testMultiSliceAggregationOutput()
    {
        long fixedWidthSize = new TupleInfo(TupleInfo.Type.FIXED_INT_64, TupleInfo.Type.DOUBLE).getFixedSize();
        int multiSlicePositionCount = (int) (BlockBuilder.DEFAULT_MAX_BLOCK_SIZE.toBytes() / fixedWidthSize) * 2;

        List<Page> input = rowPagesBuilder(SINGLE_VARBINARY, SINGLE_LONG)
                .addSequencePage(multiSlicePositionCount, 0, 0)
                .build();
View Full Code Here

public class TestTupleInfoSerde
{
    @Test
    public void testRoundTrip()
    {
        TupleInfo expectedTupleInfo = new TupleInfo(BOOLEAN, FIXED_INT_64, VARIABLE_BINARY, DOUBLE);

        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        writeTupleInfo(sliceOutput, expectedTupleInfo);
        TupleInfo actualTupleInfo = readTupleInfo(sliceOutput.slice().getInput());
        assertEquals(actualTupleInfo, expectedTupleInfo);
    }
View Full Code Here

        TupleInfo.Type[] types = new TupleInfo.Type[field + 1];
        Arrays.fill(types, TupleInfo.Type.VARIABLE_BINARY);

        types[field] = Iterables.getOnlyElement(sequenceBlock.getTupleInfo().getTypes());

        BlockBuilder blockBuilder = new BlockBuilder(new TupleInfo(types));
        BlockCursor cursor = sequenceBlock.cursor();
        while (cursor.advanceNextPosition()) {
            for (int i = 0; i < field; i++) {
                blockBuilder.appendNull();
            }
View Full Code Here

        assertCurrentValue(cursor, position, tuple);
    }

    public static void assertCurrentValue(BlockCursor cursor, int position, Tuple tuple)
    {
        TupleInfo tupleInfo = tuple.getTupleInfo();
        assertEquals(cursor.getTupleInfo(), tupleInfo);

        assertEquals(cursor.getTuple(), tuple);
        assertEquals(cursor.getPosition(), position);
        assertTrue(cursor.currentTupleEquals(tuple));

        for (int index = 0; index < tupleInfo.getFieldCount(); index++) {
            assertEquals(cursor.isNull(index), tuple.isNull(index));
            switch (tupleInfo.getTypes().get(index)) {
                case BOOLEAN:
                    assertEquals(cursor.getBoolean(index), tuple.getBoolean(index));
                    try {
                        cursor.getSlice(index);
                        fail("Expected IllegalStateException or UnsupportedOperationException");
View Full Code Here

        extends AbstractTestBlockCursor
{
    @Override
    protected Block createExpectedValues()
    {
        return new BlockBuilder(new TupleInfo(VARIABLE_BINARY, FIXED_INT_64))
                .appendNull()
                .appendNull()
                .append("apple")
                .append(12)
                .appendNull()
View Full Code Here

        extends AbstractTestBlockCursor
{
    @Override
    protected Block createExpectedValues()
    {
        return new BlockBuilder(new TupleInfo(VARIABLE_BINARY, FIXED_INT_64))
                .append("apple")
                .append(11)
                .append("apple")
                .append(12)
                .append("apple")
View Full Code Here

        return builder.build();
    }

    public static BlockIterableBuilder blockIterableBuilder(Type... types)
    {
        return new BlockIterableBuilder(new TupleInfo(types));
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.tuple.TupleInfo

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.