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

Support for UNION, INTERSECT & EXCEPT in SQLContext #8917

Closed
csubhodeep opened this issue May 18, 2023 · 5 comments
Closed

Support for UNION, INTERSECT & EXCEPT in SQLContext #8917

csubhodeep opened this issue May 18, 2023 · 5 comments
Labels
A-sql Area: Polars SQL functionality enhancement New feature or an improvement of an existing feature

Comments

@csubhodeep
Copy link

Problem description

I wish Polars SQL could support combination of results from multiple queries using set operations.

Relates to #8743.

References:

  1. Combining Queries (UNION, INTERSECT, EXCEPT)
@csubhodeep csubhodeep added the enhancement New feature or an improvement of an existing feature label May 18, 2023
@csubhodeep csubhodeep changed the title Support for UNION, INTERSECT & EXCEPT Support for UNION, INTERSECT & EXCEPT in SQLContext May 18, 2023
@alexander-beedie alexander-beedie added the A-sql Area: Polars SQL functionality label May 18, 2023
@alexander-beedie
Copy link
Collaborator

UNION is now done: #8936

@xdev-x
Copy link

xdev-x commented Aug 21, 2023

Is it possible for UNION to concatenate with the diagonal strategy ?

@cmdlineluser
Copy link
Contributor

@xdev-x I thought UNION BY NAME was supposed to do that.

df1 = pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
df2 = pl.DataFrame({"c": [4, 5, 6, 7]})

pl.SQLContext(frames={"df1": df1, "df2": df2}).execute("""
select * from df1 union by name select * from df2
""").collect()

# ShapeError: unable to append to a dataframe of width 2 with a dataframe of width 1

@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Oct 9, 2023

Is it possible for UNION to concatenate with the diagonal strategy ?

It will be in the upcoming 0.19.8; we have just committed support for UNION BY NAME and UNION ALL BY NAME ✌️

@alexander-beedie
Copy link
Collaborator

FYI: this was closed by #16960 👌
All three of these set ops will be available in the 1.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql Area: Polars SQL functionality enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants