adarshsanjeev commented on code in PR #13909:
URL: https://github.com/apache/druid/pull/13909#discussion_r1139960535


##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderator.java:
##########
@@ -785,6 +785,9 @@ private DataSegment mergeAndPush(
         for (FireHydrant fireHydrant : sink) {
           Pair<ReferenceCountingSegment, Closeable> segmentAndCloseable = 
fireHydrant.getAndIncrementSegment();
           final QueryableIndex queryableIndex = 
segmentAndCloseable.lhs.asQueryableIndex();
+          if (queryableIndex != null) {

Review Comment:
   I think the getter above would return null if the queryable index is closed. 
I think we gracefully handle this elsewhere, I haven't changed that part of the 
code. This is just to avoid throwing an NPE here if we do run into this 
problem, since we are just reporting metrics here.



##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/counters/SegmentGenerationProgressCounter.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.msq.counters;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
+
+import javax.annotation.Nullable;
+import java.util.Objects;
+
+/**
+ * Counters for segment generation phase. Created by {@link 
CounterTracker#segmentGenerationProgress()}.
+ */
+public class SegmentGenerationProgressCounter implements QueryCounter
+{
+  @GuardedBy("this")
+  private long rowsProcessed = 0L;
+
+  @GuardedBy("this")
+  private long rowsPersisted = 0L;
+
+  @GuardedBy("this")
+  private long rowsMerged = 0L;
+
+  public void incrementRowProcessedCount()

Review Comment:
   Done



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