Skip to content

Reuse identical shuffles in P2P hash join - #361

Merged
phofl merged 4 commits into
dask:mainfrom
hendrikmakait:reuse-shuffle-in-join
Oct 27, 2023
Merged

phofl merged 4 commits into
dask:mainfrom
hendrikmakait:reuse-shuffle-in-join

Conversation

@hendrikmakait

Copy link
Copy Markdown
Member

IFF a shuffle has the exact same input and parameters, P2P hash join should reuse it.

Follow-up to #360

Comment thread dask_expr/_merge.py Outdated
token_left = token + "-left"
token_right = token + "-right"
token_left = _tokenize_deterministic(
self.left._name, self.shuffle_left_on, self.npartitions, self._partitions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I assume how doesn't matter in the shuffle algorithm?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, that will only become relevant in the actual merge, which happens after we shuffled all the data.

Comment thread dask_expr/_merge.py
token_left = token + "-left"
token_right = token + "-right"
token_left = _tokenize_deterministic(
"hash-join",

@hendrikmakait hendrikmakait Oct 26, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added this to ensure that we avoid any unwanted sharing between merges and shuffles. I don't have a good-enough overview right now to make sharing between them work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we can rely on name_input_{left/right} to truly be unique and identify distinct input dataframes, I believe we can even share between merges and ordinary shuffles. I wonder where this use case would come up, though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My main concern here is that shuffle_transfer and merge_transfer do different things. We'd have to refactor this so that they are in fact interchangeable and shareable. I guess there are only few cases where this would come in handy though. Maybe something like joining a dataframe on x and aggregating that same dataframe on x within the same graph?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes they do slightly different things at the moment, because the merge layer caused all kinds of troubles before that. This is on my todo list to align more closely.

@phofl
phofl merged commit bf8dcbe into dask:main Oct 27, 2023
@phofl

phofl commented Oct 27, 2023

Copy link
Copy Markdown
Collaborator

thx @hendrikmakait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants