Package io.crate.metadata

Examples of io.crate.metadata.FunctionInfo


        this.info = info;
    }

    public static void register(OperatorModule module) {
        for (DataType type : DataTypes.PRIMITIVE_TYPES) {
            FunctionInfo functionInfo = new FunctionInfo(
                    new FunctionIdent(NAME, ImmutableList.<DataType>of(type, new SetType(type))), DataTypes.BOOLEAN);
            module.registerOperatorFunction(new InOperator(functionInfo));
        }
    }
View Full Code Here


public abstract class Operator<I> extends Scalar<Boolean, I> implements FunctionImplementation<Function> {

    public static final io.crate.types.DataType RETURN_TYPE = DataTypes.BOOLEAN;

    protected static FunctionInfo generateInfo(String name, DataType type) {
        return new FunctionInfo(new FunctionIdent(name, ImmutableList.of(type, type)), RETURN_TYPE);
    }
View Full Code Here

    @Test
    public void testArrayCompareAny() throws Exception {
        SelectAnalysis analysis =  analyze("select * from users where 0 = ANY (counters)");
        assertThat(analysis.whereClause().hasQuery(), is(true));

        FunctionInfo anyInfo = ((Function)analysis.whereClause().query()).info();
        assertThat(anyInfo.ident().name(), is("any_="));
        //assertThat(anyInfo.ident().argumentTypes(), contains(DataTypes.LONG_ARRAY, DataType.LONG));

        analysis =  analyze("select * from users where 0 = ANY (counters)");
        assertThat(analysis.whereClause().hasQuery(), is(true));

        anyInfo = ((Function)analysis.whereClause().query()).info();
        assertThat(anyInfo.ident().name(), is("any_="));
        //assertThat(anyInfo.ident().argumentTypes(), contains(DataTypes.LONG_ARRAY, DataType.LONG));
    }
View Full Code Here

    public void testArrayCompareAnyNeq() throws Exception {
        SelectAnalysis analysis = (SelectAnalysis) analyze("select * from users where ? != ANY (counters)",
                new Object[]{ 4.3F });
        assertThat(analysis.whereClause().hasQuery(), is(true));

        FunctionInfo anyInfo = ((Function)analysis.whereClause().query()).info();
        assertThat(anyInfo.ident().name(), is("any_<>"));
        //assertThat(anyInfo.ident().argumentTypes(), contains(DataTypes.LONG_ARRAY, DataType.LONG));

    }
View Full Code Here

    private Query convert(WhereClause eq) {
        return builder.convert(eq).query;
    }

    private WhereClause eq(DataTypeSymbol left, DataTypeSymbol right) {
        return new WhereClause(new Function(new FunctionInfo(
                new FunctionIdent(EqOperator.NAME, Arrays.asList(left.valueType(), right.valueType())), DataTypes.BOOLEAN),
                Arrays.<Symbol>asList(left, right)
        ));
    }
View Full Code Here

    public static class LnFunction extends Log10Function {

        protected static void registerLnFunctions(ScalarFunctionModule module) {
            // ln(dataType) : double
            for (DataType dt : ALLOWED_TYPES) {
                FunctionInfo info = new FunctionInfo(new FunctionIdent(LnFunction.NAME, Arrays.asList(dt)), DataTypes.DOUBLE);
                module.register(new LnFunction(info));
            }
        }
View Full Code Here

    static class NoopFloorFunction extends FloorFunction {

        private final FunctionInfo info;

        NoopFloorFunction(DataType type) {
            info = new FunctionInfo(new FunctionIdent(NAME, ImmutableList.of(type)), type);
        }
View Full Code Here

         }
         return symbol;
    }

    protected static FunctionInfo genDoubleInfo(String functionName, List<DataType> dataTypes) {
             return new FunctionInfo(new FunctionIdent(functionName, dataTypes), DataTypes.DOUBLE);
    }
View Full Code Here

    protected static FunctionInfo genDoubleInfo(String functionName, List<DataType> dataTypes) {
             return new FunctionInfo(new FunctionIdent(functionName, dataTypes), DataTypes.DOUBLE);
    }

    protected static FunctionInfo genLongInfo(String functionName, List<DataType> dataTypes) {
        return new FunctionInfo(new FunctionIdent(functionName, dataTypes), DataTypes.LONG);
    }
View Full Code Here

    private static class NoopRoundFunction extends RoundFunction {
        private final FunctionInfo info;

        public NoopRoundFunction(DataType type) {
            info = new FunctionInfo(new FunctionIdent(NAME, ImmutableList.of(type)), type);
        }
View Full Code Here

TOP

Related Classes of io.crate.metadata.FunctionInfo

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.