Skip to content

fix(query): make hash join streams interruptible - #20236

Merged
zhang2014 merged 2 commits into
databendlabs:mainfrom
dqhl76:codex/hash-join-interrupt-check
Jul 31, 2026
Merged

fix(query): make hash join streams interruptible#20236
zhang2014 merged 2 commits into
databendlabs:mainfrom
dqhl76:codex/hash-join-interrupt-check

Conversation

@dqhl76

@dqhl76 dqhl76 commented Jul 31, 2026

Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

New hash join streams could remain inside a single Processor::process() call while consuming an unbounded number of internal batches. If the query was killed during that work, the processor did not return to the scheduler to observe cancellation.

This PR:

  • checks interruption between batches in join streams that can filter away or consume an unbounded number of results
  • covers nested-loop scans and right-side final scans that can traverse the full build side in one call
  • leaves fixed-size probe/result batch paths unchanged
  • adds a stateful regression test that runs an outer left hash join, kills the query, and waits for it to leave system.processes
  • refactors the existing kill test to use bounded polling instead of fixed ten-second sleeps

There are no migrations, configuration changes, or rollout steps.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Validation:

  • cargo check -p databend-query --lib
  • cargo clippy -p databend-query --lib -- -D warnings
  • cargo fmt --all -- --check
  • python3 -m py_compile tests/suites/1_stateful/02_query/02_0000_kill_query.py
  • Ruff format and lint checks for the stateful test
  • Manual standalone verification through the MySQL protocol, including the outer left hash join kill regression

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

AI assistance

  • AI usage: An AI coding agent drafted the patch; I reviewed and added logic tests
  • Responsible human: @dqhl76
  • The responsible human has read every line of this diff and can explain each change

@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Jul 31, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e7f6dc515

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/suites/1_stateful/02_query/02_0000_kill_query.py Outdated
@dqhl76

dqhl76 commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 5a98534f7d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@zhang2014
zhang2014 merged commit 64381e4 into databendlabs:main Jul 31, 2026
185 of 189 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants