Package com.facebook.presto.spi.type

Examples of com.facebook.presto.spi.type.Type


            public Expression rewriteExpression(Expression node, Void context, ExpressionTreeRewriter<Void> treeRewriter)
            {
                Expression rewrittenExpression = treeRewriter.defaultRewrite(node, context);

                // cast expression if coercion is registered
                Type coercion = analysis.getCoercion(node);
                if (coercion != null) {
                    rewrittenExpression = new Cast(rewrittenExpression, coercion.getName());
                }

                return rewrittenExpression;
            }
        }, parsedExpression);
View Full Code Here


    @Test
    public void testRoundTrip()
    {
        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        writeInfo(sliceOutput, BOOLEAN);
        Type actualType = readType(new TypeRegistry(), sliceOutput.slice().getInput());
        assertEquals(actualType, BOOLEAN);
    }
View Full Code Here

        assertEquals(cursor.isNull(), value == null);
        if (cursor.isNull()) {
            return;
        }

        Type type = cursor.getType();
        if (type == BOOLEAN) {
            assertEquals(cursor.getBoolean(), value);
            try {
                cursor.getLong();
                fail("Expected IllegalStateException or UnsupportedOperationException");
View Full Code Here

        }

        @Override
        protected Type _deserialize(String value, DeserializationContext context)
        {
            Type type = types.get(value.toLowerCase());
            checkArgument(type != null, "Unknown type %s", value);
            return type;
        }
View Full Code Here

        return columns.build();
    }

    private Type getColumnType(MBeanAttributeInfo attribute)
    {
        Type columnType;
        switch (attribute.getType()) {
            case "boolean":
            case "java.lang.Boolean":
                columnType = BOOLEAN;
                break;
View Full Code Here

        checkArgument(objects.size() == types.size(), "objects and types do not have the same size");

        ImmutableList.Builder<Expression> expressions = ImmutableList.builder();
        for (int i = 0; i < objects.size(); i++) {
            Object object = objects.get(i);
            Type type = types.get(i);
            expressions.add(toExpression(object, type));
        }
        return expressions.build();
    }
View Full Code Here

        }

        @Override
        protected Object visitGenericLiteral(GenericLiteral node, ConnectorSession session)
        {
            Type type = metadata.getType(node.getType());
            if (type == null) {
                throw new SemanticException(TYPE_MISMATCH, node, "Unknown type: " + node.getType());
            }

            OperatorInfo operator;
View Full Code Here

                    columns.add(tableScanNode.getAssignments().get(symbol));

                    Input input = new Input(channel);
                    sourceLayout.put(symbol, input);

                    Type type = checkNotNull(context.getTypes().get(symbol), "No type for symbol %s", symbol);
                    sourceTypes.put(input, type);

                    channel++;
                }
            }
View Full Code Here

        private Map<Input, Type> getInputTypes(Map<Symbol, Input> layout, List<Type> types)
        {
            Builder<Input, Type> inputTypes = ImmutableMap.builder();
            for (Input input : ImmutableSet.copyOf(layout.values())) {
                Type type = types.get(input.getChannel());
                inputTypes.put(input, type);
            }
            return inputTypes.build();
        }
View Full Code Here

            int channel = 0;
            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(type);

                channel++;
            }
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.type.Type

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.