Package io.crate.planner.symbol

Examples of io.crate.planner.symbol.Reference


        assertThat(analysis.columns().size(), is(analysis.getSubQueryColumns().size()));

        for (int i = 0; i < analysis.columns().size(); i++) {
            assertThat(analysis.getSubQueryColumns().get(i), instanceOf(DataTypeSymbol.class));
            DataTypeSymbol subQueryColumn = (DataTypeSymbol)analysis.getSubQueryColumns().get(i);
            Reference insertColumn = analysis.columns().get(i);
            assertThat(
                    subQueryColumn.valueType().isConvertableTo(insertColumn.valueType()),
                    is(true)
            );
        }

    }
View Full Code Here


public class QueryShardRequestTest {


    @Test
    public void testQueryShardRequestSerialization() throws Exception {
        Reference nameRef = createReference("name", DataTypes.STRING);
        Function query = createFunction(EqOperator.NAME, DataTypes.BOOLEAN, nameRef, Literal.newLiteral("Arthur"));
        WhereClause whereClause = new WhereClause(query);
        QueryShardRequest request = new QueryShardRequest(
                "dummyTable",
                1,
View Full Code Here

    public void testNormalizeWithReference() throws Exception {
        final DataType arrayType = new ArrayType(DataTypes.STRING);
        ToIntArrayFunction impl = (ToIntArrayFunction)functions.get(
                new FunctionIdent(ToIntArrayFunction.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

    public void testCollectUnknownReference() throws Throwable {
        expectedException.expect(UnhandledServerException.class);
        expectedException.expectMessage("Unknown Reference some.table.some_column");

        CollectNode collectNode = new CollectNode("unknown", testRouting);
        Reference unknownReference = new Reference(
                new ReferenceInfo(
                        new ReferenceIdent(
                                new TableIdent("some", "table"),
                                "some_column"
                        ),
View Full Code Here

        MergeNode node = new MergeNode("merge", 2);
        node.contextId(UUID.randomUUID());
        node.executionNodes(Sets.newHashSet("node1", "node2"));
        node.inputTypes(Arrays.<DataType>asList(DataTypes.UNDEFINED, DataTypes.STRING));

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

    }

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

    @Test
    public void testNormalizeSymbol() throws Exception {
        NotPredicate notPredicate = new NotPredicate();

        Reference name_ref = new Reference(new ReferenceInfo(
                new ReferenceIdent(new TableIdent(null, "dummy"), "foo"),
                RowGranularity.DOC, DataTypes.STRING)
        );
        Function eqName = new Function(
                new FunctionInfo(
View Full Code Here

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

    @Test
    public void testNormalizeBooleanFalseAndNonLiteral() throws Exception {
        AndOperator operator = new AndOperator();
        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(Literal.newLiteral(false), new Reference()));
        Symbol symbol = operator.normalizeSymbol(function);

        assertLiteralSymbol(symbol, false);
    }
View Full Code Here

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

        Function function = new Function(
                operator.info(), Arrays.<Symbol>asList(new Reference(), Literal.newLiteral(true)));
        Symbol normalizedSymbol = operator.normalizeSymbol(function);
        assertLiteralSymbol(normalizedSymbol, true);
    }
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.