TPC-DS-OBT Q30
TPC-DS-OBT benchmark · all TPC-DS-OBT queries
Representative SQL
Rendered for DataFusion with default parameters.
WITH customer_total_return AS ( SELECT returning_customer_c_customer_sk AS ctr_customer_sk, returning_addr_ca_state AS ctr_state, SUM(return_amount) AS ctr_total_return FROM tpcds_sales_returns_obt WHERE channel = 'web' AND has_return = 'Y' AND return_date_d_year = 2002 AND NOT returning_addr_ca_address_sk IS NULL GROUP BY returning_customer_c_customer_sk, returning_addr_ca_state), cust AS ( SELECT DISTINCT returning_customer_c_customer_sk AS c_customer_sk, returning_customer_c_customer_id AS c_customer_id, returning_customer_c_salutation AS c_salutation, returning_customer_c_first_name AS c_first_name, returning_customer_c_last_name AS c_last_name, returning_customer_c_preferred_cust_flag AS c_preferred_cust_flag, returning_customer_c_birth_day AS c_birth_day, returning_customer_c_birth_month AS c_birth_month, returning_customer_c_birth_year AS c_birth_year, returning_customer_c_birth_country AS c_birth_country, returning_customer_c_login AS c_login, returning_customer_c_email_address AS c_email_address, returning_customer_c_last_review_date_sk AS c_last_review_date_sk, returning_cur_addr_ca_state AS cur_state FROM tpcds_sales_returns_obt WHERE channel = 'web' AND has_return = 'Y' AND NOT returning_customer_c_customer_sk IS NULL)SELECT c_customer_id, c_salutation, c_first_name, c_last_name, c_preferred_cust_flag, c_birth_day, c_birth_month, c_birth_year, c_birth_country, c_login, c_email_address, c_last_review_date_sk, ctr_total_returnFROM customer_total_return AS ctr1JOIN cust ON ctr1.ctr_customer_sk = cust.c_customer_skWHERE ctr1.ctr_total_return > ( SELECT AVG(ctr_total_return) * 1.2 FROM customer_total_return AS ctr2 WHERE ctr1.ctr_state = ctr2.ctr_state ) AND cust.cur_state = 'IL'ORDER BY c_customer_id, c_salutation, c_first_name, c_last_name, c_preferred_cust_flag, c_birth_day, c_birth_month, c_birth_year, c_birth_country, c_login, c_email_address, c_last_review_date_sk, ctr_total_returnLIMIT 100Representative 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 factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['30'])Source
Query text: benchbox/core/tpcds_obt/queries.py