Package io.crate.planner.node.dql

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


    @Test
    public void testCollectDocLevelWhereClause() throws Exception {
        EqOperator op = (EqOperator) functions.get(new FunctionIdent(EqOperator.NAME,
                ImmutableList.<DataType>of(DataTypes.INTEGER, DataTypes.INTEGER)));
        CollectNode collectNode = new CollectNode("docCollect", routing(TEST_TABLE_NAME));
        collectNode.toCollect(Arrays.<Symbol>asList(testDocLevelReference));
        collectNode.maxRowGranularity(RowGranularity.DOC);
        collectNode.whereClause(new WhereClause(new Function(
                op.info(),
                Arrays.<Symbol>asList(testDocLevelReference, Literal.newLiteral(2)))
        ));
View Full Code Here


    public void testCollectWithShardAndNodeExpressions() throws Exception {
        Routing routing = routing(TEST_TABLE_NAME);
        Set shardIds = routing.locations().get(clusterService().localNode().id()).get(TEST_TABLE_NAME);

        CollectNode collectNode = new CollectNode("docCollect", routing);
        collectNode.toCollect(Arrays.<Symbol>asList(
                testDocLevelReference,
                new Reference(SysNodesTableInfo.INFOS.get(new ColumnIdent("name"))),
                new Reference(SysShardsTableInfo.INFOS.get(new ColumnIdent("id"))),
                new Reference(SysClusterTableInfo.INFOS.get(new ColumnIdent("name")))
        ));
View Full Code Here

    @Test
    public void testCollectWithPartitionedColumns() throws Exception {
        Routing routing = docSchemaInfo.getTableInfo(PARTITIONED_TABLE_NAME).getRouting(WhereClause.MATCH_ALL);
        TableIdent tableIdent = new TableIdent(DocSchemaInfo.NAME, PARTITIONED_TABLE_NAME);
        CollectNode collectNode = new CollectNode("docCollect", routing);
        collectNode.toCollect(Arrays.<Symbol>asList(
                new Reference(new ReferenceInfo(
                        new ReferenceIdent(tableIdent, "id"),
                        RowGranularity.DOC, DataTypes.INTEGER)),
                new Reference(new ReferenceInfo(
                        new ReferenceIdent(tableIdent, "date"),
View Full Code Here

        CollectNode collectNode = new CollectNode("dcollect", shardRouting(0, 1));
        collectNode.downStreamNodes(Arrays.asList(TEST_NODE_ID, OTHER_NODE_ID));
        collectNode.jobId(jobId);
        collectNode.maxRowGranularity(RowGranularity.SHARD);
        collectNode.toCollect(Arrays.<Symbol>asList(testShardIdReference));


        assertThat(operation.collect(collectNode).get(), is(TaskResult.EMPTY_RESULT.rows()));
        countDown.await();
        assertThat(buckets.size(), is(2));
View Full Code Here

        CollectNode collectNode = new CollectNode("dcollect", nodeRouting);
        collectNode.downStreamNodes(Arrays.asList(TEST_NODE_ID, OTHER_NODE_ID));
        collectNode.jobId(jobId);
        collectNode.maxRowGranularity(RowGranularity.NODE);
        collectNode.toCollect(Arrays.<Symbol>asList(Literal.newLiteral(true)));
        Object[][] objects = operation.collect(collectNode).get();
        assertThat((Boolean) objects[0][0], is(true));

    }
View Full Code Here

        CollectNode collectNode = new CollectNode("collect all the things", shardRouting(0, 1));
        collectNode.downStreamNodes(Arrays.asList(TEST_NODE_ID, OTHER_NODE_ID));
        collectNode.jobId(jobId);
        collectNode.maxRowGranularity(RowGranularity.SHARD);
        collectNode.toCollect(Arrays.<Symbol>asList(testShardIdReference));

        collectNode.whereClause(new WhereClause(new Function(
                AndOperator.INFO,
                Arrays.<Symbol>asList(Literal.newLiteral(false), Literal.newLiteral(false))
        )));
View Full Code Here

                                           ImmutableList<Projection> projections) {
        CollectNode node = new CollectNode("distributing collect", analysis.table().getRouting(analysis.whereClause()));
        node.whereClause(analysis.whereClause());
        node.maxRowGranularity(analysis.rowGranularity());
        node.downStreamNodes(downstreamNodes);
        node.toCollect(toCollect);
        node.projections(projections);

        node.isPartitioned(analysis.table().isPartitioned());
        setOutputTypes(node);
        return node;
View Full Code Here

            routing = filterRouting(routing, PartitionName.fromPartitionIdent(
                            analysis.table().ident().name(), partitionIdent).stringValue());
        }
        CollectNode node = new CollectNode("collect", routing);
        node.whereClause(analysis.whereClause());
        node.toCollect(toCollect);
        node.maxRowGranularity(analysis.rowGranularity());
        node.projections(projections);
        node.isPartitioned(analysis.table().isPartitioned());
        setOutputTypes(node);
        return node;
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.