Package io.crate.types

Examples of io.crate.types.ArrayType


        assertThat(actual, is(expected));
    }

    @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)));
View Full Code Here


        assertThat(eval(null, DataTypes.LONG), Matchers.nullValue());
        assertThat(eval(null, DataTypes.STRING), Matchers.nullValue());
    }

    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
View Full Code Here

        assertThat(actual, is(expected));
    }


    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
View Full Code Here

        assertThat(actual, is(expected));
    }


    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
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),
                        Literal.newLiteral(DataTypes.INTEGER, value))
        );
        return (Boolean)((Literal)anyEqOperator.normalizeSymbol(function)).value();
    }
View Full Code Here

        assertLiteralSymbol(symbol, 152462.70754934277);
    }

    @Test
    public void testNormalizeWithDoubleArray() throws Exception {
        DataType type = new ArrayType(DataTypes.DOUBLE);
        Symbol symbol = normalize(Arrays.<Symbol>asList(
                Literal.newLiteral(type, new Double[]{10.0, 20.0}),
                Literal.newLiteral(type, new Double[]{11.0, 21.0})
        ));
        assertLiteralSymbol(symbol, 152462.70754934277);
View Full Code Here

        if (node.innerType().type() != ColumnType.Type.PRIMITIVE) {
            throw new UnsupportedOperationException("Nesting ARRAY or SET types is not supported");
        }

        DataType innerType = process(node.innerType(), context);
        return new ArrayType(innerType);
    }
View Full Code Here

    public static final String NAME = "regexp_matches";

    private static final DataType arrayStringType = new ArrayType(DataTypes.STRING);

    private static FunctionInfo createInfo(List<DataType> types) {
        return new FunctionInfo(new FunctionIdent(NAME, types), new ArrayType(types.get(0)));
    }
View Full Code Here

            type = Objects.firstNonNull(dataTypeMap.get(typeName), DataTypes.NOT_SUPPORTED);
        }

        Optional<String> collectionType = getCollectionType(columnName, columnIdent);
        if (collectionType.isPresent() && collectionType.get().equals("array")) {
            type = new ArrayType(type);
        }
        return type;
    }
View Full Code Here

TOP

Related Classes of io.crate.types.ArrayType

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.