Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Reference


    @Test
    public void testNormalizeSymbolReferenceAndLiteralFalse() throws Exception {
        OrOperator operator = new OrOperator();
        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), Literal.newLiteral(false)));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertThat(normalizedSymbol, instanceOf(Reference.class));
    }
View Full Code Here


    @Test
    public void testNormalizeSymbolReferenceAndReference() throws Exception {
        OrOperator operator = new OrOperator();

        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), new Reference()));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertThat(normalizedSymbol, instanceOf(Function.class));
    }
View Full Code Here

        assertEquals(p, p2);
    }

    @Test
    public void testStreaming2() throws Exception {
        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),
View Full Code Here

    @Test
    public void testNormalizeSymbolTzAwareReferenceTimestamp() throws Exception {
        Function function = new Function(funcTZ.info(),
                Arrays.<Symbol>asList(Literal.newLiteral("day"), Literal.newLiteral("+01:00"),
                        new Reference(new ReferenceInfo(null,null,DataTypes.TIMESTAMP))));
        Symbol result = funcTZ.normalizeSymbol(function);
        assertSame(function, result);
    }
View Full Code Here

        assertLiteralSymbol(result, false);
    }

    @Test
    public void testNormalizeSymbolSetLiteralReference() {
        Reference reference = new Reference();
        Literal inListValues = Literal.newLiteral(INTEGER_SET_TYPE, Sets.newHashSet(1, 2, 4, 8));

        List<Symbol> arguments = new ArrayList<>();
        arguments.add(reference);
        arguments.add(inListValues);
View Full Code Here

    }

    @Test
    public void testWhereReferenceInStringList() throws Exception {
        // where name in ("alpha", "bravo", "charlie")
        Reference ref = name_ref;
        FunctionImplementation inListImpl = functions.get(
                new FunctionIdent(InOperator.NAME,
                Arrays.<DataType>asList(DataTypes.STRING, new SetType(DataTypes.STRING))
        ));
View Full Code Here

        xcontentAssert(anyNotLike, "{\"query\":{\"regexp\":{\"tags\":{\"value\":\"~(foo.*)\",\"flags\":\"COMPLEMENT\"}}}}");
    }

    @Test
    public void testMinScoreIsSet() throws Exception {
        Reference minScore_ref = new Reference(
                new ReferenceInfo(new ReferenceIdent(null, "_score"), RowGranularity.DOC, DataTypes.DOUBLE));

        Function whereClause = new Function(new FunctionInfo(
                new FunctionIdent(EqOperator.NAME, Arrays.<DataType>asList(DataTypes.DOUBLE, DataTypes.DOUBLE)),
                DataTypes.BOOLEAN),
View Full Code Here

        assertThat(actual, is("{\"query\":{\"term\":{\"name\":\"Marvin\"}}}"));
    }

    @Test
    public void testSelect_OnlyVersion() throws Exception {
        Reference version_ref = createReference("_version", DataTypes.INTEGER);
        QueryThenFetchNode searchNode = new QueryThenFetchNode(
                new Routing(),
                ImmutableList.<Symbol>of(version_ref),
                null,
                null,
View Full Code Here

                "{\"version\":true,\"_source\":false,\"query\":{\"match_all\":{}},\"from\":0,\"size\":10000}"));
    }

    @Test
    public void testSelect_WholeObjectAndPartial() throws Exception {
        Reference author = createReference("author", DataTypes.OBJECT);
        Reference age = createReference(
                ColumnIdent.getChild(author.info().ident().columnIdent(), "age"), DataTypes.INTEGER);

        QueryThenFetchNode searchNode = new QueryThenFetchNode(
                new Routing(),
                ImmutableList.<Symbol>of(author, age),
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

TOP

Related Classes of io.crate.planner.symbol.Reference

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.