Skip to content

Commit

Permalink
test: add test for query 93 (#9949)
Browse files Browse the repository at this point in the history
Co-authored-by: Phillip Cloud <[email protected]>
  • Loading branch information
jitingxu1 and cpcloud authored Aug 28, 2024
1 parent f00facb commit 834781d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions ibis/backends/tests/tpc/ds/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3656,6 +3656,40 @@ def test_96(store_sales, household_demographics, time_dim, store):
)


@tpc_test("ds", result_is_empty=True)
def test_93(store_sales, store_returns, reason):
t = (
store_sales.left_join(
store_returns,
[
("ss_item_sk", "sr_item_sk"),
("ss_ticket_number", "sr_ticket_number"),
],
)
.join(reason, [("sr_reason_sk", "r_reason_sk")])
.filter(_.r_reason_desc == "reason 28")
.select(
_.ss_item_sk,
_.ss_ticket_number,
_.ss_customer_sk,
act_sales=ifelse(
_.sr_return_quantity.notnull(),
(_.ss_quantity - _.sr_return_quantity) * _.ss_sales_price,
(_.ss_quantity * _.ss_sales_price),
),
)
)

return (
t.group_by(_.ss_customer_sk)
.agg(sumsales=_.act_sales.sum())
.order_by(
_.sumsales.asc(nulls_first=True), _.ss_customer_sk.asc(nulls_first=True)
)
.limit(100)
)


@tpc_test("ds")
def test_97(store_sales, date_dim, catalog_sales):
ssci = (
Expand Down

0 comments on commit 834781d

Please sign in to comment.