Package com.facebook.presto.metadata

Examples of com.facebook.presto.metadata.Signature


        if (type.equals(BOOLEAN)) {
            return new BooleanLiteral(object.toString());
        }

        Signature signature = FunctionRegistry.getMagicLiteralFunctionSignature(type);
        Expression rawLiteral = toExpression(object, FunctionRegistry.type(type.getJavaType()));
        return new FunctionCall(new QualifiedName(signature.getName()), ImmutableList.of(rawLiteral));
    }
View Full Code Here


                for (Expression argument : entry.getValue().getArguments()) {
                    Symbol argumentSymbol = Symbol.fromQualifiedName(((QualifiedNameReference) argument).getName());
                    arguments.add(source.getLayout().get(argumentSymbol));
                }
                Symbol symbol = entry.getKey();
                Signature signature = node.getSignatures().get(symbol);
                windowFunctions.add(metadata.getExactFunction(signature).bindWindowFunction(arguments.build()));
                windowFunctionOutputSymbols.add(symbol);
            }

            // compute the layout of the output from the window operator
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(), false);
    }
View Full Code Here

    public void testEvaluateClassifierPredictions()
            throws Exception
    {
        MetadataManager metadata = new MetadataManager();
        metadata.addFunctions(new MLFunctionFactory().listFunctions());
        InternalAggregationFunction aggregation = metadata.getExactFunction(new Signature("evaluate_classifier_predictions", VARCHAR, BIGINT, BIGINT)).getAggregationFunction();
        Accumulator accumulator = aggregation.createAggregation(Optional.<Integer>absent(), Optional.<Integer>absent(), 1.0, 0, 1);
        accumulator.addInput(getPage());
        Block block = accumulator.evaluateFinal();

        String output = VARCHAR.getSlice(block, 0).toStringUtf8();
View Full Code Here

            ImmutableList.Builder<WindowFunction> windowFunctions = ImmutableList.builder();
            List<Symbol> windowFunctionOutputSymbols = new ArrayList<>();
            for (Map.Entry<Symbol, FunctionCall> entry : node.getWindowFunctions().entrySet()) {
                Symbol symbol = entry.getKey();
                Signature signature = node.getSignatures().get(symbol);
                windowFunctions.add(metadata.getExactFunction(signature).getWindowFunction().get());
                windowFunctionOutputSymbols.add(symbol);
            }

            // compute the layout of the output from the window operator
View Full Code Here

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

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

            }
        }).toSet();

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

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

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

    @Test
    public void testDoubleVarchar()
            throws Exception
    {
        InternalAggregationFunction doubleVarchar = metadata.getExactFunction(new Signature("max_by", VARCHAR, VARCHAR, DOUBLE)).getAggregationFunction();
        assertAggregation(
                doubleVarchar,
                1.0,
                "a",
                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.