Skip to content

Commit 6b0d16b

Browse files
tsafinclaude
andcommitted
Add TPC-DS Phase 3: 8 more tables (catalog_sales, web_sales, and 6 others)
Implements the following tables in tpcds_benchmark: catalog_sales — master-detail (callback-based, 4-14 line items/ticket) web_sales — master-detail (callback-based, 8-16 line items/ticket) customer — dimension table (simple, 100K rows at SF=1) item — dimension table (simple, ~18K rows at SF=1) date_dim — dimension table (simple, 73,049 fixed rows) store_returns — driven through store_sales ticket loop catalog_returns — driven through catalog_sales ticket loop web_returns — driven through web_sales ticket loop Changes: - tpcds_dsdgen.h: added struct definitions for all 8 new table row types, table ID constants, mk_w_* function declarations, and EMBEDDED_DSDGEN extern callback declarations for catalog_sales and web_sales - dsdgen_wrapper.hpp: added generate_* method declarations for 8 tables - dsdgen_wrapper.cpp: Arrow schemas, trampolines (catalog/web sales), generate_* implementations; returns tables are driven through their parent sales loop using a no-op callback to suppress file output while populating the global sales struct for valid return references - dsdgen_converter.hpp/.cpp: Arrow builder converters for all 8 tables; updated append_dsdgen_row_to_builders() dispatcher - tpcds_main.cpp: updated parse_table(), generation dispatch, and usage text to reflect Phase 3 completion - third_party/tpcds submodule: updated to include w_catalog_sales.c and w_web_sales.c EMBEDDED_DSDGEN callback patches All 10 implemented tables verified: correct row counts, sane values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bf57b3c commit 6b0d16b

7 files changed

Lines changed: 1496 additions & 27 deletions

File tree

include/tpch/dsdgen_converter.hpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,62 @@ void append_inventory_to_builders(
3030
const void* row,
3131
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
3232

33+
/**
34+
* Append a catalog_sales row (W_CATALOG_SALES_TBL*) to Arrow builders.
35+
*/
36+
void append_catalog_sales_to_builders(
37+
const void* row,
38+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
39+
40+
/**
41+
* Append a web_sales row (W_WEB_SALES_TBL*) to Arrow builders.
42+
*/
43+
void append_web_sales_to_builders(
44+
const void* row,
45+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
46+
47+
/**
48+
* Append a customer row (W_CUSTOMER_TBL*) to Arrow builders.
49+
*/
50+
void append_customer_to_builders(
51+
const void* row,
52+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
53+
54+
/**
55+
* Append an item row (W_ITEM_TBL*) to Arrow builders.
56+
*/
57+
void append_item_to_builders(
58+
const void* row,
59+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
60+
61+
/**
62+
* Append a date_dim row (W_DATE_TBL*) to Arrow builders.
63+
*/
64+
void append_date_dim_to_builders(
65+
const void* row,
66+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
67+
68+
/**
69+
* Append a store_returns row (W_STORE_RETURNS_TBL*) to Arrow builders.
70+
*/
71+
void append_store_returns_to_builders(
72+
const void* row,
73+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
74+
75+
/**
76+
* Append a catalog_returns row (W_CATALOG_RETURNS_TBL*) to Arrow builders.
77+
*/
78+
void append_catalog_returns_to_builders(
79+
const void* row,
80+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
81+
82+
/**
83+
* Append a web_returns row (W_WEB_RETURNS_TBL*) to Arrow builders.
84+
*/
85+
void append_web_returns_to_builders(
86+
const void* row,
87+
std::map<std::string, std::shared_ptr<arrow::ArrayBuilder>>& builders);
88+
3389
/**
3490
* Generic dispatcher by table name.
3591
*/

include/tpch/dsdgen_wrapper.hpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,70 @@ class DSDGenWrapper {
8181
std::function<void(const void* row)> callback,
8282
long max_rows = -1);
8383

84+
/**
85+
* Generate catalog_sales rows (master-detail via callback).
86+
* Calls callback once per line item with a const W_CATALOG_SALES_TBL*.
87+
*/
88+
void generate_catalog_sales(
89+
std::function<void(const void* row)> callback,
90+
long max_rows = -1);
91+
92+
/**
93+
* Generate web_sales rows (master-detail via callback).
94+
* Calls callback once per line item with a const W_WEB_SALES_TBL*.
95+
*/
96+
void generate_web_sales(
97+
std::function<void(const void* row)> callback,
98+
long max_rows = -1);
99+
100+
/**
101+
* Generate customer rows.
102+
* Calls callback once per row with a const W_CUSTOMER_TBL*.
103+
*/
104+
void generate_customer(
105+
std::function<void(const void* row)> callback,
106+
long max_rows = -1);
107+
108+
/**
109+
* Generate item rows.
110+
* Calls callback once per row with a const W_ITEM_TBL*.
111+
*/
112+
void generate_item(
113+
std::function<void(const void* row)> callback,
114+
long max_rows = -1);
115+
116+
/**
117+
* Generate date_dim rows.
118+
* Calls callback once per row with a const W_DATE_TBL*.
119+
*/
120+
void generate_date_dim(
121+
std::function<void(const void* row)> callback,
122+
long max_rows = -1);
123+
124+
/**
125+
* Generate store_returns rows.
126+
* Calls callback once per row with a const W_STORE_RETURNS_TBL*.
127+
*/
128+
void generate_store_returns(
129+
std::function<void(const void* row)> callback,
130+
long max_rows = -1);
131+
132+
/**
133+
* Generate catalog_returns rows.
134+
* Calls callback once per row with a const W_CATALOG_RETURNS_TBL*.
135+
*/
136+
void generate_catalog_returns(
137+
std::function<void(const void* row)> callback,
138+
long max_rows = -1);
139+
140+
/**
141+
* Generate web_returns rows.
142+
* Calls callback once per row with a const W_WEB_RETURNS_TBL*.
143+
*/
144+
void generate_web_returns(
145+
std::function<void(const void* row)> callback,
146+
long max_rows = -1);
147+
84148
long scale_factor() const { return scale_factor_; }
85149

86150
/**

0 commit comments

Comments
 (0)