findingrish commented on code in PR #15817:
URL: https://github.com/apache/druid/pull/15817#discussion_r1572141397


##########
server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:
##########
@@ -1829,8 +1938,18 @@ private Set<DataSegment> announceHistoricalSegmentBatch(
       PreparedBatch preparedBatch = 
handle.prepareBatch(buildSqlToInsertSegments());
       for (List<DataSegment> partition : partitionedSegments) {
         for (DataSegment segment : partition) {
-          preparedBatch.add()
-              .bind("id", segment.getId().toString())
+          String segmentId = segment.getId().toString();
+          Long schemaId = null;
+          Long numRows = null;
+
+          if (schemaPresent && 
segmentSchemaMapping.getSegmentIdToMetadataMap().containsKey(segmentId)) {
+            Pair<Long, Long> schemaInfoPair = 
fetchSegmentSchemaInformation(segmentSchemaMapping, segmentId, 
fingerprintSchemaIdMap);
+            schemaId = schemaInfoPair.lhs;
+            numRows = schemaInfoPair.rhs;
+          }
+
+          PreparedBatchPart preparedBatchPart = preparedBatch.add()

Review Comment:
   We need two different SQL's since the DB doesn't contain the additional 
columns if the feature is disabled. 
   



-- 
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