You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/25 06:48:07 UTC

[GitHub] [spark] viirya opened a new pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

viirya opened a new pull request #32330:
URL: https://github.com/apache/spark/pull/32330


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error message, please read the guideline first:
        https://spark.apache.org/error-message-guidelines.html
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   This patch changes custom metric updating to update per certain rows (currently 100), instead of per row.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   Based on previous discussion https://github.com/apache/spark/pull/31451#discussion_r605413557, we should only update custom metrics per certain (e.g. 100) rows and also at the end of the task. Updating per row doesn't make too much benefit.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   
   Existing unit 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32330:
URL: https://github.com/apache/spark/pull/32330#discussion_r626108060



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/continuous/ContinuousDataSourceRDD.scala
##########
@@ -92,10 +92,18 @@ class ContinuousDataSourceRDD(
 
     val partitionReader = readerForPartition.getPartitionReader()
     new NextIterator[InternalRow] {
+      private var numRow = 0L
+
       override def getNext(): InternalRow = {
-        partitionReader.currentMetricsValues.foreach { metric =>
-          customMetrics(metric.name()).set(metric.value())
+        if (numRow % CustomMetrics.numRowsPerUpdate == 0) {
+          partitionReader.currentMetricsValues.foreach { metric =>
+            assert(customMetrics.contains(metric.name()),

Review comment:
       Removed




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833501328


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138198/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826972373


   @dongjoon-hyun Yes, I will rebase this PR. Thanks.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32330:
URL: https://github.com/apache/spark/pull/32330#discussion_r620012160



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/continuous/ContinuousDataSourceRDD.scala
##########
@@ -92,10 +92,18 @@ class ContinuousDataSourceRDD(
 
     val partitionReader = readerForPartition.getPartitionReader()
     new NextIterator[InternalRow] {
+      private var numRow = 0L
+
       override def getNext(): InternalRow = {
-        partitionReader.currentMetricsValues.foreach { metric =>
-          customMetrics(metric.name()).set(metric.value())
+        if (numRow % CustomMetrics.numRowsPerUpdate == 0) {
+          partitionReader.currentMetricsValues.foreach { metric =>
+            assert(customMetrics.contains(metric.name()),

Review comment:
       I can remove it. I also thought it is not necessary but just added for a comment before.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/metric/CustomMetrics.scala
##########
@@ -25,6 +25,8 @@ import org.apache.spark.sql.connector.CustomMetric
 object CustomMetrics {
   private[spark] val V2_CUSTOM = "v2Custom"
 
+  private[spark] val numRowsPerUpdate = 100L

Review comment:
       `numRow` is a long, I guess this can be just int.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceRDD.scala
##########
@@ -92,12 +104,15 @@ private class PartitionIterator[T](
     if (!hasNext) {
       throw QueryExecutionErrors.endOfStreamError()
     }
-    reader.currentMetricsValues.foreach { metric =>
-      assert(customMetrics.contains(metric.name()),
-        s"Custom metrics ${customMetrics.keys.mkString(", ")} do not contain the metric " +
-          s"${metric.name()}")
-      customMetrics(metric.name()).set(metric.value())
+    if (numRow % CustomMetrics.numRowsPerUpdate == 0) {
+      reader.currentMetricsValues.foreach { metric =>

Review comment:
       sure.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832428019


   **[Test build #138161 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138161/testReport)** for PR 32330 at commit [`4f0be6c`](https://github.com/apache/spark/commit/4f0be6c267abebb1fa3f3375678e1cd146f62bc9).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826272960


   **[Test build #137908 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137908/testReport)** for PR 32330 at commit [`1a98660`](https://github.com/apache/spark/commit/1a986606576d4ca09cf68816fa338a89f8cbcf62).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826272960


   **[Test build #137908 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137908/testReport)** for PR 32330 at commit [`1a98660`](https://github.com/apache/spark/commit/1a986606576d4ca09cf68816fa338a89f8cbcf62).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826281272






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833358045


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42719/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833477995


   **[Test build #138198 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138198/testReport)** for PR 32330 at commit [`5f6cf5a`](https://github.com/apache/spark/commit/5f6cf5a6a9de14765ab3570f5516ebd74ecdb3af).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833347869






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833317954


   **[Test build #138198 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138198/testReport)** for PR 32330 at commit [`5f6cf5a`](https://github.com/apache/spark/commit/5f6cf5a6a9de14765ab3570f5516ebd74ecdb3af).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832394407


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42682/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826272960






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32330:
URL: https://github.com/apache/spark/pull/32330#discussion_r627140140



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/metric/CustomMetrics.scala
##########
@@ -17,11 +17,13 @@
 
 package org.apache.spark.sql.execution.metric
 
-import org.apache.spark.sql.connector.metric.CustomMetric
+import org.apache.spark.sql.connector.metric.{CustomMetric, CustomTaskMetric}
 
 object CustomMetrics {
   private[spark] val V2_CUSTOM = "v2Custom"
 
+  private[spark] val numRowsPerUpdate = 100

Review comment:
       nit: `NUM_ROWS_PER_UPDATE` since it's a constant?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826281272






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826876061


   https://github.com/apache/spark/pull/32348 is merged. Do we need to rebase this PR, @viirya ?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826475578


   cc @cloud-fan 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826281272






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826309942


   **[Test build #137908 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137908/testReport)** for PR 32330 at commit [`1a98660`](https://github.com/apache/spark/commit/1a986606576d4ca09cf68816fa338a89f8cbcf62).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833317954


   **[Test build #138198 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138198/testReport)** for PR 32330 at commit [`5f6cf5a`](https://github.com/apache/spark/commit/5f6cf5a6a9de14765ab3570f5516ebd74ecdb3af).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833517731


   thanks, merging to master!


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832394359






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan closed pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #32330:
URL: https://github.com/apache/spark/pull/32330


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32330:
URL: https://github.com/apache/spark/pull/32330#discussion_r626108183



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/metric/CustomMetrics.scala
##########
@@ -25,6 +25,8 @@ import org.apache.spark.sql.connector.CustomMetric
 object CustomMetrics {
   private[spark] val V2_CUSTOM = "v2Custom"
 
+  private[spark] val numRowsPerUpdate = 100L

Review comment:
       Made it as int.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832328083


   **[Test build #138161 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138161/testReport)** for PR 32330 at commit [`4f0be6c`](https://github.com/apache/spark/commit/4f0be6c267abebb1fa3f3375678e1cd146f62bc9).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833501328


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138198/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832328083


   **[Test build #138161 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138161/testReport)** for PR 32330 at commit [`4f0be6c`](https://github.com/apache/spark/commit/4f0be6c267abebb1fa3f3375678e1cd146f62bc9).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32330:
URL: https://github.com/apache/spark/pull/32330#discussion_r626108260



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceRDD.scala
##########
@@ -92,12 +104,15 @@ private class PartitionIterator[T](
     if (!hasNext) {
       throw QueryExecutionErrors.endOfStreamError()
     }
-    reader.currentMetricsValues.foreach { metric =>
-      assert(customMetrics.contains(metric.name()),
-        s"Custom metrics ${customMetrics.keys.mkString(", ")} do not contain the metric " +
-          s"${metric.name()}")
-      customMetrics(metric.name()).set(metric.value())
+    if (numRow % CustomMetrics.numRowsPerUpdate == 0) {
+      reader.currentMetricsValues.foreach { metric =>

Review comment:
       Added a reused method.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32330:
URL: https://github.com/apache/spark/pull/32330#discussion_r620010077



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceRDD.scala
##########
@@ -92,12 +104,15 @@ private class PartitionIterator[T](
     if (!hasNext) {
       throw QueryExecutionErrors.endOfStreamError()
     }
-    reader.currentMetricsValues.foreach { metric =>
-      assert(customMetrics.contains(metric.name()),
-        s"Custom metrics ${customMetrics.keys.mkString(", ")} do not contain the metric " +
-          s"${metric.name()}")
-      customMetrics(metric.name()).set(metric.value())
+    if (numRow % CustomMetrics.numRowsPerUpdate == 0) {
+      reader.currentMetricsValues.foreach { metric =>

Review comment:
       can we move it into a method to reuse code?

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/metric/CustomMetrics.scala
##########
@@ -25,6 +25,8 @@ import org.apache.spark.sql.connector.CustomMetric
 object CustomMetrics {
   private[spark] val V2_CUSTOM = "v2Custom"
 
+  private[spark] val numRowsPerUpdate = 100L

Review comment:
       does it need to be a long?

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/continuous/ContinuousDataSourceRDD.scala
##########
@@ -92,10 +92,18 @@ class ContinuousDataSourceRDD(
 
     val partitionReader = readerForPartition.getPartitionReader()
     new NextIterator[InternalRow] {
+      private var numRow = 0L
+
       override def getNext(): InternalRow = {
-        partitionReader.currentMetricsValues.foreach { metric =>
-          customMetrics(metric.name()).set(metric.value())
+        if (numRow % CustomMetrics.numRowsPerUpdate == 0) {
+          partitionReader.currentMetricsValues.foreach { metric =>
+            assert(customMetrics.contains(metric.name()),

Review comment:
       I'm not sure how useful is the assert here. It's for internal error only and `customMetrics(metric.name())` will fail too.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826279059






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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-833358045


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42719/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826272960


   **[Test build #137908 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/137908/testReport)** for PR 32330 at commit [`1a98660`](https://github.com/apache/spark/commit/1a986606576d4ca09cf68816fa338a89f8cbcf62).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832430675


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138161/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832430675


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138161/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832394407


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42682/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826475578


   cc @cloud-fan 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826281272


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/42432/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-832248996


   Rebased and updated for the comments. @cloud-fan @dongjoon-hyun 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #32330: [SPARK-35215][SQL] Update custom metric per certain rows and at the end of the task

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32330:
URL: https://github.com/apache/spark/pull/32330#issuecomment-826315375


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/137908/
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org