|
| 1 | +create database if not exists rubix_stress; |
| 2 | +use rubix_stress; |
| 3 | + |
| 4 | +-- Replace dimension tables DDLs |
| 5 | + |
| 6 | +CREATE EXTERNAL TABLE IF NOT EXISTS customer (c_customer_sk bigint , c_customer_id string , |
| 7 | +c_current_cdemo_sk bigint , c_current_hdemo_sk bigint , c_current_addr_sk bigint , c_first_shipto_date_sk bigint , c_first_sales_date_sk bigint , c_salutation string , |
| 8 | +c_first_name string , |
| 9 | +c_last_name string , |
| 10 | +c_preferred_cust_flag string , |
| 11 | +c_birth_day int , c_birth_month int , c_birth_year int , c_birth_country string , |
| 12 | +c_login string , |
| 13 | +c_email_address string , |
| 14 | +c_last_review_date string) |
| 15 | +STORED AS orc LOCATION '<LOCATION>'; |
| 16 | + |
| 17 | + |
| 18 | +CREATE EXTERNAL TABLE IF NOT EXISTS customer_address ( ca_address_sk bigint , ca_address_id string , |
| 19 | +ca_street_number string , |
| 20 | +ca_street_name string , |
| 21 | +ca_street_type string , |
| 22 | +ca_suite_number string , |
| 23 | +ca_city string , |
| 24 | +ca_county string , |
| 25 | +ca_state string , |
| 26 | +ca_zip string , |
| 27 | +ca_country string , |
| 28 | +ca_gmt_offset decimal(5,2) , |
| 29 | +ca_location_type string) |
| 30 | +STORED AS orc LOCATION '<LOCATION>'; |
| 31 | + |
| 32 | +CREATE EXTERNAL TABLE IF NOT EXISTS customer_demographics ( cd_demo_sk bigint, cd_gender string , |
| 33 | +cd_marital_status string , |
| 34 | +cd_education_status string , |
| 35 | +cd_purchase_estimate int , cd_credit_rating string , |
| 36 | +cd_dep_count int , cd_dep_employed_count int , cd_dep_college_count int) |
| 37 | +STORED AS orc LOCATION '<LOCATION>'; |
| 38 | + |
| 39 | +CREATE EXTERNAL TABLE IF NOT EXISTS date_dim ( d_date_sk bigint , d_date_id string , |
| 40 | +d_date string , |
| 41 | +d_month_seq int , d_week_seq int , d_quarter_seq int , d_year int , d_dow int , d_moy int , d_dom int , d_qoy int , d_fy_year int , d_fy_quarter_seq int , d_fy_week_seq int , d_day_name string , |
| 42 | +d_quarter_name string , |
| 43 | +d_holiday string , |
| 44 | +d_weekend string , |
| 45 | +d_following_holiday string , |
| 46 | +d_first_dom int , d_last_dom int , d_same_day_ly int , d_same_day_lq int , d_current_day string , |
| 47 | +d_current_week string , |
| 48 | +d_current_month string , |
| 49 | +d_current_quarter string , |
| 50 | +d_current_year string) |
| 51 | +STORED AS orc LOCATION '<LOCATION>'; |
| 52 | + |
| 53 | + |
| 54 | +CREATE EXTERNAL TABLE IF NOT EXISTS household_demographics ( hd_demo_sk bigint , hd_income_band_sk bigint , hd_buy_potential string , |
| 55 | +hd_dep_count int , hd_vehicle_count int) |
| 56 | +STORED AS orc LOCATION '<LOCATION>'; |
| 57 | + |
| 58 | +CREATE EXTERNAL TABLE IF NOT EXISTS income_band ( ib_income_band_sk bigint , ib_lower_bound int , ib_upper_bound int) |
| 59 | +STORED AS orc LOCATION '<LOCATION>'; |
| 60 | + |
| 61 | +CREATE EXTERNAL TABLE IF NOT EXISTS item ( i_item_sk bigint , i_item_id string , |
| 62 | +i_rec_start_date string , |
| 63 | +i_rec_end_date string , |
| 64 | +i_item_desc string , |
| 65 | +i_current_price decimal(7,2) , |
| 66 | +i_wholesale_cost decimal(7,2) , |
| 67 | +i_brand_id int , i_brand string , |
| 68 | +i_class_id int , i_class string , |
| 69 | +i_category_id int , i_category string , |
| 70 | +i_manufact_id int , i_manufact string , |
| 71 | +i_size string , |
| 72 | +i_formulation string , |
| 73 | +i_color string , |
| 74 | +i_units string , |
| 75 | +i_container string , |
| 76 | +i_manager_id int , i_product_name string) |
| 77 | +STORED AS orc LOCATION '<LOCATION>'; |
| 78 | + |
| 79 | +CREATE EXTERNAL TABLE IF NOT EXISTS promotion ( p_promo_sk bigint , p_promo_id string , |
| 80 | +p_start_date_sk bigint , p_end_date_sk bigint , p_item_sk bigint , p_cost decimal(15,2) , |
| 81 | +p_response_target int , p_promo_name string , |
| 82 | +p_channel_dmail string , |
| 83 | +p_channel_email string , |
| 84 | +p_channel_catalog string , |
| 85 | +p_channel_tv string , |
| 86 | +p_channel_radio string , |
| 87 | +p_channel_press string , |
| 88 | +p_channel_event string , |
| 89 | +p_channel_demo string , |
| 90 | +p_channel_details string , |
| 91 | +p_purpose string , |
| 92 | +p_discount_active string) |
| 93 | +STORED AS orc LOCATION '<LOCATION>'; |
| 94 | + |
| 95 | +CREATE EXTERNAL TABLE IF NOT EXISTS reason ( r_reason_sk bigint , r_reason_id string , |
| 96 | +r_reason_desc string) |
| 97 | +STORED AS orc LOCATION '<LOCATION>'; |
| 98 | + |
| 99 | +CREATE EXTERNAL TABLE IF NOT EXISTS ship_mode ( sm_ship_mode_sk bigint , sm_ship_mode_id string , |
| 100 | +sm_type string , |
| 101 | +sm_code string , |
| 102 | +sm_carrier string , |
| 103 | +sm_contract string) |
| 104 | +STORED AS orc LOCATION '<LOCATION>'; |
| 105 | + |
| 106 | +CREATE EXTERNAL TABLE IF NOT EXISTS store ( s_store_sk bigint , s_store_id string , |
| 107 | +s_rec_start_date string , |
| 108 | +s_rec_end_date string , |
| 109 | +s_closed_date_sk bigint , s_store_name string , |
| 110 | +s_number_employees int , s_floor_space int , s_hours string , |
| 111 | +s_manager string , |
| 112 | +s_market_id int , s_geography_class string , |
| 113 | +s_market_desc string , |
| 114 | +s_market_manager string , |
| 115 | +s_division_id int , s_division_name string , |
| 116 | +s_company_id int , s_company_name string , |
| 117 | +s_street_number string , |
| 118 | +s_street_name string , |
| 119 | +s_street_type string , |
| 120 | +s_suite_number string , |
| 121 | +s_city string , |
| 122 | +s_county string , |
| 123 | +s_state string , |
| 124 | +s_zip string , |
| 125 | +s_country string , |
| 126 | +s_gmt_offset decimal(5,2) , |
| 127 | +s_tax_precentage decimal(5,2)) |
| 128 | +STORED AS orc LOCATION '<LOCATION>'; |
| 129 | + |
| 130 | +CREATE EXTERNAL TABLE IF NOT EXISTS time_dim ( t_time_sk bigint , t_time_id string , |
| 131 | +t_time int , t_hour int , t_minute int , t_second int , t_am_pm string , |
| 132 | +t_shift string , |
| 133 | +t_sub_shift string , |
| 134 | +t_meal_time string) |
| 135 | +STORED AS orc LOCATION '<LOCATION>'; |
| 136 | + |
| 137 | +CREATE EXTERNAL TABLE IF NOT EXISTS warehouse ( w_warehouse_sk bigint , w_warehouse_id string , |
| 138 | +w_warehouse_name string , |
| 139 | +w_warehouse_sq_ft int , w_street_number string , |
| 140 | +w_street_name string , |
| 141 | +w_street_type string , |
| 142 | +w_suite_number string , |
| 143 | +w_city string , |
| 144 | +w_county string , |
| 145 | +w_state string , |
| 146 | +w_zip string , |
| 147 | +w_country string , |
| 148 | +w_gmt_offset decimal(5,2)) |
| 149 | +STORED AS orc LOCATION '<LOCATION>'; |
| 150 | + |
| 151 | +CREATE EXTERNAL TABLE IF NOT EXISTS web_site ( web_site_sk bigint , web_site_id string , |
| 152 | +web_rec_start_date string , |
| 153 | +web_rec_end_date string , |
| 154 | +web_name string , |
| 155 | +web_open_date_sk bigint , web_close_date_sk bigint , web_class string , |
| 156 | +web_manager string , |
| 157 | +web_mkt_id int , web_mkt_class string , |
| 158 | +web_mkt_desc string , |
| 159 | +web_market_manager string , |
| 160 | +web_company_id int , web_company_name string , |
| 161 | +web_street_number string , |
| 162 | +web_street_name string , |
| 163 | +web_street_type string , |
| 164 | +web_suite_number string , |
| 165 | +web_city string , |
| 166 | +web_county string , |
| 167 | +web_state string , |
| 168 | +web_zip string , |
| 169 | +web_country string , |
| 170 | +web_gmt_offset decimal(5,2) , |
| 171 | +web_tax_percentage decimal(5,2)) |
| 172 | +STORED AS orc LOCATION '<LOCATION>'; |
| 173 | + |
| 174 | + |
| 175 | +CREATE EXTERNAL TABLE IF NOT EXISTS web_page ( wp_web_page_sk bigint , wp_web_page_id string , |
| 176 | +wp_rec_start_date string , |
| 177 | +wp_rec_end_date string , |
| 178 | +wp_creation_date_sk bigint , wp_access_date_sk bigint , wp_autogen_flag string , |
| 179 | +wp_customer_sk bigint , wp_url string , |
| 180 | +wp_type string , |
| 181 | +wp_char_count int , wp_link_count int , wp_image_count int , wp_max_ad_count int) |
| 182 | +STORED AS orc LOCATION '<LOCATION>'; |
| 183 | + |
| 184 | +CREATE EXTERNAL TABLE IF NOT EXISTS inventory ( inv_date_sk bigint , inv_item_sk bigint , inv_warehouse_sk bigint , inv_quantity_on_hand int) |
| 185 | +STORED AS orc LOCATION '<LOCATION>'; |
| 186 | + |
| 187 | +CREATE EXTERNAL TABLE IF NOT EXISTS store_returns ( sr_returned_date_sk bigint , sr_return_time_sk bigint , sr_item_sk bigint , sr_customer_sk bigint , sr_cdemo_sk bigint , sr_hdemo_sk bigint , sr_addr_sk bigint , sr_store_sk bigint , sr_reason_sk bigint , sr_ticket_number bigint , sr_return_quantity int , sr_return_amt decimal(7,2) , |
| 188 | +sr_return_tax decimal(7,2) , |
| 189 | +sr_return_amt_inc_tax decimal(7,2) , |
| 190 | +sr_fee decimal(7,2) , |
| 191 | +sr_return_ship_cost decimal(7,2) , |
| 192 | +sr_refunded_cash decimal(7,2) , |
| 193 | +sr_reversed_charge decimal(7,2) , |
| 194 | +sr_store_credit decimal(7,2) , |
| 195 | +sr_net_loss decimal(7,2)) |
| 196 | +STORED AS orc LOCATION '<LOCATION>'; |
| 197 | + |
| 198 | +CREATE EXTERNAL TABLE IF NOT EXISTS web_sales ( ws_sold_date_sk bigint , ws_sold_time_sk bigint , ws_ship_date_sk bigint , ws_item_sk bigint , ws_bill_customer_sk bigint , ws_bill_cdemo_sk bigint , ws_bill_hdemo_sk bigint , ws_bill_addr_sk bigint , ws_ship_customer_sk bigint , ws_ship_cdemo_sk bigint , ws_ship_hdemo_sk bigint , ws_ship_addr_sk bigint , ws_web_page_sk bigint , ws_web_site_sk bigint , ws_ship_mode_sk bigint , ws_warehouse_sk bigint , ws_promo_sk bigint , ws_order_number bigint , ws_quantity int , ws_wholesale_cost decimal(7,2) , |
| 199 | +ws_list_price decimal(7,2) , |
| 200 | +ws_sales_price decimal(7,2) , |
| 201 | +ws_ext_discount_amt decimal(7,2) , |
| 202 | +ws_ext_sales_price decimal(7,2) , |
| 203 | +ws_ext_wholesale_cost decimal(7,2) , |
| 204 | +ws_ext_list_price decimal(7,2) , |
| 205 | +ws_ext_tax decimal(7,2) , |
| 206 | +ws_coupon_amt decimal(7,2) , |
| 207 | +ws_ext_ship_cost decimal(7,2) , |
| 208 | +ws_net_paid decimal(7,2) , |
| 209 | +ws_net_paid_inc_tax decimal(7,2) , |
| 210 | +ws_net_paid_inc_ship decimal(7,2) , |
| 211 | +ws_net_paid_inc_ship_tax decimal(7,2) , |
| 212 | +ws_net_profit decimal(7,2)) |
| 213 | +STORED AS orc LOCATION '<LOCATION>'; |
| 214 | + |
| 215 | +CREATE EXTERNAL TABLE IF NOT EXISTS web_returns ( wr_returned_date_sk bigint , wr_returned_time_sk bigint , wr_item_sk bigint , wr_refunded_customer_sk bigint , wr_refunded_cdemo_sk bigint , wr_refunded_hdemo_sk bigint , wr_refunded_addr_sk bigint , wr_returning_customer_sk bigint , wr_returning_cdemo_sk bigint , wr_returning_hdemo_sk bigint , wr_returning_addr_sk bigint , wr_web_page_sk bigint , wr_reason_sk bigint , wr_order_number bigint , wr_return_quantity int , wr_return_amt decimal(7,2) , |
| 216 | +wr_return_tax decimal(7,2) , |
| 217 | +wr_return_amt_inc_tax decimal(7,2) , |
| 218 | +wr_fee decimal(7,2) , |
| 219 | +wr_return_ship_cost decimal(7,2) , |
| 220 | +wr_refunded_cash decimal(7,2) , |
| 221 | +wr_reversed_charge decimal(7,2) , |
| 222 | +wr_account_credit decimal(7,2) , |
| 223 | +wr_net_loss decimal(7,2)) |
| 224 | +STORED AS orc LOCATION '<LOCATION>'; |
| 225 | + |
| 226 | +CREATE EXTERNAL TABLE IF NOT EXISTS call_center ( cc_call_center_sk bigint , cc_call_center_id string, |
| 227 | +cc_rec_start_date string, |
| 228 | +cc_rec_end_date string, |
| 229 | +cc_closed_date_sk int , cc_open_date_sk int , cc_name string, |
| 230 | +cc_class string, |
| 231 | +cc_employees int , cc_sq_ft int , cc_hours string, |
| 232 | +cc_manager string, |
| 233 | +cc_mkt_id int , cc_mkt_class string, |
| 234 | +cc_mkt_desc string, |
| 235 | +cc_market_manager string, |
| 236 | +cc_division int , cc_division_name string, |
| 237 | +cc_company int , cc_company_name string, |
| 238 | +cc_street_number string, |
| 239 | +cc_street_name string, |
| 240 | +cc_street_type string, |
| 241 | +cc_suite_number string, |
| 242 | +cc_city string, |
| 243 | +cc_county string, |
| 244 | +cc_state string, |
| 245 | +cc_zip string, |
| 246 | +cc_country string, |
| 247 | +cc_gmt_offset decimal(5,2), |
| 248 | +cc_tax_percentage decimal(5,2)) |
| 249 | +STORED AS orc LOCATION '<LOCATION>'; |
| 250 | + |
| 251 | +CREATE EXTERNAL TABLE IF NOT EXISTS catalog_page ( cp_catalog_page_sk bigint , cp_catalog_page_id string, |
| 252 | +cp_start_date_sk int , cp_end_date_sk int , cp_department string, |
| 253 | +cp_catalog_number int , cp_catalog_page_number int , cp_description string, |
| 254 | +cp_type string) |
| 255 | +STORED AS orc LOCATION '<LOCATION>'; |
| 256 | + |
| 257 | +CREATE EXTERNAL TABLE IF NOT EXISTS catalog_returns ( cr_returned_date_sk bigint , cr_returned_time_sk bigint , cr_item_sk bigint , cr_refunded_customer_sk bigint , cr_refunded_cdemo_sk bigint , cr_refunded_hdemo_sk bigint , cr_refunded_addr_sk bigint , cr_returning_customer_sk bigint , cr_returning_cdemo_sk bigint , cr_returning_hdemo_sk bigint , cr_returning_addr_sk bigint , cr_call_center_sk bigint , cr_catalog_page_sk bigint , cr_ship_mode_sk bigint , cr_warehouse_sk bigint , cr_reason_sk bigint , cr_order_number bigint , cr_return_quantity int , cr_return_amount decimal(7,2), |
| 258 | +cr_return_tax decimal(7,2), |
| 259 | +cr_return_amt_inc_tax decimal(7,2), |
| 260 | +cr_fee decimal(7,2), |
| 261 | +cr_return_ship_cost decimal(7,2), |
| 262 | +cr_refunded_cash decimal(7,2), |
| 263 | +cr_reversed_charge decimal(7,2), |
| 264 | +cr_store_credit decimal(7,2), |
| 265 | +cr_net_loss decimal(7,2)) |
| 266 | +STORED AS orc LOCATION '<LOCATION>'; |
| 267 | + |
| 268 | +CREATE EXTERNAL TABLE IF NOT EXISTS catalog_sales ( cs_sold_date_sk bigint , cs_sold_time_sk bigint , cs_ship_date_sk bigint , cs_bill_customer_sk bigint , cs_bill_cdemo_sk bigint , cs_bill_hdemo_sk bigint , cs_bill_addr_sk bigint , cs_ship_customer_sk bigint , cs_ship_cdemo_sk bigint , cs_ship_hdemo_sk bigint , cs_ship_addr_sk bigint , cs_call_center_sk bigint , cs_catalog_page_sk bigint , cs_ship_mode_sk bigint , cs_warehouse_sk bigint , cs_item_sk bigint , cs_promo_sk bigint , cs_order_number bigint , cs_quantity int , cs_wholesale_cost decimal(7,2), |
| 269 | +cs_list_price decimal(7,2), |
| 270 | +cs_sales_price decimal(7,2), |
| 271 | +cs_ext_discount_amt decimal(7,2), |
| 272 | +cs_ext_sales_price decimal(7,2), |
| 273 | +cs_ext_wholesale_cost decimal(7,2), |
| 274 | +cs_ext_list_price decimal(7,2), |
| 275 | +cs_ext_tax decimal(7,2), |
| 276 | +cs_coupon_amt decimal(7,2), |
| 277 | +cs_ext_ship_cost decimal(7,2), |
| 278 | +cs_net_paid decimal(7,2), |
| 279 | +cs_net_paid_inc_tax decimal(7,2), |
| 280 | +cs_net_paid_inc_ship decimal(7,2), |
| 281 | +cs_net_paid_inc_ship_tax decimal(7,2), |
| 282 | +cs_net_profit decimal(7,2)) |
| 283 | +STORED AS orc LOCATION '<LOCATION>'; |
| 284 | + |
| 285 | + |
| 286 | + |
0 commit comments