Package com.facebook.presto.tuple

Examples of com.facebook.presto.tuple.TupleInfo$Builder


        return sortOrder;
    }

    private static int[] defaultSortFields(List<TupleInfo> sourceTupleInfos, int orderByChannel)
    {
        TupleInfo orderByTupleInfo = sourceTupleInfos.get(orderByChannel);
        int[] sortFields = new int[orderByTupleInfo.getFieldCount()];
        for (int i = 0; i < sortFields.length; i++) {
            sortFields[i] = i;
        }
        return sortFields;
    }
View Full Code Here


        return readDictionary(sliceInput);
    }

    public static Dictionary readDictionary(SliceInput sliceInput)
    {
        TupleInfo tupleInfo = UncompressedTupleInfoSerde.deserialize(sliceInput);

        int dictionarySize = sliceInput.readInt();
        checkArgument(dictionarySize >= 0);

        Slice[] dictionary = new Slice[dictionarySize];

        for (int i = 0; i < dictionarySize; i++) {
            dictionary[i] = tupleInfo.extractTupleSlice(sliceInput);
        }

        return new Dictionary(tupleInfo, dictionary);
    }
View Full Code Here

            Preconditions.checkArgument(fieldIndex >= 0, "fieldIndex is negative");

            this.columnType = columnType;
            this.channelIndex = channelIndex;
            this.fieldIndex = fieldIndex;
            this.info = new TupleInfo(columnType);
        }
View Full Code Here

            ImmutableList.Builder<Type> builder = ImmutableList.builder();
            for (ProjectionFunction projection : projections) {
                builder.addAll(projection.getTupleInfo().getTypes());
            }
            this.tupleInfo = new TupleInfo(builder.build());
        }
View Full Code Here

        this.cursor = checkNotNull(cursor, "cursor is null");

        // project each field into a separate channel
        ImmutableList.Builder<TupleInfo> tupleInfos = ImmutableList.builder();
        for (ColumnType columnType : columnTypes) {
            tupleInfos.add(new TupleInfo(Type.fromColumnType(columnType)));
        }
        this.tupleInfos = tupleInfos.build();

        pageBuilder = new PageBuilder(getTupleInfos());
    }
View Full Code Here

    {
    }

    public static BlockIterable createBlockIterable(Block firstBlock, Block... otherBlocks)
    {
        TupleInfo tupleInfo = firstBlock.getTupleInfo();
        return new StaticBlockIterable(tupleInfo, ImmutableList.<Block>builder().add(firstBlock).add(otherBlocks).build());
    }
View Full Code Here

        return new StaticBlockIterable(tupleInfo, ImmutableList.<Block>builder().add(firstBlock).add(otherBlocks).build());
    }

    public static BlockIterable createBlockIterable(Iterable<? extends Block> blocks)
    {
        TupleInfo tupleInfo = Iterables.get(blocks, 0).getTupleInfo();
        return new StaticBlockIterable(tupleInfo, ImmutableList.copyOf(blocks));
    }
View Full Code Here

        for (String columnName : columnNames) {
            ColumnHandle columnHandle = metadata.getColumnHandle(tableHandle, columnName).orNull();
            checkArgument(columnHandle != null, "Table %s does not have a column %s", tableName, columnName);
            columnHandlesBuilder.add(columnHandle);
            ColumnMetadata columnMetadata = metadata.getColumnMetadata(tableHandle, columnHandle);
            columnTypesBuilder.add(new TupleInfo(fromColumnType(columnMetadata.getType())));
        }
        final List<ColumnHandle> columnHandles = columnHandlesBuilder.build();
        final List<TupleInfo> columnTypes = columnTypesBuilder.build();

        // get the split for this table
View Full Code Here

    /**
     * Produce a block with the given values in the last field.
     */
    private Block createBlock(List<Object> values)
    {
        BlockBuilder blockBuilder = new BlockBuilder(new TupleInfo(getValueType()));

        for (Object value : values) {
            if (value == null) {
                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));

        assertEquals(cursor.isNull(), tuple.isNull());
        switch (tupleInfo.getType()) {
            case BOOLEAN:
                assertEquals(cursor.getBoolean(), tuple.getBoolean());
                try {
                    cursor.getSlice();
                    fail("Expected IllegalStateException or UnsupportedOperationException");
View Full Code Here

TOP

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

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.