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(python): Support for MergeSort #12462

Closed
wants to merge 1 commit into from

Conversation

pedroerp
Copy link
Contributor

Summary: Adding support for mege sort in PyVelox plan builder API.

Differential Revision: D70294152

@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 Feb 27, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70294152

Copy link

netlify bot commented Feb 27, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit d6a7475
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67c0e137dd19ba0008ef8e7f

pedroerp added a commit to pedroerp/velox-1 that referenced this pull request Feb 27, 2025
Summary:

Adding support for mege sort in PyVelox plan builder API.

Differential Revision: D70294152
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70294152

@@ -282,6 +282,22 @@ PyPlanBuilder& PyPlanBuilder::mergeJoin(
return *this;
}

PyPlanBuilder& PyPlanBuilder::mergeSort(

Choose a reason for hiding this comment

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

nit: IMO this name is a bit confusing because the data is already sorted and we are just merging them. we aren't doing any sorting per-se. Something like sortedMerge would be more descriptive. I'll leave it up to you though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. I'll rename it.

sources.reserve(pySources.size());

for (const auto& pySource : pySources) {
if (pySource.has_value()) {

Choose a reason for hiding this comment

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

In what situation would anyone pass in an empty PyPlanNode? Wondering why this is a vector of optionals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is because plan_builder.get_plan_node() returns an optional. It could be done if the plan builder is empty (if no nodes were added yet).

@@ -213,6 +213,15 @@ class PyPlanBuilder {
const std::string& filter,
core::JoinType joinType);

/// Takes N sorted `source` subtrees and merges them into a sorted output.
/// Assumes that all sources are sorted in `keys`.

Choose a reason for hiding this comment

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

Suggested change
/// Assumes that all sources are sorted in `keys`.
/// Assumes that all sources are sorted on `keys`.

py::arg("sources"),
py::doc(R"(
Takes N sorted `source` subtrees and merges them into a sorted output.
Assumes that all sources are sorted in `keys`.

Choose a reason for hiding this comment

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

Suggested change
Assumes that all sources are sorted in `keys`.
Assumes that all sources are sorted on `keys`.

pedroerp added a commit to pedroerp/velox-1 that referenced this pull request Feb 27, 2025
Summary:

Adding support for mege sort in PyVelox plan builder API.

Reviewed By: kostasxmeta

Differential Revision: D70294152
pedroerp added a commit to pedroerp/velox-1 that referenced this pull request Feb 27, 2025
Summary:

Adding support for mege sort in PyVelox plan builder API.

Reviewed By: kostasxmeta

Differential Revision: D70294152
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70294152

Summary:
Pull Request resolved: facebookincubator#12462

Adding support for mege sort in PyVelox plan builder API.

Reviewed By: kostasxmeta

Differential Revision: D70294152
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D70294152

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e065010.

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. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants