Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Function


    @Test
    public void testNormalizeSymbolReferenceAndLiteral() throws Exception {
        OrOperator operator = new OrOperator();

        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), Literal.newLiteral(true)));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertLiteralSymbol(normalizedSymbol, true);
    }
View Full Code Here


                Literal.newLiteral("foobar"),
                Literal.newLiteral("foo"),
                Literal.newLiteral("bar"),
                Literal.newLiteral(1)
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        functions.get(function.info().ident());
    }
View Full Code Here

    }

    @Test
    public void testNormalizeSymbolReferenceAndLiteralFalse() throws Exception {
        OrOperator operator = new OrOperator();
        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), Literal.newLiteral(false)));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertThat(normalizedSymbol, instanceOf(Reference.class));
    }
View Full Code Here

    }

    @Test
    public void testNormalizeSymbolWithInvalidNumberOfArguments() throws Exception {
        expectedException.expect(IllegalArgumentException.class);
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, Arrays.<Symbol>asList());
        functions.get(function.info().ident());
    }
View Full Code Here

    @Test
    public void testNormalizeSymbolReferenceAndReference() throws Exception {
        OrOperator operator = new OrOperator();

        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), new Reference()));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertThat(normalizedSymbol, instanceOf(Function.class));
    }
View Full Code Here

        List<Symbol> arguments = Arrays.<Symbol>asList(
                Literal.newLiteral("foobar"),
                Literal.newLiteral(".*"),
                Literal.newLiteral(1)
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        functions.get(function.info().ident());
    }
View Full Code Here

        return getFunction(type).evaluate(input);
    }

    private Symbol normalize(Object value, DataType type) {
        ToBooleanFunction function = getFunction(type);
        return function.normalizeSymbol(new Function(function.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(type, value))));
    }
View Full Code Here

        return getFunction(type).evaluate(input);
    }

    private Symbol normalize(Object value, DataType type) {
        ToByteFunction function = getFunction(type);
        return function.normalizeSymbol(new Function(function.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(type, value))));
    }
View Full Code Here

        return getFunction(type).evaluate(input);
    }

    private Symbol normalize(Object value, DataType type) {
        ToLongFunction function = getFunction(type);
        return function.normalizeSymbol(new Function(function.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(type, value))));
    }
View Full Code Here

        return getFunction(type).evaluate(input);
    }

    private Symbol normalize(Object value, DataType type) {
        ToShortFunction function = getFunction(type);
        return function.normalizeSymbol(new Function(function.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(type, value))));
    }
View Full Code Here

TOP

Related Classes of io.crate.planner.symbol.Function

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.