Package io.crate.metadata

Examples of io.crate.metadata.FunctionInfo


    static class NoopCeilFunction extends CeilFunction {

        private final FunctionInfo info;

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


        protected static void registerLogBaseFunctions(ScalarFunctionModule module) {
            // log(valueType, baseType) : double
            for (DataType baseType : ALLOWED_TYPES) {
                for (DataType valueType : ALLOWED_TYPES) {
                    FunctionInfo info = new FunctionInfo(
                            new FunctionIdent(
                                    NAME,
                                    Arrays.asList(valueType, baseType)
                            ),
                            DataTypes.DOUBLE
View Full Code Here

    static class Log10Function extends LogFunction {

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

    @Before
    public void prepare() {
        Injector injector = new ModulesBuilder().add(new AggregationImplModule()).createInjector();
        Functions functions = injector.getInstance(Functions.class);
        visitor = new PlanNodeStreamerVisitor(functions);
        maxInfo = new FunctionInfo(new FunctionIdent(MaximumAggregation.NAME, Arrays.<DataType>asList(DataTypes.INTEGER)), DataTypes.INTEGER);
        countInfo = new FunctionInfo(new FunctionIdent(CountAggregation.NAME, ImmutableList.<DataType>of()), DataTypes.LONG);
    }
View Full Code Here

        Reference nameRef = TestingHelpers.createReference("name", DataTypes.STRING);
        GroupProjection groupProjection = new GroupProjection();
        groupProjection.keys(Arrays.<DataTypeSymbol>asList(nameRef));
        groupProjection.values(Arrays.asList(
                new Aggregation(
                        new FunctionInfo(new FunctionIdent(CountAggregation.NAME, ImmutableList.<DataType>of()), DataTypes.LONG),
                        ImmutableList.<Symbol>of(),
                        Aggregation.Step.PARTIAL,
                        Aggregation.Step.FINAL
                )
        ));
View Full Code Here

    @Test
    public void testNormalizeSymbolNonLiteral() {
        EqOperator op = getOp(DataTypes.INTEGER);
        Function f1 = new Function(
                new FunctionInfo(
                        new FunctionIdent("dummy_function", Arrays.<DataType>asList(DataTypes.INTEGER)),
                        DataTypes.INTEGER
                ),
                Arrays.<Symbol>asList(Literal.newLiteral(2))
        );

        Function f2 = new Function(
                new FunctionInfo(
                        new FunctionIdent("dummy_function", Arrays.<DataType>asList(DataTypes.INTEGER)),
                        DataTypes.INTEGER
                ),
                Arrays.<Symbol>asList(Literal.newLiteral(2))
        );
View Full Code Here

    }

    @Test
    public void testEvaluate() throws Exception {
        CollectionAverageFunction function = new CollectionAverageFunction(
                new FunctionInfo(
                    ident,
                    DataTypes.DOUBLE)
        );

        Input inputSet = new Input<Set<Long>>() {
View Full Code Here

        ImmutableList<Input<?>> keys = ImmutableList.<Input<?>>of(
                new DummyInput("one", "one", "three"));


        FunctionInfo countInfo = new FunctionInfo(new FunctionIdent("count", ImmutableList.<DataType>of()), DataTypes.LONG);
        Aggregation countAggregation =
                new Aggregation(countInfo, ImmutableList.<Symbol>of(), Aggregation.Step.ITER, Aggregation.Step.PARTIAL);

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

        AggregationContext aggregationContext = new AggregationContext(
                (AggregationFunction)functions.get(countInfo.ident()),
                countAggregation);

        AggregationContext[] aggregations = new AggregationContext[] { aggregationContext };
        GroupingProjector projector = new GroupingProjector(
                Arrays.asList(DataTypes.STRING),
View Full Code Here

        Reference nameRef = createReference("name", DataTypes.STRING);
        GroupProjection groupProjection = new GroupProjection();
        groupProjection.keys(Arrays.<DataTypeSymbol>asList(nameRef));
        groupProjection.values(Arrays.asList(
                new Aggregation(
                        new FunctionInfo(new FunctionIdent(CountAggregation.NAME, ImmutableList.<DataType>of()), DataTypes.LONG),
                        ImmutableList.<Symbol>of(),
                        Aggregation.Step.PARTIAL,
                        Aggregation.Step.FINAL
                )
        ));
View Full Code Here

    }

    @Test
    public void testEvaluate() throws Exception {
        CollectionCountFunction function = new CollectionCountFunction(
                new FunctionInfo(
                        ident,
                        DataTypes.LONG)
        );

        Input inputSet = new Input<Set<String>>() {
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.