I finally got around to testing your patch on a realistic data set. In
short, the patch worked beautifully even with the division by 2 removed. In
case it's helpful, the full write up of my investigation can be found at
https://gist.github.com/mattlong/0617bec6e1cf5bc6b70c6c2951901df7
Your reasoni
Not to let perfect be the enemy of better, but we're facing a variant of
this issue that would not be addressed by the proposed patch. If you're
interested, the real world use case is described in
https://github.com/medplum/medplum/issues/7310. Rows have an array
consisting of one common element pr