Skip to content

[fix](be) Correct null-aware mark join results for empty correlated subqueries on 4.1 - #70233

Merged
yiguolei merged 1 commit into
apache:branch-4.1from
mrhhsg:pick-69762-branch-4.1
Nov 10, 2026
Merged

yiguolei merged 1 commit into
apache:branch-4.1from
mrhhsg:pick-69762-branch-4.1

Conversation

@mrhhsg

@mrhhsg mrhhsg commented Nov 5, 2026

Copy link
Copy Markdown
Member

Summary

Backport the null-aware mark join correction from #69762 to branch-4.1.

  • Clear the NULL flag when emitting a no-match sentinel from a reusable probe buffer.
  • Preserve a NULL probe key for the existing dedicated handler, with its lookup state reset.
  • Add focused BE unit coverage and a correlated IN/NOT IN SQL regression.

Problem and fix

With an additional join predicate, a no-match sentinel could inherit a NULL flag from an earlier probe row. This could produce NULL instead of the expected FALSE or TRUE for an empty correlated subquery. The sentinel now explicitly clears that flag. The branch-4.1 backport also preserves nullable probe rows so they reach the existing null-key handler.

Testing

  • BUILD_TYPE=ASAN DISABLE_BE_JAVA_EXTENSIONS=OFF ./build.sh --be --fe -j 48 (includes FE checkstyle): passed.
  • BUILD_TYPE=ASAN ./run-be-ut.sh --run --filter='JoinHashTableTest.*' -j 48: 2 tests passed.
  • ./run-regression-test.sh --conf regression-test/conf/regression-conf.groovy --run -d nereids_syntax_p0 -s mark_join_correlated_empty: 1 suite passed on an isolated ASAN FE/BE cluster.
  • build-support/clang-format.sh, build-support/check-format.sh, and git diff --check: passed.

A null-aware mark join uses build index zero for an unmatched probe row.
The reusable output slot could retain a NULL flag from an earlier row,
causing correlated IN/NOT IN with an empty subquery to return NULL.

Clear the NULL flag when emitting the no-match sentinel. For branch-4.1,
preserve NULL probe rows for the existing handler and reset their lookup
state so they are not skipped.

Tests: ASAN BE/FE build with FE checkstyle; two focused BE unit tests;
correlated IN/NOT IN SQL regression; clang-format, check-format, and
git diff --check.

Backport of apache#69762, with the NULL-probe handling prerequisite
from apache#63767.

(cherry picked from commit aa68b25)
@mrhhsg

mrhhsg commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (3/3) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 61.86% (27330/44181)
Line Coverage 46.56% (285333/612869)
Region Coverage 42.14% (225669/535573)
Branch Coverage 43.75% (105264/240577)

@mrhhsg
mrhhsg marked this pull request as ready for review November 5, 2026 08:08
@mrhhsg
mrhhsg requested a review from yiguolei as a code owner November 5, 2026 08:08
@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (3/3) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 75.26% (32337/42969)
Line Coverage 59.69% (362929/607985)
Region Coverage 56.25% (301827/536624)
Branch Coverage 57.33% (137739/240276)

@yiguolei
yiguolei merged commit c5a876d into apache:branch-4.1 Nov 10, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants