Package io.crate.metadata

Examples of io.crate.metadata.FunctionIdent


        evaluate(-25.0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testInvalidType() throws Exception {
        functions.get(new FunctionIdent(SquareRootFunction.NAME,Arrays.<DataType>asList(DataTypes.STRING) ));
    }
View Full Code Here


        functions = new ModulesBuilder().add(new ScalarFunctionModule())
                .createInjector().getInstance(Functions.class);
    }

    private AbsFunction getFunction(DataType type) {
        return (AbsFunction) functions.get(new FunctionIdent(AbsFunction.NAME, Arrays.asList(type)));
    }
View Full Code Here

        functions = injector.getInstance(Functions.class);
    }

    private DistanceFunction getFunction(List<DataType> types) {
        return (DistanceFunction)functions.get(
                new FunctionIdent(DistanceFunction.NAME, types));
    }
View Full Code Here

    @Test
    public void testResolveWithTooManyArguments() throws Exception {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("distance takes 2 arguments, not 4");
        functions.get(new FunctionIdent(DistanceFunction.NAME,
                Arrays.<DataType>asList(DataTypes.STRING, DataTypes.STRING, DataTypes.STRING, DataTypes.STRING)));
    }
View Full Code Here

    @Test
    public void testResolveWithInvalidType() throws Exception {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("distance can't handle arguments of type \"long\"");
        functions.get(new FunctionIdent(DistanceFunction.NAME,
                Arrays.<DataType>asList(DataTypes.LONG, DataTypes.GEO_POINT)));
    }
View Full Code Here

        functions = new ModulesBuilder().add(new ScalarFunctionModule())
                .createInjector().getInstance(Functions.class);
    }

    private LogFunction getFunction(String name, DataType value) {
        return (LogFunction) functions.get(new FunctionIdent(name, Arrays.asList(value)));
    }
View Full Code Here

    private LogFunction getFunction(String name, DataType value) {
        return (LogFunction) functions.get(new FunctionIdent(name, Arrays.asList(value)));
    }

    private LogFunction getFunction(String name, DataType value, DataType base) {
        return (LogFunction) functions.get(new FunctionIdent(name, Arrays.asList(value, base)));
    }
View Full Code Here

    public void setUp(){
        functions = new ModulesBuilder()
                        .add(new ScalarFunctionModule())
                        .createInjector().getInstance(Functions.class);

        random = (RandomFunction)functions.get(new FunctionIdent(RandomFunction.NAME, Collections.EMPTY_LIST));

    }
View Full Code Here

        return getFunction(types);
    }

    private WithinFunction getFunction(List<DataType> types) {
        WithinFunction withinFunction = (WithinFunction) functions.get(
                new FunctionIdent(WithinFunction.NAME, types));
        assertNotNull(withinFunction);
        return withinFunction;
    }
View Full Code Here

public class DateTruncFunction extends BaseDateTruncFunction {

    public static void register(ScalarFunctionModule module) {
        module.register(new DateTruncFunction(new FunctionInfo(
                new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.STRING, DataTypes.TIMESTAMP)),
                DataTypes.TIMESTAMP)
        ));
        module.register(new DateTruncFunction(new FunctionInfo(
                new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.STRING, DataTypes.LONG)),
                DataTypes.TIMESTAMP)
        ));
        module.register(new DateTruncFunction(new FunctionInfo(
                new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.STRING, DataTypes.STRING)),
                DataTypes.TIMESTAMP)
        ));
    }
View Full Code Here

TOP

Related Classes of io.crate.metadata.FunctionIdent

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.