add_partition_store_sales.sql 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. set hive.enforce.bucketing=true;
  2. set hive.exec.dynamic.partition.mode=nonstrict;
  3. set hive.exec.max.dynamic.partitions.pernode=1000000;
  4. set hive.exec.max.dynamic.partitions=1000000;
  5. set hive.exec.max.created.files=1000000;
  6. set hive.metstore.uris=;
  7. create database if not exists ${DB};
  8. use ${DB};
  9. drop table if exists store_sales_part;
  10. dfs -mv ${LOCATION} ${TMP_DIR}/part;
  11. create external table store_sales_part
  12. (
  13. ss_sold_time_sk int,
  14. ss_item_sk int,
  15. ss_customer_sk int,
  16. ss_cdemo_sk int,
  17. ss_hdemo_sk int,
  18. ss_addr_sk int,
  19. ss_store_sk int,
  20. ss_promo_sk int,
  21. ss_ticket_number int,
  22. ss_quantity int,
  23. ss_wholesale_cost float,
  24. ss_list_price float,
  25. ss_sales_price float,
  26. ss_ext_discount_amt float,
  27. ss_ext_sales_price float,
  28. ss_ext_wholesale_cost float,
  29. ss_ext_list_price float,
  30. ss_ext_tax float,
  31. ss_coupon_amt float,
  32. ss_net_paid float,
  33. ss_net_paid_inc_tax float,
  34. ss_net_profit float,
  35. ss_sold_date string
  36. )
  37. row format serde '${SERDE}'
  38. stored as ${FILE}
  39. location '${TMP_DIR}';
  40. insert into table store_sales partition(ss_sold_date)
  41. select * from store_sales_part;
  42. dfs -mv ${TMP_DIR}/part ${LOCATION};
  43. drop table store_sales_part;