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

Add left join type to python relational API #2918

Merged
merged 3 commits into from
Jan 13, 2022
Merged

Conversation

hannes
Copy link
Member

@hannes hannes commented Jan 13, 2022

e.g.

rel1.join(rel2, 'i=j', 'left')

@hannes
Copy link
Member Author

hannes commented Jan 13, 2022

@Mytherin @pdet any objections

"in join_condition",
py::arg("other_rel"), py::arg("join_condition"))
"in join_condition. Types supported are 'inner' and 'left'",
py::arg("other_rel"), py::arg("condition"), py::arg("type") = "left")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe default to inner?

Copy link

Choose a reason for hiding this comment

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

I agree, since join implies inner join in SQL, it makes sense to reflect that fact in the API here. I think it offers the least surprise 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes that's a mistake

@@ -100,7 +100,7 @@ struct DuckDBPyRelation {

unique_ptr<DuckDBPyRelation> Map(py::function fun);

unique_ptr<DuckDBPyRelation> Join(DuckDBPyRelation *other, const string &condition);
unique_ptr<DuckDBPyRelation> Join(DuckDBPyRelation *other, const string &condition, const string &type);
Copy link

@JakobGM JakobGM Jan 13, 2022

Choose a reason for hiding this comment

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

What do you think about naming this parameter how instead of type for two reasons?

  1. type is shadowing a built-in in Python, which will make some linters complain.
  2. how is the parameter used by pandas in merge() and join() so most developers will already be familiar with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure

@hannes hannes merged commit c16a2f0 into duckdb:master Jan 13, 2022
@hannes hannes deleted the relext42 branch January 13, 2022 15:25
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.

None yet

3 participants