Search in sources :

Example 1 with MetadataSegmentView

use of org.apache.druid.sql.calcite.schema.MetadataSegmentView in project druid by druid-io.

the class CalciteTests method createMockSystemSchema.

public static SystemSchema createMockSystemSchema(final DruidSchema druidSchema, final SpecificSegmentsQuerySegmentWalker walker, final PlannerConfig plannerConfig, final AuthorizerMapper authorizerMapper) {
    final DruidNode coordinatorNode = new DruidNode("test-coordinator", "dummy", false, 8081, null, true, false);
    FakeDruidNodeDiscoveryProvider provider = new FakeDruidNodeDiscoveryProvider(ImmutableMap.of(NodeRole.COORDINATOR, new FakeDruidNodeDiscovery(ImmutableMap.of(NodeRole.COORDINATOR, coordinatorNode))));
    final DruidNode overlordNode = new DruidNode("test-overlord", "dummy", false, 8090, null, true, false);
    FakeDruidNodeDiscoveryProvider overlordProvider = new FakeDruidNodeDiscoveryProvider(ImmutableMap.of(NodeRole.OVERLORD, new FakeDruidNodeDiscovery(ImmutableMap.of(NodeRole.OVERLORD, coordinatorNode))));
    final DruidLeaderClient druidLeaderClient = new DruidLeaderClient(new FakeHttpClient(), provider, NodeRole.COORDINATOR, "/simple/leader") {

        @Override
        public String findCurrentLeader() {
            return coordinatorNode.getHostAndPortToUse();
        }
    };
    final DruidLeaderClient overlordLeaderClient = new DruidLeaderClient(new FakeHttpClient(), overlordProvider, NodeRole.OVERLORD, "/simple/leader") {

        @Override
        public String findCurrentLeader() {
            return overlordNode.getHostAndPortToUse();
        }
    };
    return new SystemSchema(druidSchema, new MetadataSegmentView(druidLeaderClient, getJsonMapper(), new BrokerSegmentWatcherConfig(), plannerConfig), new TestServerInventoryView(walker.getSegments()), new FakeServerInventoryView(), authorizerMapper, druidLeaderClient, overlordLeaderClient, provider, getJsonMapper());
}
Also used : SystemSchema(org.apache.druid.sql.calcite.schema.SystemSchema) NamedSystemSchema(org.apache.druid.sql.calcite.schema.NamedSystemSchema) DiscoveryDruidNode(org.apache.druid.discovery.DiscoveryDruidNode) DruidNode(org.apache.druid.server.DruidNode) DruidLeaderClient(org.apache.druid.discovery.DruidLeaderClient) BrokerSegmentWatcherConfig(org.apache.druid.client.BrokerSegmentWatcherConfig) MetadataSegmentView(org.apache.druid.sql.calcite.schema.MetadataSegmentView)

Aggregations

BrokerSegmentWatcherConfig (org.apache.druid.client.BrokerSegmentWatcherConfig)1 DiscoveryDruidNode (org.apache.druid.discovery.DiscoveryDruidNode)1 DruidLeaderClient (org.apache.druid.discovery.DruidLeaderClient)1 DruidNode (org.apache.druid.server.DruidNode)1 MetadataSegmentView (org.apache.druid.sql.calcite.schema.MetadataSegmentView)1 NamedSystemSchema (org.apache.druid.sql.calcite.schema.NamedSystemSchema)1 SystemSchema (org.apache.druid.sql.calcite.schema.SystemSchema)1