Run HIVE HQL script on Beeline with Parameter

Cheat Codebeeline -u ‘jdbc:hive2://zk0-mycluster.mydomainads.onmicrosoft.com:2181,zk2-mycluster.mydomainads.onmicrosoft.com:2181,zk3-mycluster.mydomainads.onmicrosoft.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2-hive2’ –hivevar filedate=’2019-04-10′ –hivevar dwhdatabase=’dw_reporting_global’ –hivevar stagingdatabase=’dw_reproting_local’ Reuse, reuse, reuse!I think this resonate very well with where we are today. Developer love to develop, but if you keep redeveloping e.g. rewriting same script again and again just for the sake of “clocking # of lines” then it’s a foolish!In programming world weContinue reading “Run HIVE HQL script on Beeline with Parameter”

List all partitions from Hive Table

Cheat Code> show partitions database_name.table_name I was asked to list all partitions for the transaction hive table because somehow the number are not complete, so I ran the above cheat code to check all date partitions on my transaction tables.Simple right!? Once we found the missing partitions, we can just simple reload it from ourContinue reading “List all partitions from Hive Table”

Insert Overwrite Hive Partitioned Table

Cheat Code INSERT OVERWRITE TABLE apac.amazing_report partition (yyyymm=’2019-12-01′) SELECT year, month, partnerid, cost, revenue FROM apac.amazing_csvWHERE yyyymm=’2019-12-01′ I have hive partitioned table and I need to load/reload this partition from raw source which is CSV in my case. Just run the cheat code above (don’t forget to adjust the table, partition, and source to yourContinue reading “Insert Overwrite Hive Partitioned Table”

Refresh Hive Partition

Cheat CodeMSCK REPAIR TABLE mydatabase.table_name We added partitions to our external table to manage our data easily. Multiple folders are set on our data lake.How can we refresh the hive to know new partitions are added? Quite Simple! run the cheat code above and voila the hive partition is updated!don’t worry it wont messed upContinue reading “Refresh Hive Partition”

Design a site like this with WordPress.com
Get started