-
Notifications
You must be signed in to change notification settings - Fork 29
Automatic columns selector for joins function #168
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
Open
pcbldi
wants to merge
9
commits into
scicloj:master
Choose a base branch
from
pcbldi:joins-automatic-column-selector
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cb0bfad
Use automatic column selector in left-join
prakash-defnx a1ca0ee
Add automatic selector functionality for all join functions
prakash-defnx 59604c4
Update api ns with new function signature
pcbldi 81f627b
Add another test
pcbldi bb1c463
remove :all from column-selector
pcbldi d42c600
Fix typo
pcbldi 6702403
Add tests for join functions
pcbldi eeb0691
Add docstring
pcbldi 47d8d9d
Add more doc-strings
pcbldi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,22 +53,35 @@ | |
| (impl [(first cols-left) (first cols-right)] ds-left ds-right (or options {})) | ||
| (multi-join impl ds-left ds-right cols-left cols-right options)))) | ||
|
|
||
| (defn- automatic-columns-selector [ds-left ds-right] | ||
| (let [cols-l (set (column-names ds-left :all)) | ||
| cols-r (set (column-names ds-right :all))] | ||
|
||
| (vec (s/intersection cols-l cols-r))) ) | ||
|
|
||
| (defn left-join | ||
| ([ds-left ds-right] | ||
| (left-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (left-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (apply-join j/left-join ds-left ds-right columns-selector options))) | ||
|
|
||
| (defn right-join | ||
| ([ds-left ds-right] | ||
| (right-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (right-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (apply-join j/right-join ds-left ds-right columns-selector options))) | ||
|
|
||
| (defn inner-join | ||
| ([ds-left ds-right] | ||
| (inner-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (inner-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (apply-join j/inner-join ds-left ds-right columns-selector options))) | ||
|
|
||
| (defn asof-join | ||
| ([ds-left ds-right] | ||
| (asof-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (asof-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (apply-join j/left-join-asof ds-left ds-right columns-selector options))) | ||
|
|
@@ -82,6 +95,8 @@ | |
|
|
||
| (defn full-join | ||
| "Join keeping all rows" | ||
| ([ds-left ds-right] | ||
| (full-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (full-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (apply-join full-join-wrapper ds-left ds-right columns-selector options))) | ||
|
|
@@ -95,12 +110,16 @@ | |
| (distinct))) | ||
|
|
||
| (defn semi-join | ||
| ([ds-left ds-right] | ||
| (semi-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (semi-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (->> (semi-anti-join-indexes ds-left ds-right columns-selector options) | ||
| (select-rows ds-left)))) | ||
|
|
||
| (defn anti-join | ||
| ([ds-left ds-right] | ||
| (anti-join ds-left ds-right (automatic-columns-selector ds-left ds-right))) | ||
| ([ds-left ds-right columns-selector] (anti-join ds-left ds-right columns-selector nil)) | ||
| ([ds-left ds-right columns-selector options] | ||
| (->> (semi-anti-join-indexes ds-left ds-right columns-selector options) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:allcan be skipped.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,thanks.