Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Combine low selectivity vectors generated by the hash join filter #11739

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zhli1142015
Copy link
Contributor

@zhli1142015 zhli1142015 commented Dec 4, 2024

This PR re-applies #10987, addressing the following issues:

  1. Feedback raised in this comment.
  2. Ensuring the loop terminates when outputBytes exceeds preferredOutputBatchBytes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 4, 2024
Copy link

netlify bot commented Dec 4, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit a11a3da
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/676ba42d4f7b720008216193

@zhli1142015
Copy link
Contributor Author

zhli1142015 commented Dec 25, 2024

I ran the fuzzer test with join filters applied for half an hour.
./_build/release/velox/exec/tests/velox_join_fuzzer_test --duration_sec 1800 --filter_ratio 1.0 --minloglevel=0 --stderrthreshold=2

E1225 13:42:08.007054 310289 JoinFuzzer.cpp:1469] ==============================> Done with iteration 9219
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.

…cebookincubator#10987)

Summary:
Combine low selectivity vectors generated by join filter
**Problem**
We found in TPCDS query72 that the join filter leads to a large number of
low-selectivity result vectors, which affects the performance of subsequent
operations.

Details:
The number of input vectors on the probe side of the corresponding join is
84,087, with a total of 743,851,486 rows (our batch size is set to 10,240). Due
to a large number of duplicate rows on the build side, the final result
inflates. The number of output vectors from the join is 2,806,054. The
corresponding join filter filters out a large portion of the results, so the
 number of output rows is 1,430,253,235. This leads to the output of many
 sparse vectors (the average batch row count is 504).

 **Solution**
The original logic continues the [loop](https://github.com/facebookincubator/velox/blob/main/velox/exec/HashProbe.cpp#L1065) to fill more rows if no rows pass the
filters. To resolve this issue, we can extend it to handle cases where only
partial rows pass the filters. We need to ensure that the indices
'outputRowMapping_' and 'outputTableRows_' are filled as much as possible until
we either reach the preferred batch size or have processed all rows in the
current input vector.

This approach will not only address the issue mentioned above but also avoid
unnecessary data copying.

Pull Request resolved: facebookincubator#10987

Reviewed By: pedroerp

Differential Revision: D65949331

Pulled By: Yuhta

fbshipit-source-id: e8e54e7be1b5a93ba71387aa49f00dcff3cc8aa2
@zhli1142015 zhli1142015 marked this pull request as ready for review December 27, 2024 02:38
@zhli1142015
Copy link
Contributor Author

Hello,
@xiaoxmeng @Yuhta and @tanjialiang , could you please help to take a look this PR? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants