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 sort merge join #668

Merged
merged 10 commits into from
Jul 8, 2023
Merged

Conversation

wang1309
Copy link
Contributor

@wang1309 wang1309 commented Apr 3, 2023

What this PR does:
sort merge join dataset

Which issue(s) this PR fixes:

Fixes #642

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@dongzl dongzl added this to the 0.3.0 milestone Apr 4, 2023
@dongzl dongzl added the kernel kernel label Apr 4, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2023

Codecov Report

Patch coverage: 67.79% and project coverage change: +0.52 🎉

Comparison is base (39096e4) 36.77% compared to head (64c70a2) 37.29%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #668      +/-   ##
==========================================
+ Coverage   36.77%   37.29%   +0.52%     
==========================================
  Files         229      230       +1     
  Lines       24016    24429     +413     
==========================================
+ Hits         8832     9112     +280     
- Misses      14177    14273      +96     
- Partials     1007     1044      +37     
Impacted Files Coverage Δ
pkg/dataset/sort_merge_join.go 67.79% <67.79%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dongzl dongzl changed the title [WIP] Feat sort merge join Feat sort merge join Apr 29, 2023

var outerValue, innerValue proto.Value

for {
Copy link
Contributor

@jjeffcaii jjeffcaii May 3, 2023

Choose a reason for hiding this comment

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

  1. should 'yield' current compare checkpoint rows, consider: [1,2,3] inner join [2,2,2,3,3,3].
  2. should handle all join types, not only inner join.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@jjeffcaii
Copy link
Contributor

Please add unit tests.


func (s *SortMergeJoin) Next() (proto.Row, error) {
// all data is order

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the unnecessary blank line at the function beginning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

func (s *SortMergeJoin) resGenerate(leftRow proto.Row, rightRow proto.Row) proto.Row {
res := make([]proto.Value, leftRow.Length()+rightRow.Length())
leftValue := make([]proto.Value, leftRow.Length())
rightValue := make([]proto.Value, rightRow.Length())
Copy link
Contributor

Choose a reason for hiding this comment

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

if rightRow is nil(refer to line 100), would this cause NPE?

}

func (s *SortMergeJoin) Next() (proto.Row, error) {
// all data is order
Copy link
Contributor

@Mulavar Mulavar May 5, 2023

Choose a reason for hiding this comment

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

Maybe it's better to move the comment into the SortMergeJoin struct like this:

//SortMergeJoin ensures that the data sets participating in the join are in order before using sort-merge join.
type SortMergeJoin struct {
	fields     []proto.Field
	joinColumn *JoinColumn
	joinType   ast.JoinType
	outer      proto.Dataset
	inner      proto.Dataset
}

@sonarcloud
Copy link

sonarcloud bot commented Jun 18, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

No Coverage information No Coverage information
20.8% 20.8% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

package dataset

import (
"go.uber.org/atomic"
Copy link
Contributor

Choose a reason for hiding this comment

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

 挪到第二个 import 里面

Copy link
Contributor

Choose a reason for hiding this comment

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

@wang1309 at root package, use this tool:

go get -u github.com/dubbogo/tools/cmd/imports-formatter

imports-formatter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@sonarcloud
Copy link

sonarcloud bot commented Jul 1, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

No Coverage information No Coverage information
20.8% 20.8% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@sonarcloud
Copy link

sonarcloud bot commented Jul 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

No Coverage information No Coverage information
20.8% 20.8% Duplication

@AlexStocks AlexStocks merged commit bce788c into arana-db:master Jul 8, 2023
Lvnszn pushed a commit to Lvnszn/arana that referenced this pull request Jul 22, 2023
* add sort merge join file

* feat:add sort merge join

* feat: sort merge join feature add

* temp commit

* add unit test and optimize code

* delete unuse file

* fixed: fix review dog fault

* add comment

* format import

---------

Co-authored-by: wangrui130 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SQL] Sort-Merge join dataset API
8 participants