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: left join #3576

Merged
merged 5 commits into from
Nov 15, 2023
Merged

feat: left join #3576

merged 5 commits into from
Nov 15, 2023

Conversation

aceforeverd
Copy link
Collaborator

@aceforeverd aceforeverd commented Oct 30, 2023

The result of a LEFT OUTER JOIN (or simply LEFT JOIN) for two from_items always retains all rows of the left from_item in the JOIN operation, even if no rows in the right from_item satisfy the join predicate.

Syntax

LEFT [OUTER] JOIN

Example:

SELECT * FROM t1 LEFT JOIN t2 on t1.key = t2.key

Online Requirements

A simple LEFT JOIN can not online directly, since it always outputs a table. But LEFT JOIN can ack as a subquery inside other queries, currently we only consider LAST JOIN (maybe work on WINDOW or WINDOW UNION later)

LEFT JOIN can be the right source of a LAST JOIN query, format of

SELECT ... FROM request LAST JOIN 
(SELECT ... FROM t2 LEFT JOIN t3 ON ...) tx ON ...`
  • table t3 must index optimized by the LEFT JOIN condition
  • table t2 must index optimized by the outer side LEFT JOIN condition

@github-actions github-actions bot added execute-engine hybridse sql engine storage-engine openmldb storage engine. nameserver & tablet labels Oct 30, 2023
@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Attention: 311 lines in your changes are missing coverage. Please review.

Comparison is base (2fb650a) 40.14% compared to head (eab8951) 75.39%.

Files Patch % Lines
hybridse/src/vm/runner_builder.cc 65.14% 206 Missing ⚠️
hybridse/src/vm/catalog_wrapper.cc 57.35% 29 Missing ⚠️
hybridse/src/vm/cluster_task.cc 75.90% 20 Missing ⚠️
hybridse/include/vm/mem_catalog.h 50.00% 15 Missing ⚠️
hybridse/include/vm/catalog.h 0.00% 12 Missing ⚠️
hybridse/src/vm/catalog_wrapper.h 76.08% 11 Missing ⚠️
hybridse/src/vm/generator.cc 95.28% 5 Missing ⚠️
hybridse/src/vm/cluster_task.h 92.00% 4 Missing ⚠️
hybridse/src/vm/runner.cc 76.47% 4 Missing ⚠️
...ybridse/examples/toydb/src/tablet/tablet_catalog.h 80.00% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #3576       +/-   ##
=============================================
+ Coverage     40.14%   75.39%   +35.25%     
  Complexity      635      635               
=============================================
  Files           191      727      +536     
  Lines         11207   130597   +119390     
  Branches       1317     1317               
=============================================
+ Hits           4499    98468    +93969     
- Misses         6417    31838    +25421     
  Partials        291      291               

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aceforeverd aceforeverd force-pushed the feat-left-join branch 2 times, most recently from 1437ce9 to f63f85d Compare November 1, 2023 15:47
@aceforeverd aceforeverd marked this pull request as ready for review November 1, 2023 15:48
@aceforeverd aceforeverd force-pushed the feat-left-join branch 2 times, most recently from 5e255d1 to f315fd2 Compare November 2, 2023 14:11
runner.cc is too large, sepreate RunnerBuilder, RunnerContext, Runner and ClusterTask in
difference files
For REQUESTJOIN(ANY1(T1), ANY2(T2)),
ANY1 may optimize T1, REQUESTJOIN, ANY2 may optimize T2, building
cluster task correctly
@aceforeverd aceforeverd merged commit 5d0d638 into 4paradigm:main Nov 15, 2023
28 checks passed
@aceforeverd aceforeverd deleted the feat-left-join branch November 15, 2023 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-engine hybridse sql engine storage-engine openmldb storage engine. nameserver & tablet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants