[Variant] Fix NULL handling for shredded object fields #8395
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Which issue does this PR close?
Arrayimpl forVariantArrayandShreddedVariantFieldArray#8392Rationale for this change
Somehow, #8392 exposes a latent bug in #8366, which has improper NULL handling for shredded object fields. The shredding PR originally attempted to handle this case, but somehow the test did not trigger the bug and so the (admittedly incomplete) code was removed. See #8366 (comment). To be honest, I have no idea how the original ever worked correctly, nor why the new PR is able to expose the problem.
What changes are included in this PR?
When used as a top-level builder,
VariantToShreddedVariantRowBuilder::append_nullmust append NULL to its ownNullBufferBuilder; but when used as a shredded object field builder, it must append non-NULL. Plumb a newtop_levelparameter through the various functions and into the two sub-builders it relies on, so they can implement the correct semantics.Are these changes tested?
In theory, yes (I don't know how the object shredding test ever passed). And it fixes the breakage in #8392.
Are there any user-facing changes?
No