Hello, David! As I can see, your patch has the same idea as my v2-0001-Query-ID-Calculation-Fix-Variant-B.patch from [1]. I think it would be better to extract the jumble buffer update with hash calculation into a function (CompressJumble in my patch). This will result in fewer changes to the source code. We can also simply dump the null count to the buffer when we encounter a non-null field (which will be processed in AppendJumble, indeed).
What do your thing about my patch (v2-0001-Query-ID-Calculation-Fix-Variant-B.patch)? [1] https://www.postgresql.org/message-id/5ac172e0b77a4baba50671cd1a15285f%40localhost.localdomain