From 25b6309493acae9ee5e5b9e04fcb9d852be638f4 Mon Sep 17 00:00:00 2001 From: Matthew Ball Date: Mon, 11 May 2026 22:46:23 -0700 Subject: [PATCH] register OneToOnePartition in PartitionInfo @JsonSubTypes --- .../amber/core/workflow/PartitionInfo.scala | 1 + .../core/workflow/PartitionInfoSpec.scala | 22 ++----------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/common/workflow-core/src/main/scala/org/apache/texera/amber/core/workflow/PartitionInfo.scala b/common/workflow-core/src/main/scala/org/apache/texera/amber/core/workflow/PartitionInfo.scala index 90210c7a9b7..b5e6a02dab6 100644 --- a/common/workflow-core/src/main/scala/org/apache/texera/amber/core/workflow/PartitionInfo.scala +++ b/common/workflow-core/src/main/scala/org/apache/texera/amber/core/workflow/PartitionInfo.scala @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo} new Type(value = classOf[HashPartition], name = "hash"), new Type(value = classOf[RangePartition], name = "range"), new Type(value = classOf[SinglePartition], name = "single"), + new Type(value = classOf[OneToOnePartition], name = "oneToOne"), new Type(value = classOf[BroadcastPartition], name = "broadcast"), new Type(value = classOf[UnknownPartition], name = "none") ) diff --git a/common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala b/common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala index 867c6b8e79b..3a8240c3781 100644 --- a/common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala +++ b/common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala @@ -171,12 +171,7 @@ class PartitionInfoSpec extends AnyFlatSpec { // --------------------------------------------------------------------------- "PartitionInfo @JsonSubTypes" should - "list the current registration set (omits OneToOnePartition)" in { - // Pin: the @JsonSubTypes annotation on PartitionInfo currently registers - // HashPartition, RangePartition, SinglePartition, BroadcastPartition, - // and UnknownPartition — but NOT OneToOnePartition. The "all" claim is - // documented separately in the pendingUntilFixed test below so this - // spec only documents the present-day set. + "register every concrete PartitionInfo subclass" in { val annotation = classOf[PartitionInfo].getAnnotation(classOf[JsonSubTypes]) val registered = annotation.value().toList.map(_.value().getSimpleName).toSet assert( @@ -184,26 +179,13 @@ class PartitionInfoSpec extends AnyFlatSpec { "HashPartition", "RangePartition", "SinglePartition", + "OneToOnePartition", "BroadcastPartition", "UnknownPartition" ) ) } - it should "eventually register every concrete PartitionInfo subclass (pendingUntilFixed)" in pendingUntilFixed { - // Intended contract: every concrete PartitionInfo subtype must be - // reachable through the polymorphic dispatch on `type`, otherwise - // Jackson cannot deserialize the missing payload (today: OneToOne- - // Partition). Asserting `contains "OneToOnePartition"` here flips - // this test from Pending to a real pass once the bug is fixed — - // pendingUntilFixed inverts that and turns the now-passing - // assertion into a failure so the fix has to delete the marker - // deliberately. - val annotation = classOf[PartitionInfo].getAnnotation(classOf[JsonSubTypes]) - val registered = annotation.value().toList.map(_.value().getSimpleName).toSet - assert(registered.contains("OneToOnePartition")) - } - // --------------------------------------------------------------------------- // case-class equality // ---------------------------------------------------------------------------