Package com.facebook.presto.metadata

Examples of com.facebook.presto.metadata.Signature


        return new Signature(SWITCH, returnType);
    }

    public static Signature whenSignature(Type returnType)
    {
        return new Signature("WHEN", returnType);
    }
View Full Code Here


        @Override
        public RowExpression visitCall(CallExpression call, final Void context)
        {
            FunctionInfo function;
            Signature signature = call.getSignature();
            switch (signature.getName()) {
                // TODO: optimize these special forms
                case IF:
                case NULL_IF:
                case SWITCH:
                case TRY_CAST:
                case IS_NULL:
                case "IS_DISTINCT_FROM":
                case COALESCE:
                case "AND":
                case "OR":
                case IN:
                    return call;
                case CAST:
                    if (call.getArguments().get(0).getType().equals(UnknownType.UNKNOWN)) {
                        return constantNull(call.getType());
                    }
                    function = registry.getCoercion(call.getArguments().get(0).getType(), call.getType());
                    break;
                default:
                    function = registry.getExactFunction(signature);
                    if (function == null) {
                        // TODO: temporary hack to deal with magic timestamp literal functions which don't have an "exact" form and need to be "resolved"
                        function = registry.resolveFunction(QualifiedName.of(signature.getName()), signature.getArgumentTypes(), false);
                    }
            }

            List<RowExpression> arguments = Lists.transform(call.getArguments(), new Function<RowExpression, RowExpression>()
            {
View Full Code Here

            Map<Symbol, FunctionCall> finalCalls = new HashMap<>();
            Map<Symbol, FunctionCall> intermediateCalls = new HashMap<>();
            Map<Symbol, Signature> intermediateFunctions = new HashMap<>();
            Map<Symbol, Symbol> intermediateMask = new HashMap<>();
            for (Map.Entry<Symbol, FunctionCall> entry : aggregations.entrySet()) {
                Signature signature = functions.get(entry.getKey());
                FunctionInfo function = metadata.getExactFunction(signature);

                Symbol intermediateSymbol = allocator.newSymbol(function.getName().getSuffix(), function.getIntermediateType());
                intermediateCalls.put(intermediateSymbol, entry.getValue());
                intermediateFunctions.put(intermediateSymbol, signature);
View Full Code Here

        protected RowExpression visitFunctionCall(FunctionCall node, Void context)
        {
            List<RowExpression> arguments = Lists.transform(node.getArguments(), processFunction(context));

            List<Type> argumentTypes = Lists.transform(arguments, typeGetter());
            Signature signature = new Signature(node.getName().getSuffix(), types.get(node), argumentTypes);

            return call(signature, arguments);
        }
View Full Code Here

    public static ByteCodeNode generateInvocation(CompilerContext context, FunctionInfo function, ByteCodeNode getSessionByteCode, List<ByteCodeNode> arguments, Binding binding)
    {
        MethodType methodType = binding.getType();

        Signature signature = function.getSignature();
        Class<?> unboxedReturnType = Primitives.unwrap(methodType.returnType());

        LabelNode end = new LabelNode("end");
        Block block = new Block(context)
                .setDescription("invoke " + signature);
View Full Code Here

{
    private final Constructor<T> constructor;

    public ReflectionWindowFunctionSupplier(String name, Type returnType, List<? extends Type> argumentTypes, Class<T> type)
    {
        this(new Signature(name, returnType, argumentTypes), type);
    }
View Full Code Here

        return new FunctionCall(QualifiedName.of("test"), ImmutableList.<Expression>of());
    }

    private static Signature fakeFunctionHandle(String name)
    {
        return new Signature(name, Type.NULL, ImmutableList.<Type>of());
    }
View Full Code Here

        return new FunctionCall(QualifiedName.of("test"), ImmutableList.<Expression>of());
    }

    private static Signature fakeFunctionHandle(String name)
    {
        return new Signature(name, UnknownType.NAME, ImmutableList.<String>of());
    }
View Full Code Here

            }
        }).toSet();

        for (Type keyType : orderableTypes) {
            for (Type valueType : metadata.getTypeManager().getTypes()) {
                assertNotNull(metadata.getExactFunction(new Signature("max_by", valueType.getName(), valueType.getName(), keyType.getName())));
            }
        }
    }
View Full Code Here

    @Test
    public void testNull()
            throws Exception
    {
        InternalAggregationFunction doubleDouble = metadata.getExactFunction(new Signature("max_by", StandardTypes.DOUBLE, StandardTypes.DOUBLE, StandardTypes.DOUBLE)).getAggregationFunction();
        assertAggregation(
                doubleDouble,
                1.0,
                null,
                createPage(
View Full Code Here

TOP

Related Classes of com.facebook.presto.metadata.Signature

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.