Skip to content

Commit

Permalink
nondeterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
kellen committed Jan 30, 2025
1 parent 92fad69 commit 9a00f69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ private[coders] class MutablePriorityQueueCoder[T: Ordering](bc: BCoder[T])
super.encode(value, os)
override def decode(inStream: InputStream): m.PriorityQueue[T] =
decode(inStream, m.PriorityQueue.newBuilder[T])
override def verifyDeterministic(): Unit =
throw new NonDeterministicException(
this,
"Ordering of elements in a priority queue may be non-deterministic."
)
}

private[coders] class BitSetCoder extends AtomicCoder[BitSet] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ final class CoderTest extends AnyFlatSpec with Matchers {
pq coderShould roundtrip() and
beOfType[CoderTransform[_, _]] and
materializeTo[MutablePriorityQueueCoder[_]] and
beFullyCompliantNotConsistentWithEquals()
beSerializable() and
structuralValueConsistentWithEquals() and
beNotConsistentWithEquals() and
bytesCountTested() and
beNonDeterministic()
}
}

Expand Down Expand Up @@ -429,7 +433,8 @@ final class CoderTest extends AnyFlatSpec with Matchers {
beOfType[CoderTransform[_, _]] and
materializeTo[JPriorityQueueCoder[_]] and
beSerializable() and
structuralValueConsistentWithEquals()
structuralValueConsistentWithEquals() and
beNonDeterministic()
}
}

Expand Down

0 comments on commit 9a00f69

Please sign in to comment.