This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-8835-3ba45ee5a5f641388d1a9eda90afa26a62d70d30 in repository https://gitbox.apache.org/repos/asf/texera.git
commit f916c96c53d75c6661505bb804c9c80557b9d716 Author: Xinyuan Lin <[email protected]> AuthorDate: Wed Oct 21 05:29:28 2026 +0000 refactor(workflow-operator): remove the unused toImmutableMap (#8835) ### What changes were proposed in this PR? Removes `OperatorDescriptorUtils.toImmutableMap`, which no production code calls. **−40 lines.** There is no behaviour change. The PR also removes the `scala.jdk.CollectionConverters._` import, which only this method used, and the three spec cases that only exercised it. `equallyPartitionGoal`, the object's only live member, and its spec cases are unchanged. ### History | | | | --- | --- | | **Introduced by** | #2439 (2024-03-05), "Schema propagation push down to PhysicalPlan", as `AmberUtils.toImmutableMap` for Java operator descriptors. #2667 (2024-05-16) moved it into `OperatorDescriptorUtils` | | **Usage removed by** | #3179 (2024-12-29), "Convert Java operator descriptors to Scala". It rewrote the last Java callers (`TypeCastingOpDesc`, `PythonUDFSourceOpDescV2`, `RUDFSourceOpDesc`) in Scala, which needs no conversion | It has been dead for over twenty-one months. ### Any related issues, documentation, discussions? Closes #8834 ### How was this PR tested? No new tests. The five `equallyPartitionGoal` cases remain. Locally, from the repo root with Java 17: - `sbt "WorkflowOperator/Test/compile" "WorkflowExecutionService/Test/compile"`: success. - `sbt "WorkflowOperator/testOnly *OperatorDescriptorUtilsSpec"`: 5 tests, all pass. - `sbt "WorkflowOperator/scalafmtCheckAll" "WorkflowOperator/scalafixAll --check"`: clean. To re-check: ``` git grep -n "toImmutableMap" # no hits ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- .../operator/util/OperatorDescriptorUtils.scala | 7 ----- .../util/OperatorDescriptorUtilsSpec.scala | 33 ---------------------- 2 files changed, 40 deletions(-) diff --git a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtils.scala b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtils.scala index 3a9e71f832..4e9f11a45b 100644 --- a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtils.scala +++ b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtils.scala @@ -20,7 +20,6 @@ package org.apache.texera.amber.operator.util import scala.collection.mutable -import scala.jdk.CollectionConverters._ object OperatorDescriptorUtils { @@ -43,10 +42,4 @@ object OperatorDescriptorUtils { goalPerWorker.toList } - def toImmutableMap[K, V]( - javaMap: java.util.Map[K, V] - ): scala.collection.immutable.Map[K, V] = { - javaMap.asScala.toMap - } - } diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtilsSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtilsSpec.scala index 127c2e5a4f..db94b9a0ec 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtilsSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/util/OperatorDescriptorUtilsSpec.scala @@ -68,37 +68,4 @@ class OperatorDescriptorUtilsSpec extends AnyFlatSpec { // 1 = 4*0 + 1 → only the first slot gets the single unit assert(OperatorDescriptorUtils.equallyPartitionGoal(1, 4) == List(1, 0, 0, 0)) } - - // --------------------------------------------------------------------------- - // toImmutableMap — round-trip - // --------------------------------------------------------------------------- - - "toImmutableMap" should "convert an empty java.util.Map to an empty immutable Map" in { - val javaMap = new java.util.HashMap[String, Int]() - val scalaMap = OperatorDescriptorUtils.toImmutableMap(javaMap) - assert(scalaMap.isEmpty) - } - - it should "preserve all key/value pairs" in { - val javaMap = new java.util.LinkedHashMap[String, Integer]() - javaMap.put("a", Integer.valueOf(1)) - javaMap.put("b", Integer.valueOf(2)) - javaMap.put("c", Integer.valueOf(3)) - val scalaMap = OperatorDescriptorUtils.toImmutableMap(javaMap) - assert( - scalaMap == Map( - "a" -> Integer.valueOf(1), - "b" -> Integer.valueOf(2), - "c" -> Integer.valueOf(3) - ) - ) - } - - it should "return an immutable Map (compile-time enforced)" in { - val javaMap = new java.util.HashMap[String, Integer]() - javaMap.put("x", Integer.valueOf(9)) - val scalaMap: scala.collection.immutable.Map[String, Integer] = - OperatorDescriptorUtils.toImmutableMap(javaMap) - assert(scalaMap("x") == 9) - } }
