Skip to content

Commit 1497806

Browse files
authored
fix: register OneToOnePartition in PartitionInfo @JsonSubTypes (#5033)
1 parent b492a62 commit 1497806

2 files changed

Lines changed: 3 additions & 20 deletions

File tree

common/workflow-core/src/main/scala/org/apache/texera/amber/core/workflow/PartitionInfo.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
3131
new Type(value = classOf[HashPartition], name = "hash"),
3232
new Type(value = classOf[RangePartition], name = "range"),
3333
new Type(value = classOf[SinglePartition], name = "single"),
34+
new Type(value = classOf[OneToOnePartition], name = "oneToOne"),
3435
new Type(value = classOf[BroadcastPartition], name = "broadcast"),
3536
new Type(value = classOf[UnknownPartition], name = "none")
3637
)

common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,39 +171,21 @@ class PartitionInfoSpec extends AnyFlatSpec {
171171
// ---------------------------------------------------------------------------
172172

173173
"PartitionInfo @JsonSubTypes" should
174-
"list the current registration set (omits OneToOnePartition)" in {
175-
// Pin: the @JsonSubTypes annotation on PartitionInfo currently registers
176-
// HashPartition, RangePartition, SinglePartition, BroadcastPartition,
177-
// and UnknownPartition — but NOT OneToOnePartition. The "all" claim is
178-
// documented separately in the pendingUntilFixed test below so this
179-
// spec only documents the present-day set.
174+
"register every concrete PartitionInfo subclass" in {
180175
val annotation = classOf[PartitionInfo].getAnnotation(classOf[JsonSubTypes])
181176
val registered = annotation.value().toList.map(_.value().getSimpleName).toSet
182177
assert(
183178
registered == Set(
184179
"HashPartition",
185180
"RangePartition",
186181
"SinglePartition",
182+
"OneToOnePartition",
187183
"BroadcastPartition",
188184
"UnknownPartition"
189185
)
190186
)
191187
}
192188

193-
it should "eventually register every concrete PartitionInfo subclass (pendingUntilFixed)" in pendingUntilFixed {
194-
// Intended contract: every concrete PartitionInfo subtype must be
195-
// reachable through the polymorphic dispatch on `type`, otherwise
196-
// Jackson cannot deserialize the missing payload (today: OneToOne-
197-
// Partition). Asserting `contains "OneToOnePartition"` here flips
198-
// this test from Pending to a real pass once the bug is fixed —
199-
// pendingUntilFixed inverts that and turns the now-passing
200-
// assertion into a failure so the fix has to delete the marker
201-
// deliberately.
202-
val annotation = classOf[PartitionInfo].getAnnotation(classOf[JsonSubTypes])
203-
val registered = annotation.value().toList.map(_.value().getSimpleName).toSet
204-
assert(registered.contains("OneToOnePartition"))
205-
}
206-
207189
// ---------------------------------------------------------------------------
208190
// case-class equality
209191
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)