Package io.crate.metadata

Examples of io.crate.metadata.FunctionInfo


public class AnyEqOperatorTest {

    private Boolean anyEq(Object value, Object arrayExpr) {

        AnyEqOperator anyEqOperator = new AnyEqOperator(
                new FunctionInfo(
                        new FunctionIdent("any_=", Arrays.<DataType>asList(new ArrayType(DataTypes.INTEGER), DataTypes.INTEGER)),
                        DataTypes.BOOLEAN)
        );
        return anyEqOperator.evaluate(new ObjectInput(value), new ObjectInput(arrayExpr));
View Full Code Here


    }

    private Boolean anyEqNormalizeSymbol(Object value, Object arrayExpr) {
        AnyEqOperator anyEqOperator = new AnyEqOperator(
                new FunctionInfo(
                        new FunctionIdent("any_=", Arrays.<DataType>asList(new ArrayType(DataTypes.INTEGER), DataTypes.INTEGER)),
                        DataTypes.BOOLEAN)
        );
        Function function = new Function(
                anyEqOperator.info(),
View Full Code Here

import org.joda.time.DateTimeZone;

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

    public static void register(ScalarFunctionModule mod) {
        for (DataType t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
            mod.register(
                    new CollectionAverageFunction(
                            new FunctionInfo(new FunctionIdent(
                                    NAME, ImmutableList.<DataType>of(new SetType(t))), DataTypes.DOUBLE))
            );
        }
    }
View Full Code Here

import org.joda.time.DateTimeZone;

public class DateTruncTimeZoneAwareFunction extends BaseDateTruncFunction {

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

    public static final String NAME = "sum";
    private final FunctionInfo info;

    public static void register(AggregationImplModule mod) {
        for (DataType t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
            mod.register(new SumAggregation(new FunctionInfo(new FunctionIdent(NAME, ImmutableList.of(t)),
                            DataTypes.DOUBLE, FunctionInfo.Type.AGGREGATE)));
        }

    }
View Full Code Here

                                    insertColumn.info().ident().columnIdent().fqn(),
                                    insertColumn.valueType()
                            ));
                } else {
                    // replace column by `toX` function
                    FunctionInfo functionInfo = CastFunctionResolver.functionInfo(subQueryColumnType, insertColumn.valueType());
                    Function function = context.allocateFunction(functionInfo, Arrays.asList(subQueryColumn));
                    if (context.subQueryAnalysis().hasGroupBy()) {
                        int groupByIdx = context.subQueryAnalysis().groupBy().indexOf(subQueryColumn);
                        if (groupByIdx != -1) {
                            context.subQueryAnalysis().groupBy().set(groupByIdx, function);
View Full Code Here

        public FunctionImplementation<Function> getForTypes(List<DataType> dataTypes) throws IllegalArgumentException {
            if (dataTypes.size() == 0) {
                return new CountAggregation(COUNT_STAR_FUNCTION, false);
            } else {
                return new CountAggregation(
                        new FunctionInfo(new FunctionIdent(NAME, dataTypes),
                                DataTypes.LONG, FunctionInfo.Type.AGGREGATE),
                        true
                );
            }
        }
View Full Code Here

    public static final String NAME = "avg";
    private final FunctionInfo info;

    public static void register(AggregationImplModule mod) {
        for (DataType t :DataTypes.NUMERIC_PRIMITIVE_TYPES) {
            mod.register(new AverageAggregation(new FunctionInfo(
                            new FunctionIdent(NAME, ImmutableList.of(t)), DataTypes.DOUBLE,
                    FunctionInfo.Type.AGGREGATE)));
        }
        mod.register(new AverageAggregation(new FunctionInfo(
                new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.TIMESTAMP)), DataTypes.DOUBLE,
                FunctionInfo.Type.AGGREGATE)));
    }
View Full Code Here

    public static void register(AggregationImplModule mod) {
        for (final DataType dataType : DataTypes.PRIMITIVE_TYPES) {
            mod.register(
                    new MaximumAggregation(
                            new FunctionInfo(new FunctionIdent(NAME,
                                    ImmutableList.of(dataType)),
                                    dataType, FunctionInfo.Type.AGGREGATE
                            )
                    ) {
                        @Override
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.