kfaraz commented on code in PR #16676:
URL: https://github.com/apache/druid/pull/16676#discussion_r1668032146


##########
server/src/test/java/org/apache/druid/segment/metadata/CoordinatorSegmentMetadataCacheTest.java:
##########
@@ -1721,12 +1787,207 @@ public void testSameSegmentAddedOnMultipleServer() 
throws InterruptedException,
     Assert.assertEquals(existingMetadata.getNumReplicas(), 
currentMetadata.getNumReplicas());
   }
 
-  private void verifyFooDSSchema(CoordinatorSegmentMetadataCache schema)
+  private CoordinatorSegmentMetadataCache setupForColdDatasourceSchemaTest()
+  {
+    DataSegment coldSegment =
+        DataSegment.builder()
+                   .dataSource(DATASOURCE1)
+                   .interval(Intervals.of("2000/P2Y"))
+                   .version("1")
+                   .shardSpec(new LinearShardSpec(0))
+                   .size(0)
+                   .build();
+
+    ImmutableMap.Builder<SegmentId, SegmentMetadata> segmentStatsMap = new 
ImmutableMap.Builder<>();
+    segmentStatsMap.put(coldSegment.getId(), new SegmentMetadata(20L, "fp"));
+    ImmutableMap.Builder<String, SchemaPayload> schemaPayloadMap = new 
ImmutableMap.Builder<>();
+    schemaPayloadMap.put(
+        "fp",
+        new SchemaPayload(RowSignature.builder()
+                                      .add("dim1", ColumnType.STRING)
+                                      .add("c1", ColumnType.STRING)
+                                      .add("c2", ColumnType.LONG)
+                                      .build())
+    );
+    segmentSchemaCache.updateFinalizedSegmentSchema(
+        new 
SegmentSchemaCache.FinalizedSegmentSchemaInfo(segmentStatsMap.build(), 
schemaPayloadMap.build())
+    );
+
+    ImmutableDruidDataSource druidDataSource =
+        new ImmutableDruidDataSource(
+            coldSegment.getDataSource(),
+            Collections.emptyMap(),
+            Collections.singletonMap(coldSegment.getId(), coldSegment)
+        );
+
+    
Mockito.when(sqlSegmentsMetadataManager.getImmutableDataSourcesWithAllUsedSegments()).thenReturn(Collections.singletonList(druidDataSource));
+
+    CoordinatorSegmentMetadataCache schema = new 
CoordinatorSegmentMetadataCache(
+        getQueryLifecycleFactory(walker),
+        serverView,
+        SEGMENT_CACHE_CONFIG_DEFAULT,
+        new NoopEscalator(),
+        new InternalQueryConfig(),
+        new NoopServiceEmitter(),
+        segmentSchemaCache,
+        backFillQueue,
+        sqlSegmentsMetadataManager,
+        segmentsMetadataManagerConfigSupplier
+    );
+
+    SegmentReplicaCount segmentReplicaCount = new SegmentReplicaCount();
+    segmentReplicaCount.setRequired(0, 0);

Review Comment:
   You can just add a comment to that effect and/or use test method names that 
clarify that point.
   Invoking this method requires making it `public` which doesn't really seem 
necessary since it is only going to be used in this test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to