| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| drop dataverse tpcds if exists; |
| create dataverse tpcds; |
| |
| use tpcds; |
| |
| |
| |
| create type tpcds.customer_address_type as closed { |
| ca_address_sk : bigint, |
| ca_address_id : string, |
| ca_street_number : string?, |
| ca_street_name : string?, |
| ca_street_type : string?, |
| ca_suite_number : string?, |
| ca_city : string?, |
| ca_county : string?, |
| ca_state : string?, |
| ca_zip : string?, |
| ca_country : string?, |
| ca_gmt_offset : double?, |
| ca_location_type : string? |
| } |
| |
| create type tpcds.call_center_type as |
| closed { |
| cc_call_center_sk : bigint, |
| cc_call_center_id : string, |
| cc_rec_start_date : string?, |
| cc_rec_end_date : string?, |
| cc_closed_date_sk : bigint?, |
| cc_open_date_sk : bigint?, |
| cc_name : string?, |
| cc_class : string?, |
| cc_employees : bigint?, |
| cc_sq_ft : bigint?, |
| cc_hours : string?, |
| cc_manager : string?, |
| cc_mkt_id : bigint?, |
| cc_mkt_class : string?, |
| cc_mkt_desc : string?, |
| cc_market_manager : string?, |
| cc_division : bigint?, |
| cc_division_name : string?, |
| cc_company : bigint?, |
| cc_company_name : string?, |
| cc_street_number : bigint?, |
| cc_street_name : string?, |
| cc_street_type : string?, |
| cc_suite_number : string?, |
| cc_city : string?, |
| cc_county : string?, |
| cc_state : string?, |
| cc_zip : string?, |
| cc_country : string?, |
| cc_gmt_offset : double?, |
| cc_tax_percentage : double? |
| } |
| |
| create type tpcds.household_demographics_type as |
| closed { |
| hd_demo_sk : bigint, |
| hd_income_band_sk : bigint?, |
| hd_buy_potential : string?, |
| hd_dep_count : bigint?, |
| hd_vehicle_count : bigint? |
| } |
| create type tpcds.customer_demographics_type as |
| closed { |
| cd_demo_sk : bigint, |
| cd_gender : string?, |
| cd_marital_status : string?, |
| cd_education_status : string?, |
| cd_purchase_estimate : bigint?, |
| cd_credit_rating : string?, |
| cd_dep_count : bigint?, |
| cd_dep_employed_count : bigint?, |
| cd_dep_college_count : bigint? |
| } |
| create type tpcds.date_dim_type as |
| closed { |
| d_date_sk : bigint, |
| d_date_id : string, |
| d_date : string?, |
| d_month_seq : bigint?, |
| d_week_seq : bigint?, |
| d_quarter_seq : bigint?, |
| d_year : bigint? , |
| d_dow : bigint? , |
| d_moy : bigint?, |
| d_dom : bigint?, |
| d_qoy : bigint?, |
| d_fy_year : bigint?, |
| d_fy_quarter_seq : bigint?, |
| d_fy_week_seq : bigint?, |
| d_day_name : string?, |
| d_quarter_name : string?, |
| d_holiday : string?, |
| d_weekend : string?, |
| d_following_holiday : string?, |
| d_first_dom : bigint?, |
| d_last_dom : bigint?, |
| d_same_day_ly : bigint?, |
| d_same_day_lq : bigint?, |
| d_current_day : string?, |
| d_current_week : string?, |
| d_current_month : string?, |
| d_current_quarter : string?, |
| d_current_year : string? |
| } |
| |
| create type tpcds.catalog_returns_type as |
| closed { |
| 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 : bigint?, |
| cr_return_amount : double?, |
| cr_return_tax : double?, |
| cr_return_amt_inc_tax : double?, |
| cr_fee : double?, |
| cr_return_ship_cost : double?, |
| cr_refunded_cash : double?, |
| cr_reversed_charge : double?, |
| cr_store_credit : double?, |
| cr_net_loss : double? |
| } |
| |
| create type tpcds.customer_type as |
| closed { |
| c_customer_sk : bigint, |
| c_customer_id : string, |
| 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?, |
| c_first_name : string?, |
| c_last_name : string?, |
| c_preferred_cust_flag : string?, |
| c_birth_day : bigint?, |
| c_birth_month : bigint?, |
| c_birth_year : bigint?, |
| c_birth_country : string?, |
| c_login : string?, |
| c_email_address : string?, |
| c_last_review_date : string? |
| } |
| |
| create dataset customer_address(customer_address_type) primary key ca_address_sk; |
| |
| create dataset call_center (call_center_type) primary key cc_call_center_sk; |
| |
| create dataset household_demographics (household_demographics_type) primary key hd_demo_sk; |
| |
| create dataset customer_demographics(customer_demographics_type) primary key cd_demo_sk; |
| |
| create dataset date_dim(date_dim_type) primary key d_date_sk; |
| |
| create dataset catalog_returns (catalog_returns_type) primary key cr_item_sk, cr_order_number; |
| |
| create dataset customer (customer_type) primary key c_customer_sk; |