Package io.crate.metadata

Examples of io.crate.metadata.Routing


        return modules;
    }

    @Test
    public void testPartitionNameFromAssignmentWithBytesRef() throws Exception {
        TableInfo tableInfo = TestingTableInfo.builder(new TableIdent("doc", "users"), RowGranularity.DOC, new Routing(null))
                .add("name", DataTypes.STRING, null, true)
                .addPrimaryKey("name").build();

        PartitionName partitionName = PartitionPropertiesAnalyzer.toPartitionName(
                tableInfo,
View Full Code Here


        countInfo = new FunctionInfo(new FunctionIdent(CountAggregation.NAME, ImmutableList.<DataType>of()), DataTypes.LONG);
    }

    @Test
    public void testGetOutputStreamersFromCollectNode() throws Exception {
        CollectNode collectNode = new CollectNode("bla", new Routing(new HashMap<String, Map<String, Set<Integer>>>()));
        collectNode.outputTypes(Arrays.<DataType>asList(DataTypes.BOOLEAN, DataTypes.FLOAT, DataTypes.OBJECT));
        PlanNodeStreamerVisitor.Context ctx = visitor.process(collectNode);
        Streamer<?>[] streamers = ctx.outputStreamers();
        assertThat(streamers.length, is(3));
        assertThat(streamers[0], instanceOf(DataTypes.BOOLEAN.streamer().getClass()));
View Full Code Here

    }

    @Test
    public void testGetOutputStreamersFromCollectNodeWithWrongNull() throws Exception {
        // null means we expect an aggstate here
        CollectNode collectNode = new CollectNode("bla", new Routing(new HashMap<String, Map<String, Set<Integer>>>()));
        collectNode.outputTypes(Arrays.<DataType>asList(DataTypes.BOOLEAN, null, DataTypes.OBJECT));
        PlanNodeStreamerVisitor.Context ctx = visitor.process(collectNode);
        // assume an unknown column
        assertEquals(DataTypes.UNDEFINED.streamer(), ctx.outputStreamers()[1]);
    }
View Full Code Here

        assertEquals(DataTypes.UNDEFINED.streamer(), ctx.outputStreamers()[1]);
    }

    @Test
    public void testGetOutputStreamersFromCollectNodeWithAggregations() throws Exception {
        CollectNode collectNode = new CollectNode("bla", new Routing(new HashMap<String, Map<String, Set<Integer>>>()));
        collectNode.outputTypes(Arrays.<DataType>asList(DataTypes.BOOLEAN, null, null, DataTypes.DOUBLE));
        AggregationProjection aggregationProjection = new AggregationProjection();
        aggregationProjection.aggregations(Arrays.asList( // not a real use case, only for test convenience, sorry
                new Aggregation(maxInfo, Arrays.<Symbol>asList(new InputColumn(0)), Aggregation.Step.ITER, Aggregation.Step.FINAL),
                new Aggregation(maxInfo, Arrays.<Symbol>asList(new InputColumn(1)), Aggregation.Step.ITER, Aggregation.Step.PARTIAL)
View Full Code Here

        searchNode = mock(QueryThenFetchNode.class);
        Map<String, Map<String, Set<Integer>>> locations = new HashMap<>();
        HashMap<String, Set<Integer>> location1 = new HashMap<String, Set<Integer>>();
        location1.put("loc1", new HashSet<Integer>(Arrays.asList(1)));
        locations.put("node_1", location1);
        Routing routing = new Routing(locations);
        when(searchNode.routing()).thenReturn(routing);

        clusterService = mock(ClusterService.class);
        ClusterState state = mock(ClusterState.class);
        when(clusterService.state()).thenReturn(state);
View Full Code Here

        }

        maxRowgranularity = RowGranularity.fromStream(in);

        if (in.readBoolean()) {
            routing = new Routing();
            routing.readFrom(in);
        }

        whereClause = new WhereClause(in);
View Full Code Here

        this.concreteIndices = new String[]{ident.name()};
        Map<String, Map<String, Set<Integer>>> locations = new HashMap<>(1);
        Map<String, Set<Integer>> tableLocation = new HashMap<>(1);
        tableLocation.put(ident.fqn(), null);
        locations.put(null, tableLocation);
        this.routing = new Routing(locations);
    }
View Full Code Here

    static CollectNode collect(AbstractDataAnalysis analysis,
                               List<Symbol> toCollect,
                               ImmutableList<Projection> projections,
                               @Nullable String partitionIdent) {
        Routing routing = analysis.table().getRouting(analysis.whereClause());
        if (partitionIdent != null && routing.hasLocations()) {
            routing = filterRouting(routing, PartitionName.fromPartitionIdent(
                            analysis.table().ident().name(), partitionIdent).stringValue());
        }
        CollectNode node = new CollectNode("collect", routing);
        node.whereClause(analysis.whereClause());
View Full Code Here

                newLocations.put(entry.getKey(), tableMap);
            }

        }
        if (newLocations.size()>0) {
            return new Routing(newLocations);
        } else {
            return new Routing();
        }

    }
View Full Code Here

            builder.put(
                    node.id(),
                    MapBuilder.<String, Set<Integer>>newMapBuilder().put(ident().fqn(), null).map()
            );
        }
        return new Routing(builder.build());
    }
View Full Code Here

TOP

Related Classes of io.crate.metadata.Routing

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.