Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Function


    }

    @Test
    public void testNormalizeLiteralAndLiteral() throws Exception {
        AndOperator operator = new AndOperator();
        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(Literal.newLiteral(true), Literal.newLiteral(true)));
        Symbol symbol = operator.normalizeSymbol(function);
        assertLiteralSymbol(symbol, true);
    }
View Full Code Here


    }

    @Test
    public void testNormalizeLiteralAndLiteralFalse() throws Exception {
        AndOperator operator = new AndOperator();
        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(Literal.newLiteral(true), Literal.newLiteral(false)));
        Symbol symbol = operator.normalizeSymbol(function);
        assertLiteralSymbol(symbol, false);
    }
View Full Code Here

        List<Symbol> arguments = Arrays.<Symbol>asList(
                createReference("text", DataTypes.STRING),
                pattern,
                replacement
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        ReplaceFunction regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        regexpImpl.compile(arguments);

        assertThat(regexpImpl.regexMatcher(), instanceOf(RegexMatcher.class));
        assertEquals(expected, regexpImpl.regexMatcher().replace(term, replacement.value()));
View Full Code Here

            new FunctionInfo(new FunctionIdent(SubstrFunction.NAME, ImmutableList.<DataType>of(DataTypes.STRING, DataTypes.LONG, DataTypes.LONG)),
                    DataTypes.STRING));


    private Function substr(String str, long startIndex) {
        return new Function(funcA.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), Literal.newLiteral(startIndex)));
    }
View Full Code Here

        List<Symbol> arguments = Arrays.<Symbol>asList(
                createReference("text", DataTypes.STRING),
                pattern,
                replacement
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        ReplaceFunction regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        regexpImpl.compile(arguments);

        Input[] args = new Input[3];
        args[0] = new Input<Object>() {
View Full Code Here

        return new Function(funcA.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), Literal.newLiteral(startIndex)));
    }

    private Function substr(String str, long startIndex, long count) {
        return new Function(funcB.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), Literal.newLiteral(startIndex), Literal.newLiteral(count)));
    }
View Full Code Here

        return new Function(funcB.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), Literal.newLiteral(startIndex), Literal.newLiteral(count)));
    }

    private Function substr(String str, Literal from) {
        return new Function(funcA.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), from));
    }
View Full Code Here

        return new Function(funcA.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), from));
    }

    private Function substr(String str, Literal from, Literal count) {
        return new Function(funcB.info(),
                Arrays.<Symbol>asList(Literal.newLiteral(str), from, count));
    }
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void testNormalizeSymbol() throws Exception {

        Function function = substr("cratedata", 0L);
        Symbol result = funcA.normalizeSymbol(function);
        assertLiteralSymbol(result, "cratedata");

        function = substr("cratedata", 6L);
        result = funcA.normalizeSymbol(function);
View Full Code Here

                createReference("text", DataTypes.STRING),
                pattern,
                replacement,
                flags
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        ReplaceFunction regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        regexpImpl.compile(arguments);

        Input[] args = new Input[4];
        args[0] = new Input<Object>() {
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.