Package io.crate.types

Examples of io.crate.types.ArrayType


        Literal patternLiteral = Literal.newLiteral(pattern);
        Object[] value = new Object[expressions.length];
        for (int i=0; i < expressions.length; i++) {
            value[i] = expressions[i] == null ? null : new BytesRef(expressions[i]);
        }
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING), value);
        AnyLikeOperator impl = (AnyLikeOperator)new AnyLikeOperator.AnyLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), patternLiteral.valueType())
        );

        Function function = new Function(
View Full Code Here


        Literal patternLiteral = Literal.newLiteral(pattern);
        Object[] value = new Object[expressions.length];
        for (int i=0; i < expressions.length; i++) {
            value[i] = expressions[i] == null ? null : new BytesRef(expressions[i]);
        }
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING), value);
        AnyLikeOperator impl = (AnyLikeOperator)new AnyLikeOperator.AnyLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), DataTypes.STRING)
        );

        return impl.evaluate(valuesLiteral, patternLiteral);
View Full Code Here

    }

    @Test
    public void testNegateLike() throws Exception {
        Literal patternLiteral = Literal.newLiteral("A");
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING),
                new Object[]{new BytesRef("A"), new BytesRef("B")});
        FunctionImplementation<Function> impl = new AnyLikeOperator.AnyLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), DataTypes.STRING)
        );
        Function anyLikeFunction = new Function(impl.info(), Arrays.<Symbol>asList(valuesLiteral, patternLiteral));
View Full Code Here

    }

    @Test
    public void testWhereReferenceAnyLike() throws Exception {
        FunctionIdent functionIdent = new FunctionIdent(AnyLikeOperator.NAME,
                Arrays.<DataType>asList(new ArrayType(DataTypes.STRING), DataTypes.STRING));
        FunctionImplementation anyLikeImpl = functions.get(functionIdent);
        Function anyLike = new Function(anyLikeImpl.info(),
                Arrays.<Symbol>asList(tagsField,
                        Literal.newLiteral("foo%")));
        xcontentAssert(anyLike, "{\"query\":{\"wildcard\":{\"tags\":\"foo*\"}}}");
 
View Full Code Here

    }

    @Test
    public void testWhereReferenceAnyNotLike() throws Exception {
        FunctionIdent functionIdent = new FunctionIdent(AnyNotLikeOperator.NAME,
                Arrays.<DataType>asList(new ArrayType(DataTypes.STRING), DataTypes.STRING));
        FunctionImplementation anyNotLikeImpl = functions.get(functionIdent);
        Function anyNotLike = new Function(anyNotLikeImpl.info(),
                Arrays.<Symbol>asList(tagsField,
                        Literal.newLiteral("foo%")));
        xcontentAssert(anyNotLike, "{\"query\":{\"regexp\":{\"tags\":{\"value\":\"~(foo.*)\",\"flags\":\"COMPLEMENT\"}}}}");
 
View Full Code Here

    @Test
    public void testAnyGreater() throws Exception {
        // 0.0 < ANY_OF (d_array)

        DataType doubleArrayType = new ArrayType(DataTypes.DOUBLE);
        Reference doubleArrayRef = createReference("d_array", doubleArrayType);
        FunctionImplementation anyGreaterImpl = functions.get(new FunctionIdent("any_>",
                Arrays.<DataType>asList(doubleArrayType, DataTypes.DOUBLE)));

        Function whereClause = new Function(anyGreaterImpl.info(), Arrays.<Symbol>asList(doubleArrayRef, Literal.newLiteral(0.0)));
View Full Code Here

    @Test
    public void testAnyGreaterEquals() throws Exception {
        // 0.0 <= ANY_OF (d_array)

        DataType doubleArrayType = new ArrayType(DataTypes.DOUBLE);
        Reference doubleArrayRef = createReference("d_array", doubleArrayType);
        FunctionImplementation anyGreaterImpl = functions.get(new FunctionIdent("any_>=",
                Arrays.<DataType>asList(doubleArrayType, DataTypes.DOUBLE)));

        Function whereClause = new Function(anyGreaterImpl.info(),
View Full Code Here

        Literal patternLiteral = Literal.newLiteral(pattern);
        Object[] value = new Object[expressions.length];
        for (int i=0; i < expressions.length; i++) {
            value[i] = expressions[i] == null ? null : new BytesRef(expressions[i]);
        }
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING), value);
        AnyNotLikeOperator impl = (AnyNotLikeOperator)new AnyNotLikeOperator.AnyNotLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), patternLiteral.valueType())
        );

        Function function = new Function(
View Full Code Here

        Literal patternLiteral = Literal.newLiteral(pattern);
        Object[] value = new Object[expressions.length];
        for (int i=0; i < expressions.length; i++) {
            value[i] = expressions[i] == null ? null : new BytesRef(expressions[i]);
        }
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING), value);
        AnyNotLikeOperator impl = (AnyNotLikeOperator)new AnyNotLikeOperator.AnyNotLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), DataTypes.STRING)
        );

        return impl.evaluate(valuesLiteral, patternLiteral);
View Full Code Here

    }

    @Test
    public void testNegateNotLike() throws Exception {
        Literal patternLiteral = Literal.newLiteral("A");
        Literal valuesLiteral = Literal.newLiteral(new ArrayType(DataTypes.STRING),
                new Object[]{new BytesRef("A"), new BytesRef("B")});
        FunctionImplementation<Function> impl = new AnyNotLikeOperator.AnyNotLikeResolver().getForTypes(
                Arrays.asList(valuesLiteral.valueType(), DataTypes.STRING)
        );
        Function anyNotLikeFunction = new Function(impl.info(), Arrays.<Symbol>asList(valuesLiteral, patternLiteral));
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.