Package io.crate.planner.symbol

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


                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());

        assertNull(format.evaluate(
                (Input) Literal.newLiteral(DataTypes.STRING, null),
                (Input) Literal.newLiteral(1)));
    }
View Full Code Here


        Function function = createFunction(SubstrFunction.NAME, DataTypes.STRING,
                Arrays.<Symbol>asList(
                        Literal.newLiteral(DataTypes.STRING, null),
                        Literal.newLiteral(1)
                ));
        Scalar<BytesRef, Object> func = (Scalar<BytesRef, Object>) functions.get(function.info().ident());
        Symbol symbol = func.normalizeSymbol(function);
        assertNull(((Literal) symbol).value());
    }

}
View Full Code Here

                Literal.newLiteral("(ba)"),
                Literal.newLiteral("Crate"),
                Literal.newLiteral("us n")
        );
        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());
    }
View Full Code Here

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

    @Test
    public void testNormalizeSymbolWithInvalidNumberOfArguments() throws Exception {
        expectedException.expect(IllegalArgumentException.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());
    }

    @Test
    public void testNormalizeSymbolWithInvalidArgumentType() throws Exception {
        expectedException.expect(IllegalArgumentException.class);
View Full Code Here

                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

        List<Symbol> args = Arrays.<Symbol>asList(
                Literal.newLiteral("%tY"),
                Literal.newLiteral(DataTypes.TIMESTAMP, DataTypes.TIMESTAMP.value("2014-03-02")));
        Function function = createFunction(FormatFunction.NAME, DataTypes.STRING, args);

        FunctionImplementation format = functions.get(function.info().ident());
        Symbol result = format.normalizeSymbol(function);

        assertLiteralSymbol(result, "2014");
    }
View Full Code Here

            formatString,
            createReference("name", DataTypes.STRING),
            createReference("age", DataTypes.LONG)
        );
        Function function = createFunction(FormatFunction.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 formatString.value();
View Full Code Here

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

        regexpImpl.compile(arguments);

        assertThat(regexpImpl.regexMatcher(), instanceOf(RegexMatcher.class));
        assertEquals(true, regexpImpl.regexMatcher().match(new BytesRef("foobarbequebaz bar")));
View Full Code Here

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

        regexpImpl.compile(arguments);

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