This is an automated email from the ASF dual-hosted git repository.
dongjoon-hyun pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 0c9803e6f3e1 [SPARK-60835][4.0][GRAPHX][TEST][FOLLOWUP] Use `foreach`
instead of `gridTest` in `LabelPropagationSuite`
0c9803e6f3e1 is described below
commit 0c9803e6f3e1f0be625bcfa538706b98228b03f5
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Wed Nov 4 06:53:52 2026 -0800
[SPARK-60835][4.0][GRAPHX][TEST][FOLLOWUP] Use `foreach` instead of
`gridTest` in `LabelPropagationSuite`
### What changes were proposed in this pull request?
This PR aims to fix the `graphx` test compilation in `branch-4.0` by
replacing `gridTest` with `Seq.foreach` in `LabelPropagationSuite`.
The SPARK-60835 backport to `branch-4.0` (1ff8a134385, #60050) kept
master's `gridTest` call.
```scala
gridTest("Label propagation breaks label ties with the lowest vertex ID")(
Seq((1L, 2L), (-2L, -1L), (Long.MinValue, Long.MaxValue))) { case
(label1, label2) =>
```
However, `SparkFunSuite.gridTest` was added by SPARK-52405 (#51098) in
Apache Spark 4.1.0, so `branch-4.0` doesn't have it. This PR uses the
`Seq.foreach` pattern of the other `branch-4.0` test suites like
`RecoverySuite`. The test names are identical to the ones that `gridTest`
generates.
```scala
Seq((1L, 2L), (-2L, -1L), (Long.MinValue, Long.MaxValue)).foreach {
case param (label1, label2) =>
test(s"Label propagation breaks label ties with the lowest vertex ID
($param)") {
```
### Why are the changes needed?
To fix the compilation failure of the `graphx` test code in `branch-4.0`.
The `Precompile Spark` job and the module test jobs fail at the `graphx` test
compilation.
- https://github.com/apache/spark/actions/runs/41746258326
```
[error]
.../graphx/src/test/scala/org/apache/spark/graphx/lib/LabelPropagationSuite.scala:45:3:
not found: value gridTest
[error] gridTest("Label propagation breaks label ties with the lowest
vertex ID")(
[error] ^
[error]
.../graphx/src/test/scala/org/apache/spark/graphx/lib/LabelPropagationSuite.scala:48:32:
type mismatch;
[error] found : Any
[error] required: org.apache.spark.graphx.VertexId
[error] (which expands to) Long
...
[error] three errors found
[error] (graphx / Test / compileIncremental) Compilation failed
```
### Does this PR introduce _any_ user-facing change?
No, this is a test-only change.
### How was this patch tested?
Pass the CIs. I also ran the following manually on `branch-4.0` with JDK 17.
```
$ build/sbt 'graphx/testOnly
org.apache.spark.graphx.lib.LabelPropagationSuite' 'graphx/scalastyle'
'graphx/Test/scalastyle'
...
[info] - Label Propagation (1 second, 959 milliseconds)
[info] - Label propagation breaks label ties with the lowest vertex ID
((1,2)) (119 milliseconds)
[info] - Label propagation breaks label ties with the lowest vertex ID
((-2,-1)) (99 milliseconds)
[info] - Label propagation breaks label ties with the lowest vertex ID
((-9223372036854775808,9223372036854775807)) (118 milliseconds)
[info] - Label propagation chooses the most frequent label before breaking
ties (96 milliseconds)
[info] Tests: succeeded 5, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
...
[info] scalastyle Found 0 errors
...
[info] scalastyle Found 0 errors
```
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
Closes #60094 from dongjoon-hyun/d/branch-4-0-compile-error-5874d0.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../spark/graphx/lib/LabelPropagationSuite.scala | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git
a/graphx/src/test/scala/org/apache/spark/graphx/lib/LabelPropagationSuite.scala
b/graphx/src/test/scala/org/apache/spark/graphx/lib/LabelPropagationSuite.scala
index a55c68f96505..8feae732641a 100644
---
a/graphx/src/test/scala/org/apache/spark/graphx/lib/LabelPropagationSuite.scala
+++
b/graphx/src/test/scala/org/apache/spark/graphx/lib/LabelPropagationSuite.scala
@@ -42,16 +42,18 @@ class LabelPropagationSuite extends SparkFunSuite with
LocalSparkContext {
}
}
- gridTest("Label propagation breaks label ties with the lowest vertex ID")(
- Seq((1L, 2L), (-2L, -1L), (Long.MinValue, Long.MaxValue))) { case (label1,
label2) =>
- withSpark { sc =>
- val edges = Seq(Edge(0L, label1, 1), Edge(0L, label2, 1))
- val graph = Graph.fromEdges(sc.parallelize(edges), 1)
+ Seq((1L, 2L), (-2L, -1L), (Long.MinValue, Long.MaxValue)).foreach {
+ case param @ (label1, label2) =>
+ test(s"Label propagation breaks label ties with the lowest vertex ID
($param)") {
+ withSpark { sc =>
+ val edges = Seq(Edge(0L, label1, 1), Edge(0L, label2, 1))
+ val graph = Graph.fromEdges(sc.parallelize(edges), 1)
- val labels = LabelPropagation.run(graph, 1).vertices.collect().toSet
+ val labels = LabelPropagation.run(graph, 1).vertices.collect().toSet
- assert(labels === Set((0L, math.min(label1, label2)), (label1, 0L),
(label2, 0L)))
- }
+ assert(labels === Set((0L, math.min(label1, label2)), (label1, 0L),
(label2, 0L)))
+ }
+ }
}
test("Label propagation chooses the most frequent label before breaking
ties") {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]