Skip to content

TPC-DS-OBT Q46

TPC-DS-OBT benchmark · all TPC-DS-OBT queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
c_last_name,
c_first_name,
ca_city,
bought_city,
ss_ticket_number,
amt,
profit
FROM (
SELECT
sale_id AS ss_ticket_number,
bill_customer_c_customer_sk AS cust_sk,
bill_addr_ca_city AS bought_city,
bill_customer_c_last_name AS c_last_name,
bill_customer_c_first_name AS c_first_name,
bill_cur_addr_ca_city AS ca_city,
SUM(coupon_amt) AS amt,
SUM(net_profit) AS profit
FROM tpcds_sales_returns_obt
WHERE
channel = 'store'
AND NOT sold_date_d_date_sk IS NULL
AND NOT store_s_store_sk IS NULL
AND NOT bill_hdemo_hd_demo_sk IS NULL
AND NOT bill_addr_ca_address_sk IS NULL
AND (
bill_hdemo_hd_dep_count = 5 OR bill_hdemo_hd_vehicle_count = 3
)
AND sold_date_d_dow IN (6, 0)
AND sold_date_d_year IN (1999, 1999 + 1, 1999 + 2)
AND store_s_city IN ('Midway', 'Fairview', 'Fairview', 'Midway', 'Fairview')
GROUP BY
sale_id,
bill_customer_sk,
bill_addr_sk,
bill_addr_ca_city,
bill_customer_c_customer_sk,
bill_customer_c_last_name,
bill_customer_c_first_name,
bill_cur_addr_ca_city
) AS dn
WHERE
NOT cust_sk IS NULL AND ca_city <> bought_city
ORDER BY
c_last_name,
c_first_name,
ca_city,
bought_city,
ss_ticket_number
LIMIT 100

Representative DataFrame

No DataFrame implementation is registered for this query.

Get the exact query for your run

The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:

from benchbox import TPCDSOBT
bench = TPCDSOBT(scale_factor=1.0) # your scale factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['46'])

Source

Query text: benchbox/core/tpcds_obt/queries.py