Package io.crate.metadata

Examples of io.crate.metadata.FunctionIdent


    @Test
    public void testNormalizeWithReference() throws Exception {
        final DataType arrayType = new ArrayType(DataTypes.STRING);
        ToLongArrayFunction impl = (ToLongArrayFunction)functions.get(
                new FunctionIdent(ToLongArrayFunction.NAME, ImmutableList.of(arrayType)));

        Reference foo = TestingHelpers.createReference("foo", arrayType);
        Symbol symbol = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(foo)));
        assertThat(symbol, instanceOf(Function.class));
    }
View Full Code Here


    }

    private Object[] eval(final Object objects, DataType innerType) {
        final DataType arrayType = new ArrayType(innerType);
        ToLongArrayFunction impl = (ToLongArrayFunction)functions.get(
                new FunctionIdent(ToLongArrayFunction.NAME, ImmutableList.of(arrayType)));

        Literal input = new Literal() {
            @Override
            public Object value() {
                return objects;
View Full Code Here


    private Object[] eval(final Object objects, DataType innerType) {
        final DataType arrayType = new ArrayType(innerType);
        ToByteArrayFunction impl = (ToByteArrayFunction)functions.get(
                new FunctionIdent(ToByteArrayFunction.NAME, ImmutableList.of(arrayType)));

        Literal input = new Literal() {
            @Override
            public Object value() {
                return objects;
View Full Code Here


    private Object[] eval(final Object objects, DataType innerType) {
        final DataType arrayType = new ArrayType(innerType);
        ToDoubleArrayFunction impl = (ToDoubleArrayFunction)functions.get(
                new FunctionIdent(ToDoubleArrayFunction.NAME, ImmutableList.of(arrayType)));

        Literal input = new Literal() {
            @Override
            public Object value() {
                return objects;
View Full Code Here

    @Test
    public void testInvalidType() throws Exception {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("Argument must be an array type");
        functions.get(new FunctionIdent(ToBooleanArrayFunction.NAME, ImmutableList.<DataType>of(DataTypes.OBJECT)));
    }
View Full Code Here


    private Object[] eval(final Object objects, DataType innerType) {
        final DataType arrayType = new ArrayType(innerType);
        ToBooleanArrayFunction impl = (ToBooleanArrayFunction)functions.get(
                new FunctionIdent(ToBooleanArrayFunction.NAME, ImmutableList.of(arrayType)));

        Literal input = new Literal() {
            @Override
            public Object value() {
                return objects;
View Full Code Here

    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(),
                Arrays.<Symbol>asList(Literal.newLiteral(new ArrayType(DataTypes.INTEGER), arrayExpr),
View Full Code Here

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

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

    private Double evaluate(Long number) {
        return evaluate(number, DataTypes.LONG).doubleValue();
    }

    private SquareRootFunction getFunction(List<DataType> dataTypes) {
        return (SquareRootFunction)functions.get(new FunctionIdent(SquareRootFunction.NAME, dataTypes));
    }
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.