Skip to content

Commit

Permalink
test(tpcds): add test for tpcds query 97 (#9939)
Browse files Browse the repository at this point in the history
  • Loading branch information
jitingxu1 authored Aug 27, 2024
1 parent c842453 commit d7401e0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ibis/backends/tests/tpc/ds/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3324,6 +3324,39 @@ def test_96(store_sales, household_demographics, time_dim, store):
)


@tpc_test("ds")
def test_97(store_sales, date_dim, catalog_sales):
ssci = (
store_sales.join(date_dim, [("ss_sold_date_sk", "d_date_sk")])
.filter(_.d_month_seq.between(1200, 1200 + 11))
.select(customer_sk=_.ss_customer_sk, item_sk=_.ss_item_sk)
.distinct()
)

csci = (
catalog_sales.join(date_dim, [("cs_sold_date_sk", "d_date_sk")])
.filter(_.d_month_seq.between(1200, 1200 + 11))
.select(customer_sk=_.cs_bill_customer_sk, item_sk=_.cs_item_sk)
.distinct()
)

return (
ssci.outer_join(csci, ["customer_sk", "item_sk"])
.agg(
store_only=ifelse(
ssci.customer_sk.notnull() & csci.customer_sk.isnull(), 1, 0
).sum(),
catalog_only=ifelse(
ssci.customer_sk.isnull() & csci.customer_sk.notnull(), 1, 0
).sum(),
store_and_catalog=ifelse(
ssci.customer_sk.notnull() & csci.customer_sk.notnull(), 1, 0
).sum(),
)
.limit(100)
)


@tpc_test("ds")
def test_98(store_sales, item, date_dim):
return (
Expand Down

0 comments on commit d7401e0

Please sign in to comment.