You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "panbingkun (via GitHub)" <gi...@apache.org> on 2024/04/04 02:21:31 UTC

[PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

panbingkun opened a new pull request, #45867:
URL: https://github.com/apache/spark/pull/45867

   ### What changes were proposed in this pull request?
   The pr aims to `introduce` a `tool` that can `sort alphabetically` enumeration field in `LogEntry` automatically.
   
   
   ### Why are the changes needed?
   Enable developers to more conveniently write the enumeration values in `LogEntry` in alphabetical order according to the requirements of structured log development documents.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   
   ### How was this patch tested?
   - Manually test.
     ```
     SPARK_GENERATE_GOLDEN_FILES=1 
     build/sbt "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""
     ```
   - Pass GA.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1550949754


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -25,9 +32,59 @@ class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""
+   }}}
+   */
+  // scalastyle:on line.size.limit
+
+  /**
+   * Get a Path relative to the root project. It is assumed that a spark home is set.
+   */
+  protected final def getWorkspaceFilePath(first: String, more: String*): Path = {
+    if (!(sys.props.contains("spark.test.home") || sys.env.contains("SPARK_HOME"))) {
+      fail("spark.test.home or SPARK_HOME is not set.")
+    }
+    val sparkHome = sys.props.getOrElse("spark.test.home", sys.env("SPARK_HOME"))
+    java.nio.file.Paths.get(sparkHome, first +: more: _*)
+  }
+
+  private val regenerateGoldenFiles: Boolean = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
+
+  private val logKeyFilePath = getWorkspaceFilePath("common", "utils", "src", "main", "scala",
+    "org", "apache", "spark", "internal", "LogKey.scala")
+
+  test("LogKey enumeration fields are correctly sorted") {
+    val originalKeys = LogKey.values.toSeq
+    val sortedKeys = originalKeys.sortBy(_.toString)
+    if (regenerateGoldenFiles) {

Review Comment:
   Okay, let me do it right now.



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1550950062


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -25,9 +32,59 @@ class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""

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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1550947229


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -25,9 +32,59 @@ class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""
+   }}}
+   */
+  // scalastyle:on line.size.limit
+
+  /**
+   * Get a Path relative to the root project. It is assumed that a spark home is set.
+   */
+  protected final def getWorkspaceFilePath(first: String, more: String*): Path = {
+    if (!(sys.props.contains("spark.test.home") || sys.env.contains("SPARK_HOME"))) {
+      fail("spark.test.home or SPARK_HOME is not set.")
+    }
+    val sparkHome = sys.props.getOrElse("spark.test.home", sys.env("SPARK_HOME"))
+    java.nio.file.Paths.get(sparkHome, first +: more: _*)
+  }
+
+  private val regenerateGoldenFiles: Boolean = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
+
+  private val logKeyFilePath = getWorkspaceFilePath("common", "utils", "src", "main", "scala",
+    "org", "apache", "spark", "internal", "LogKey.scala")
+
+  test("LogKey enumeration fields are correctly sorted") {
+    val originalKeys = LogKey.values.toSeq
+    val sortedKeys = originalKeys.sortBy(_.toString)
+    if (regenerateGoldenFiles) {

Review Comment:
   Yeah, create a new method in this file .



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1552178878


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -17,17 +17,81 @@
 
 package org.apache.spark.util
 
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path}
+import java.util.{ArrayList => JList}
+
+import scala.jdk.CollectionConverters._
+
+import org.apache.commons.io.FileUtils
 import org.scalatest.funsuite.AnyFunSuite // scalastyle:ignore funsuite
 
 import org.apache.spark.internal.{Logging, LogKey}
+import org.apache.spark.internal.LogKey.LogKey
 
 class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit

Review Comment:
   This is no longer needed.



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #45867:
URL: https://github.com/apache/spark/pull/45867#issuecomment-2036253016

   @gengliangwang  all done.
   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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1551016767


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -17,17 +17,81 @@
 
 package org.apache.spark.util
 
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path}
+import java.util.{ArrayList => JList}
+
+import scala.jdk.CollectionConverters._
+
+import org.apache.commons.io.FileUtils
 import org.scalatest.funsuite.AnyFunSuite // scalastyle:ignore funsuite
 
 import org.apache.spark.internal.{Logging, LogKey}
+import org.apache.spark.internal.LogKey.LogKey
 
 class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite \"LogKey enumeration fields are correctly sorted\""

