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: remove hand-optimizations from queries #90

Merged
merged 1 commit into from
Apr 2, 2024
Merged

feat: remove hand-optimizations from queries #90

merged 1 commit into from
Apr 2, 2024

Conversation

ritchie46
Copy link
Member

@ritchie46 ritchie46 commented Apr 2, 2024

@@ -42,21 +42,24 @@ def query() -> pd.DataFrame:
supplier_ds = supplier_ds()

rsel = region_ds.r_name == "ASIA"
osel = (orders_ds.o_orderdate >= date1) & (orders_ds.o_orderdate < date2)
Copy link
Member Author

Choose a reason for hiding this comment

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

Filters before the join is not a direct translation from SQL. The optimizer has to determine which predicates can pass which joins.

@@ -24,7 +24,7 @@ def q() -> None:
.filter(pl.col("p_size") == var_1)
.filter(pl.col("p_type").str.ends_with(var_2))
.filter(pl.col("r_name") == var_3)
).cache()
Copy link
Member Author

Choose a reason for hiding this comment

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

The optimizer has to find common subplans.

@@ -18,51 +18,34 @@ def query() -> pd.DataFrame:
nonlocal lineitem
lineitem = lineitem()

lineitem_filtered = lineitem.loc[
:,
Copy link
Member Author

Choose a reason for hiding this comment

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

Hand written projection pushdown.

@ritchie46 ritchie46 merged commit 92c0aca into main Apr 2, 2024
2 checks passed
@ritchie46 ritchie46 deleted the queries branch April 2, 2024 09:52
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.

1 participant