findingrish commented on code in PR #14985:
URL: https://github.com/apache/druid/pull/14985#discussion_r1373120457
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -302,13 +303,30 @@ public Enumerable<Object[]> scan(DataContext root)
final DataSegment segment = val.getDataSegment();
segmentsAlreadySeen.add(segment.getId());
final PartialSegmentData partialSegmentData =
partialSegmentDataMap.get(segment.getId());
- long numReplicas = 0L, numRows = 0L, isRealtime = 0L, isAvailable
= 0L;
+ long numReplicas = 0L, numRows = 0L, isRealtime, isAvailable = 0L;
+
if (partialSegmentData != null) {
numReplicas = partialSegmentData.getNumReplicas();
- numRows = partialSegmentData.getNumRows();
isAvailable = partialSegmentData.isAvailable();
- isRealtime = partialSegmentData.isRealtime();
+ numRows = partialSegmentData.getNumRows();
+ }
+
+ // If table schema building is enabled on the Coordinator,
SegmentMetadataCache on the
+ // broker might have outdated or no information regarding numRows
and rowSignature for a segment.
+ // We should use {@code numRows} from the segment polled from the
coordinator.
+ if (null != val.getNumRows()) {
+ numRows = val.getNumRows();
}
+
+ isRealtime = Boolean.TRUE.equals(val.isRealtime()) ? 1 : 0;
+
+ // set of segments returned from Coordinator include published and
realtime segments
+ // so realtime segments are not published and vice versa
+ boolean isPublished = !val.isRealtime();
Review Comment:
Thanks for pointing out, simplified it.
I guess earlier when I put up the draft changes this field was nullable, but
that is no longer the case.
--
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]