cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

colexec: use tree.DNull when projection is called on null input

Open DrewKimball opened this issue 3 years ago • 1 comments
trafficstars

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 #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.

DrewKimball avatar Sep 22 '22 01:09 DrewKimball

This change is Reviewable

cockroach-teamcity avatar Sep 22 '22 01:09 cockroach-teamcity

TFTR! bors r+

DrewKimball avatar Sep 30 '22 04:09 DrewKimball

Build succeeded:

craig[bot] avatar Sep 30 '22 05:09 craig[bot]

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 770898abe8471b62453b43789fd983ecb1af2494 to blathers/backport-release-21.2-88425: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


error creating merge commit from 770898abe8471b62453b43789fd983ecb1af2494 to blathers/backport-release-22.1-88425: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.1.x failed. See errors above.


:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

blathers-crl[bot] avatar Sep 30 '22 05:09 blathers-crl[bot]

blathers backport 22.2.0

DrewKimball avatar Oct 04 '22 22:10 DrewKimball