Review Comment:
   ```suggestion
           "common-utils/testOnly *LogKeySuite"
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1552516257


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -17,17 +17,81 @@
 
 package org.apache.spark.util
 
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path}
+import java.util.{ArrayList => JList}
+
+import scala.jdk.CollectionConverters._
+
+import org.apache.commons.io.FileUtils
 import org.scalatest.funsuite.AnyFunSuite // scalastyle:ignore funsuite
 
 import org.apache.spark.internal.{Logging, LogKey}
+import org.apache.spark.internal.LogKey.LogKey
 
 class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:

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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1552179174


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -17,17 +17,81 @@
 
 package org.apache.spark.util
 
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path}
+import java.util.{ArrayList => JList}
+
+import scala.jdk.CollectionConverters._
+
+import org.apache.commons.io.FileUtils
 import org.scalatest.funsuite.AnyFunSuite // scalastyle:ignore funsuite
 
 import org.apache.spark.internal.{Logging, LogKey}
+import org.apache.spark.internal.LogKey.LogKey
 
 class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:

Review Comment:
   Let's move this before line 32 `class LogKeySuite`



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #45867:
URL: https://github.com/apache/spark/pull/45867#issuecomment-2036088779

   cc @gengliangwang @dtenedor @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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1550872216


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -25,9 +32,59 @@ class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""
+   }}}
+   */
+  // scalastyle:on line.size.limit
+
+  /**
+   * Get a Path relative to the root project. It is assumed that a spark home is set.
+   */
+  protected final def getWorkspaceFilePath(first: String, more: String*): Path = {
+    if (!(sys.props.contains("spark.test.home") || sys.env.contains("SPARK_HOME"))) {
+      fail("spark.test.home or SPARK_HOME is not set.")
+    }
+    val sparkHome = sys.props.getOrElse("spark.test.home", sys.env("SPARK_HOME"))
+    java.nio.file.Paths.get(sparkHome, first +: more: _*)
+  }
+
+  private val regenerateGoldenFiles: Boolean = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
+
+  private val logKeyFilePath = getWorkspaceFilePath("common", "utils", "src", "main", "scala",
+    "org", "apache", "spark", "internal", "LogKey.scala")
+
+  test("LogKey enumeration fields are correctly sorted") {
+    val originalKeys = LogKey.values.toSeq
+    val sortedKeys = originalKeys.sortBy(_.toString)
+    if (regenerateGoldenFiles) {

Review Comment:
   Let's move the regeneration to a new method instead of keeping in the test 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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1550930932


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -25,9 +32,59 @@ class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""
+   }}}
+   */
+  // scalastyle:on line.size.limit
+
+  /**
+   * Get a Path relative to the root project. It is assumed that a spark home is set.
+   */
+  protected final def getWorkspaceFilePath(first: String, more: String*): Path = {
+    if (!(sys.props.contains("spark.test.home") || sys.env.contains("SPARK_HOME"))) {
+      fail("spark.test.home or SPARK_HOME is not set.")
+    }
+    val sparkHome = sys.props.getOrElse("spark.test.home", sys.env("SPARK_HOME"))
+    java.nio.file.Paths.get(sparkHome, first +: more: _*)
+  }
+
+  private val regenerateGoldenFiles: Boolean = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
+
+  private val logKeyFilePath = getWorkspaceFilePath("common", "utils", "src", "main", "scala",
+    "org", "apache", "spark", "internal", "LogKey.scala")
+
+  test("LogKey enumeration fields are correctly sorted") {
+    val originalKeys = LogKey.values.toSeq
+    val sortedKeys = originalKeys.sortBy(_.toString)
+    if (regenerateGoldenFiles) {

Review Comment:
   Do you mean: extract the regenerated method into an `independent method` and call it in that place?
   https://github.com/apache/spark/blob/3f6ac60e9966cbe2d35fc88693fdb055ad8c63c3/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala#L90-L117
   
   The basic idea is that when without setting environment variables `SPARK_GENERATE_GOLDEN_FILES` (default is false), the UT will only check whether the enumeration fields in `LogKey` have been `sorted alphabetically`.
   
   The steps used in my process of `migrating error classes` are roughly as follows:
   - Before I submit the changes, if I `remember` the formatting step, I will use the following command to regenerate the error classes file `error-classes.json` and submit them.
   ```
   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "core/testOnly *SparkThrowableSuite -- -t \"Error classes are correctly formatted\""
   
   ```
   - If I `forget` this step, if there are incorrect item in `error-classes.json` that are not sorted alphabetically, GA will help me discover (UT failed), then I will execute above command on local and resubmit the changes.
   
   I guess our scene is very similar to this.



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on code in PR #45867:
URL: https://github.com/apache/spark/pull/45867#discussion_r1550947105


##########
common/utils/src/test/scala/org/apache/spark/util/LogKeySuite.scala:
##########
@@ -25,9 +32,59 @@ class LogKeySuite
     extends AnyFunSuite // scalastyle:ignore funsuite
     with Logging {
 
-  test("LogKey enumeration fields must be sorted alphabetically") {
-    val keys = LogKey.values.toSeq
-    assert(keys === keys.sortBy(_.toString),
-      "LogKey enumeration fields must be sorted alphabetically")
+  // scalastyle:off line.size.limit
+  /* Used to regenerate the LogKey class file. Run:
+   {{{
+      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
+        "common-utils/testOnly *LogKeySuite -- -t \"LogKey enumeration fields are correctly sorted\""

Review Comment:
   Shall we remove the `-t ...` from the instruction to make it simpler?



-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang closed pull request #45867: [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically
URL: https://github.com/apache/spark/pull/45867


-- 
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: reviews-unsubscribe@spark.apache.org

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


Re: [PR] [SPARK-47723][CORE][TESTS] Introduce a tool that can sort alphabetically enumeration field in `LogEntry` automatically [spark]

Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on PR #45867:
URL: https://github.com/apache/spark/pull/45867#issuecomment-2038475615

   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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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