Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Function.info()


        List<Symbol> arguments = Arrays.<Symbol>asList(
                term,
                Literal.newLiteral(3)
        );
        Function function = createFunction(SubscriptFunction.NAME, DataTypes.STRING, arguments);
        SubscriptFunction subscriptFunction = (SubscriptFunction) functions.get(function.info().ident());

        Symbol result = subscriptFunction.normalizeSymbol(function);
        assertThat(result, isLiteral(null, DataTypes.STRING));
    }
View Full Code Here


                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

                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

                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

        List<Symbol> args = Arrays.<Symbol>asList(
                createReference("tag", DataTypes.STRING),
                startPos
        );
        Function function = createFunction(SubstrFunction.NAME, DataTypes.STRING, args);
        Scalar<BytesRef, Object> format = (Scalar<BytesRef, Object>) functions.get(function.info().ident());

        Input<Object> arg1 = new Input<Object>() {
            @Override
            public Object value() {
                return new BytesRef("cratedata");
View Full Code Here

                createReference("tag", DataTypes.STRING),
                startPos,
                count
        );
        function = createFunction(SubstrFunction.NAME, DataTypes.STRING, args);
        format = (Scalar<BytesRef, Object>) functions.get(function.info().ident());

        Input<Object> arg3 = new Input<Object>() {
            @Override
            public Object value() {
                return count.value();
View Full Code Here

                Literal.newLiteral("foobarbequebaz bar"),
                Literal.newLiteral("(ba)"),
                Literal.newLiteral("Crate")
        );
        Function function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        ReplaceFunction regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        Symbol result = regexpImpl.normalizeSymbol(function);
        assertLiteralSymbol(result, expected.utf8ToString());

        arguments = Arrays.<Symbol>asList(
View Full Code Here

                createReference("tag", DataTypes.STRING),
                createReference("start", DataTypes.LONG),
                createReference("end", DataTypes.LONG)
        );
        Function function = createFunction(SubstrFunction.NAME, DataTypes.STRING, args);
        Scalar<BytesRef, Object> format = (Scalar<BytesRef, Object>) functions.get(function.info().ident());

        Input<Object> arg1 = new Input<Object>() {
            @Override
            public Object value() {
                return new BytesRef("cratedata");
View Full Code Here

                createReference("tag", DataTypes.STRING),
                createReference("start", DataTypes.INTEGER),
                createReference("end", DataTypes.SHORT)
        );
        Function function = createFunction(SubstrFunction.NAME, DataTypes.STRING, args);
        Scalar<BytesRef, Object> format = (Scalar<BytesRef, Object>) functions.get(function.info().ident());

        BytesRef resultBytesRef = format.evaluate(generateInputs(new BytesRef("cratedata"), 1, 5));
        assertThat(resultBytesRef.utf8ToString(), is("crate"));

        BytesRef resultString = format.evaluate(generateInputs("cratedata", 1, 5));
View Full Code Here

                createReference("text", DataTypes.STRING),
                Literal.newLiteral("(ba)"),
                Literal.newLiteral("Crate")
        );
        function = createFunction(ReplaceFunction.NAME, DataTypes.STRING, arguments);
        regexpImpl = (ReplaceFunction) functions.get(function.info().ident());

        result = regexpImpl.normalizeSymbol(function);
        assertThat(result, instanceOf(Function.class));
        assertThat((Function)result, is(function));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.