Summary:
Do a bunch of cleanup of YbBindSearchArray. Main goal is to extract out
the logic to cull an array in order to use it for bucketized index
purposes.
- Remove useless line "(void) datum_nulls;"
- Before calling ybcBindTupleExprCondIn, attnums was wastefully
allocating an extra index. And there was no point in creating a
separate local array and copying data into it when a pointer to the
existing array of all attnums exists. Pass the right pointer instead
to avoid copy.
- Avoid "Move past header key." in YbNeedTupleRangeCheck and
YbIsTupleInRange by passing arguments that already are past the
header.
- Improve YbShouldRecheckEquality to not return true on general type
mismatches besides integer ones because that's just a waste of
performance and doesn't change the outcome.
- Add helper YbIsValueOutOfRange to reduce code duplication.
- Split the main for loop over elements to is_row and !is_row.
- Make variables more clearly named to have prefix "row_" or "scalar_"
depending on the mode.
- Remove bad copy-pasted comments:
- "And set up the BTArrayKeyInfo data."
- "We could cache this data, but not clear it's worth it"
- Move the array culling logic to a new separate function YbCullArray.
This function may be used in the future for bucketized indexes work.
- Overall, improve variable names and code comments.
Jira: DB-18546
Test Plan:
On Almalinux 8:
./yb_build.sh fastdebug --gcc13 daemons initdb \
--java-test 'org.yb.pgsql.TestPgRegressJoin'
Close: #28834
Original commit: 62dcbe1b4f099eb17296c241f33bcf670167c50b / D47091
Reviewers: mtakahara, aagrawal
Reviewed By: aagrawal
Differential Revision: https://phorge.dev.yugabyte.com/D47946