Skip to content

Commit

Permalink
fix q16
Browse files Browse the repository at this point in the history
  • Loading branch information
luke396 committed Sep 6, 2024
1 parent 12340f4 commit 6a4ca79
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tpch/queries/q16.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ def query(part_ds: FrameT, partsupp_ds: FrameT, supplier_ds: FrameT) -> FrameT:
).select(nw.col("s_suppkey"), nw.col("s_suppkey").alias("ps_suppkey"))

return (
# not Done
part_ds.join(partsupp_ds, left_on="p_partkey", right_on="ps_partkey")
.filter(nw.col("p_brand") != var1)
.filter(~nw.col("p_type").str.contains("MEDIUM POLISHED*"))
.filter(nw.col("p_size").is_in([49, 14, 23, 45, 19, 3, 36, 9]))
.join(supplier, left_on="ps_suppkey", right_on="s_suppkey", how="left")
.filter(nw.col("ps_suppkey_right").is_null())
.group_by("p_brand", "p_type", "p_size")
.agg(nw.col("ps_suppkey").n_unique().alias("supplier_cnt"))
.agg(nw.col("ps_suppkey").unique().len().alias("supplier_cnt"))
.sort(
by=["supplier_cnt", "p_brand", "p_type", "p_size"],
descending=[True, False, False, False],
Expand Down

0 comments on commit 6a4ca79

Please sign in to comment.