Skip to content

Conversation

@patrick-schultz
Copy link
Member

@patrick-schultz patrick-schultz commented Oct 9, 2025

Change Description

The changes are summarized by the removed warning silencers in build.mill​.

Security Assessment

  • This change cannot impact the Hail Batch instance as deployed by Broad Institute in GCP

@patrick-schultz patrick-schultz force-pushed the ps/push-utzzvzyqrtsk branch 2 times, most recently from daf99a1 to 22a2e36 Compare October 10, 2025 16:49
@patrick-schultz patrick-schultz marked this pull request as ready for review October 30, 2025 14:26
Copy link
Member

@ehigham ehigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic. We can now replace BatchClient.paginated with LazyList.unfold for great good.

Comment on lines -427 to -501
/** An abstraction for building an {@code Array} of known size. Guarantees a left-to-right
* traversal
*
* @param xs
* the thing to iterate over
* @param size
* the size of array to allocate
* @param key
* given the source value and its source index, yield the target index
* @param combine
* given the target value, the target index, the source value, and the source index, compute
* the new target value
* @tparam A
* @tparam B
*/
def coalesce[A, B: ClassTag](
xs: GenTraversableOnce[A]
)(
size: Int,
key: (A, Int) => Int,
z: B,
)(
combine: (B, A) => B
): Array[B] = {
val a = Array.fill(size)(z)

for ((x, idx) <- xs.toIterator.zipWithIndex) {
val k = key(x, idx)
a(k) = combine(a(k), x)
}

a
}

def mapSameElements[K, V](l: Map[K, V], r: Map[K, V], valueEq: (V, V) => Boolean): Boolean = {
def entryMismatchMessage(failures: TraversableOnce[(K, V, V)]): String = {
require(failures.nonEmpty)
val newline = System.lineSeparator()
val sb = new StringBuilder
sb ++= "The maps do not have the same entries:" + newline
for (failure <- failures)
sb ++= s" At key ${failure._1}, the left map has ${failure._2} and the right map has ${failure._3}" + newline
sb ++= s" The left map is: $l" + newline
sb ++= s" The right map is: $r" + newline
sb.result()
}

if (l.keySet != r.keySet) {
println(
s"""The maps do not have the same keys.
| These keys are unique to the left-hand map: ${l.keySet -- r.keySet}
| These keys are unique to the right-hand map: ${r.keySet -- l.keySet}
| The left map is: $l
| The right map is: $r
""".stripMargin
)
false
} else {
val fs = Array.newBuilder[(K, V, V)]
for ((k, lv) <- l) {
val rv = r(k)
if (!valueEq(lv, rv))
fs += ((k, lv, rv))
}
val failures = fs.result()

if (!failures.isEmpty) {
println(entryMismatchMessage(failures))
false
} else {
true
}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added via Giphy

Copy link
Collaborator

@chrisvittal chrisvittal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants