gerashegalov commented on code in PR #18775:
URL: https://github.com/apache/iceberg/pull/18775#discussion_r4774046888


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/InheritedTaskMetrics.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.iceberg.spark.source;
+
+import java.util.Map;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+import org.apache.spark.sql.connector.metric.CustomTaskMetric;
+
+/**
+ * Task metrics reported by the readers that ran earlier in the same Spark 
task.
+ *
+ * <p>When a task reads several input partitions, Spark opens one reader per 
partition and passes
+ * the previous reader's metrics to the next through {@code 
initMetricsValues}. Spark keeps only the
+ * last reader's values, so each reader must add the inherited values to its 
own.

Review Comment:
   Nit: Spark only calls `initMetricsValues` from 4.0.3 on (SPARK-55302). On 
4.0.0 to 4.0.2 nothing is inherited, and each task still reports its last 
reader's metrics. That's harmless, but the runtime jar runs on any 4.0.x, so it 
may be worth a sentence here and in the description:
   
   ```suggestion
    * <p>When a task reads several input partitions, Spark opens one reader per 
partition and passes
    * the previous reader's metrics to the next through {@code 
initMetricsValues}. Spark keeps only the
    * last reader's values, so each reader must add the inherited values to its 
own.
    *
    * <p>Spark calls {@code initMetricsValues} only from 4.0.3 on 
(SPARK-55302). On 4.0.0 to 4.0.2,
    * each task still reports only its last reader's metrics.
   ```



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