Skip to content

Commit

Permalink
colexec: use tree.DNull when projection is called on null input
Browse files Browse the repository at this point in the history
Most projections skip rows for which one or more arguments are null, and
just output a null for those rows. However, some projections can actually
accept null arguments. Previously, we were using the values from the vec
even when the `Nulls` bitmap was set for that row, which invalidates the
data in the vec for that row. This could cause a non-null value to be
unexpectedly concatenated to an array when an argument was null (nothing
should be added to the array in this case).

This commit modifies the projection operators that operate on datum-backed
vectors to explicitly set the argument to `tree.DNull` in the case when
the `Nulls` bitmap is set. This ensures that the projection is not
performed with the invalid (and arbitrary) value in the datum vec at that
index.

Fixes cockroachdb#87919

Release note (bug fix): Fixed a bug in `Concat` projection operators
for arrays that could cause non-null values to be added to the array
when one of the arguments was null.
  • Loading branch information
DrewKimball committed Nov 10, 2022
1 parent cf70396 commit db00b57
Show file tree
Hide file tree
Showing 7 changed files with 3,576 additions and 5,385 deletions.
Loading

0 comments on commit db00b57

Please sign in to comment.