Examples of toCollect()


Examples of io.crate.planner.node.dql.CollectNode.toCollect()

        CollectNode cn = new CollectNode("cn");
        cn.maxRowGranularity(RowGranularity.DOC);

        cn.downStreamNodes(ImmutableList.of("n1", "n2"));
        cn.toCollect(ImmutableList.<Symbol>of(new Value(DataTypes.STRING)));


        BytesStreamOutput out = new BytesStreamOutput();
        cn.writeTo(out);
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        CollectNode cn2 = new CollectNode();
        cn2.readFrom(in);
        assertEquals(cn, cn2);

        assertEquals(cn.toCollect(), cn2.toCollect());
        assertEquals(cn.downStreamNodes(), cn2.downStreamNodes());
        assertEquals(cn.maxRowGranularity(), cn.maxRowGranularity());

    }
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

    public void testCollectShardExpressionsWhereShardIdIs0() throws Exception {
        EqOperator op = (EqOperator) functions.get(new FunctionIdent(
                EqOperator.NAME, ImmutableList.<DataType>of(DataTypes.INTEGER, DataTypes.INTEGER)));

        CollectNode collectNode = new CollectNode("shardCollect", shardRouting(0, 1));
        collectNode.toCollect(Arrays.<Symbol>asList(testShardIdReference));
        collectNode.whereClause(new WhereClause(
                new Function(op.info(), Arrays.<Symbol>asList(testShardIdReference, Literal.newLiteral(0)))));
        collectNode.maxRowGranularity(RowGranularity.SHARD);
        Object[][] result = operation.collect(collectNode).get();
        assertThat(result.length, is(equalTo(1)));
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

        CollectNode cn = new CollectNode("cn");
        cn.maxRowGranularity(RowGranularity.DOC);

        cn.downStreamNodes(ImmutableList.of("n1", "n2"));
        cn.toCollect(ImmutableList.<Symbol>of(new Value(DataTypes.STRING)));
        cn.jobId(UUID.randomUUID());

        BytesStreamOutput out = new BytesStreamOutput();
        cn.writeTo(out);
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

    }

    @Test
    public void testCollectShardExpressionsLiteralsAndNodeExpressions() throws Exception {
        CollectNode collectNode = new CollectNode("shardCollect", shardRouting(0, 1));
        collectNode.toCollect(Arrays.<Symbol>asList(testShardIdReference, Literal.newLiteral(true), testNodeReference));
        collectNode.maxRowGranularity(RowGranularity.SHARD);
        Object[][] result = operation.collect(collectNode).get();
        assertThat(result.length, is(equalTo(2)));
        assertThat(result[0].length, is(equalTo(3)));
        int i, j;
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

        BytesStreamInput in = new BytesStreamInput(out.bytes());
        CollectNode cn2 = new CollectNode();
        cn2.readFrom(in);
        assertEquals(cn, cn2);

        assertEquals(cn.toCollect(), cn2.toCollect());
        assertEquals(cn.downStreamNodes(), cn2.downStreamNodes());
        assertEquals(cn.maxRowGranularity(), cn.maxRowGranularity());
    }
}
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

    public void testClusterLevel() throws Exception {
        Routing routing = SysClusterTableInfo.ROUTING;
        CollectNode collectNode = new CollectNode("clusterCollect", routing);

        Reference clusterNameRef = new Reference(SysClusterTableInfo.INFOS.get(new ColumnIdent("name")));
        collectNode.toCollect(Arrays.<Symbol>asList(clusterNameRef));
        collectNode.maxRowGranularity(RowGranularity.CLUSTER);
        Object[][] result = operation.collect(collectNode).get();
        assertThat(result.length, is(1));
        assertTrue(((BytesRef) result[0][0]).utf8ToString().startsWith("shared-"));
    }
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

                ImmutableList.<DataType>of(DataTypes.STRING, DataTypes.STRING)));
        Function whereClause = new Function(eqImpl.info(),
                Arrays.asList(tableNameRef, Literal.newLiteral("shards")));

        collectNode.whereClause(new WhereClause(whereClause));
        collectNode.toCollect(toCollect);
        collectNode.maxRowGranularity(RowGranularity.DOC);
        Object[][] result = operation.collect(collectNode).get();
        System.out.println(TestingHelpers.printedTable(result));
        assertEquals("sys| shards| 1| 0| NULL| NULL| NULL\n", TestingHelpers.printedTable(result));
    }
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

        TableInfo tableInfo = schemaInfo.getTableInfo("columns");
        List<Symbol> toCollect = new ArrayList<>();
        for (ReferenceInfo info : tableInfo.columns()) {
            toCollect.add(new Reference(info));
        }
        collectNode.toCollect(toCollect);
        collectNode.maxRowGranularity(RowGranularity.DOC);
        Object[][] result = operation.collect(collectNode).get();


        String expected = "sys| cluster| id| 1| string\n" +
View Full Code Here

Examples of io.crate.planner.node.dql.CollectNode.toCollect()

    }

    @Test
    public void testCollectDocLevel() throws Exception {
        CollectNode collectNode = new CollectNode("docCollect", routing(TEST_TABLE_NAME));
        collectNode.toCollect(Arrays.<Symbol>asList(testDocLevelReference, underscoreRawReference, underscoreIdReference));
        collectNode.maxRowGranularity(RowGranularity.DOC);

        Object[][] result = operation.collect(collectNode).get();
        assertThat(result.length, is(2));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.