set odps.sql.session.resources=dsdgen,dsdgen_return,tpcds.idx;
set odps.sql.hive.compatible=true;
set odps.sql.decimal.odps2=true;

insert overwrite table call_center select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27,col28,col29,col30,col31) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE call_center -TERMINATE N' as script
) t;


insert overwrite table catalog_page select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE catalog_page -TERMINATE N' as script
) t;



insert overwrite table catalog_returns select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen_return -sc 1 -TABLE catalog_sales -TERMINATE N' as script
) t;

insert overwrite table catalog_sales select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27,col28,col29,col30,col31,col32,col33,col34) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE catalog_sales -TERMINATE N' as script
) t;


insert overwrite table customer select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE customer -TERMINATE N' as script
) t;

insert overwrite table customer_address select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE customer_address -TERMINATE N' as script
) t;

insert overwrite table customer_demographics select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE customer_demographics -TERMINATE N' as script
) t;

insert overwrite table date_dim select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27,col28) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE date_dim -TERMINATE N' as script
) t;


insert overwrite table household_demographics select transform(script) using 'sh' as (col1,col2,col3,col4,col5) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE household_demographics -TERMINATE N' as script
) t;

insert overwrite table income_band select transform(script) using 'sh' as (col1,col2,col3) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE income_band -TERMINATE N' as script
) t;

insert overwrite table inventory select transform(script) using 'sh' as (col1,col2,col3,col4) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE inventory -TERMINATE N' as script
) t;




insert overwrite table item select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE item -TERMINATE N' as script
) t;

insert overwrite table promotion select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE promotion -TERMINATE N' as script
) t;

insert overwrite table reason select transform(script) using 'sh' as (col1,col2,col3) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE reason -TERMINATE N' as script
) t;

insert overwrite table ship_mode select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE ship_mode -TERMINATE N' as script
) t;

insert overwrite table store select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27,col28,col29) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE store -TERMINATE N' as script
) t;

insert overwrite table store_sales select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE store_sales -TERMINATE N' as script
) t;


insert overwrite table store_returns select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen_return -sc 1 -TABLE store_sales -TERMINATE N' as script
) t;

insert overwrite table time_dim select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE time_dim -TERMINATE N' as script
) t;


insert overwrite table warehouse select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE warehouse -TERMINATE N' as script
) t;

insert overwrite table web_page select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE web_page -TERMINATE N' as script
) t;

insert overwrite table web_returns select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen_return -sc 1 -TABLE web_sales -TERMINATE N' as script
) t;

insert overwrite table web_sales select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27,col28,col29,col30,col31,col32,col33,col34) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE web_sales -TERMINATE N' as script
) t;

insert overwrite table web_site select transform(script) using 'sh' as (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' from
(
        select './dsdgen -sc 1 -TABLE web_site -TERMINATE N' as script
) t;
