Search in sources :

Example 26 with ServerSelector

use of org.apache.druid.client.selector.ServerSelector in project druid by druid-io.

the class CachingClusteredClientTest method makeMockHashBasedSelector.

private ServerSelector makeMockHashBasedSelector(DruidServer server, List<String> partitionDimensions, @Nullable HashPartitionFunction partitionFunction, int partitionNum, int partitions) {
    final DataSegment segment = new DataSegment(SegmentId.dummy(DATA_SOURCE), null, null, null, new HashBasedNumberedShardSpec(partitionNum, partitions, partitionNum, partitions, partitionDimensions, partitionFunction, ServerTestHelper.MAPPER), null, 9, 0L);
    ServerSelector selector = new ServerSelector(segment, new HighestPriorityTierSelectorStrategy(new RandomServerSelectorStrategy()));
    selector.addServerAndUpdateSegment(new QueryableDruidServer(server, null), segment);
    return selector;
}
Also used : HashBasedNumberedShardSpec(org.apache.druid.timeline.partition.HashBasedNumberedShardSpec) ServerSelector(org.apache.druid.client.selector.ServerSelector) HighestPriorityTierSelectorStrategy(org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy) DataSegment(org.apache.druid.timeline.DataSegment) RandomServerSelectorStrategy(org.apache.druid.client.selector.RandomServerSelectorStrategy) QueryableDruidServer(org.apache.druid.client.selector.QueryableDruidServer)

Aggregations

ServerSelector (org.apache.druid.client.selector.ServerSelector)26 DataSegment (org.apache.druid.timeline.DataSegment)17 QueryableDruidServer (org.apache.druid.client.selector.QueryableDruidServer)16 HighestPriorityTierSelectorStrategy (org.apache.druid.client.selector.HighestPriorityTierSelectorStrategy)11 Interval (org.joda.time.Interval)11 RandomServerSelectorStrategy (org.apache.druid.client.selector.RandomServerSelectorStrategy)10 Test (org.junit.Test)10 TableDataSource (org.apache.druid.query.TableDataSource)7 ResponseContext (org.apache.druid.query.context.ResponseContext)6 ArrayList (java.util.ArrayList)5 QueryRunner (org.apache.druid.query.QueryRunner)5 SegmentDescriptor (org.apache.druid.query.SegmentDescriptor)5 Map (java.util.Map)4 QueryPlus (org.apache.druid.query.QueryPlus)4 MultipleIntervalSegmentSpec (org.apache.druid.query.spec.MultipleIntervalSegmentSpec)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 HashMap (java.util.HashMap)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Druids (org.apache.druid.query.Druids)3 FinalizeResultsQueryRunner (org.apache.druid.query.FinalizeResultsQueryRunner)3