Package com.facebook.presto.tuple

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


    /**
     * 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


    public static Page createSequencePage(List<TupleInfo> tupleInfos1, int length, int... initialValues)
    {
        Block[] blocks = new Block[initialValues.length];
        for (int i = 0; i < blocks.length; i++) {
            TupleInfo tupleInfo = tupleInfos1.get(i);
            int initialValue = initialValues[i];

            if (tupleInfo.equals(SINGLE_LONG)) {
                blocks[i] = BlockAssertions.createLongSequenceBlock(initialValue, initialValue + length);
            }
            else if (tupleInfo.equals(SINGLE_DOUBLE)) {
                blocks[i] = BlockAssertions.createDoubleSequenceBlock(initialValue, initialValue + length);
            }
            else if (tupleInfo.equals(SINGLE_VARBINARY)) {
                blocks[i] = BlockAssertions.createStringSequenceBlock(initialValue, initialValue + length);
            }
            else if (tupleInfo.equals(SINGLE_BOOLEAN)) {
                blocks[i] = BlockAssertions.createBooleanSequenceBlock(initialValue, initialValue + length);
            }
            else {
                throw new IllegalStateException("Unsupported tuple info " + tupleInfo);
            }
View Full Code Here

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

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

    public static Builder resultBuilder(Type... types)
    {
        ImmutableList.Builder<TupleInfo> tupleInfos = ImmutableList.builder();
        for (Type type : types) {
            tupleInfos.add(new TupleInfo(type));
        }
        return resultBuilder(tupleInfos.build());
    }
View Full Code Here

        ClientSession session = new ClientSession(coordinator.getBaseUrl(), "testuser", "test", "default", "default", true);

        try (StatementClient client = new StatementClient(httpClient, queryResultsCodec, session, sql)) {
            AtomicBoolean loggedUri = new AtomicBoolean(false);
            ImmutableList.Builder<Tuple> rows = ImmutableList.builder();
            TupleInfo tupleInfo = null;

            while (client.isValid()) {
                QueryResults results = client.current();
                if (!loggedUri.getAndSet(true)) {
                    log.info("Query %s: %s?pretty", results.getId(), results.getInfoUri());
View Full Code Here

        }
    }

    private static TupleInfo getTupleInfo(List<Column> columns)
    {
        return new TupleInfo(transform(transform(columns, Column.typeGetter()), tupleType()));
    }
View Full Code Here

        public Iterator<Page> build()
        {
            List<Type> types = groupByHash.getTypes();
            ImmutableList.Builder<TupleInfo> tupleInfos = ImmutableList.builder();
            for (Type type : types) {
                tupleInfos.add(new TupleInfo(type));
            }
            for (Aggregator aggregator : aggregators) {
                tupleInfos.add(aggregator.getTupleInfo());
            }
View Full Code Here

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

        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 UncompressedBlock build()
        {
            checkState(!positionOffsets.isEmpty(), "Cannot build an empty block");

            return new UncompressedBlock(positionOffsets.size(), new TupleInfo(type), sliceOutput.slice());
        }
View Full Code Here

            for (Symbol symbol : node.getOutputSymbols()) {
                Input input = new Input(channel);
                outputMappings.put(symbol, input);

                Type type = checkNotNull(context.getTypes().get(symbol), "No type for symbol %s", symbol);
                outputTypes.add(new TupleInfo(type.getRawType()));

                channel++;
            }

            PageBuilder pageBuilder = new PageBuilder(outputTypes);
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.