{"id":2797,"date":"2013-04-30T14:04:36","date_gmt":"2013-04-30T19:04:36","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=2797"},"modified":"2013-04-30T14:04:36","modified_gmt":"2013-04-30T19:04:36","slug":"apache-hive-inserts","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2013\/04\/30\/apache-hive-inserts\/","title":{"rendered":"Apache Hive inserts"},"content":{"rendered":"<p>This is a simple example for getting started with loading data into a hadoop environment front ended by hive.<\/p>\n<p>Notice how much longer simple operations take than they do in a RDBMS.  This is attributable to the fact hadoop has the initial setup of creating the job and task tracker.<\/p>\n<pre lang=\"text\">\r\n[root@expressdb1 hive-0.9.0-bin]# export HIVE_HOME=\/root\/hive-0.9.0-bin\r\n[root@expressdb1 hive-0.9.0-bin]# export HADOOP_HOME=\/root\/hadoop-0.23.7\r\n[root@expressdb1 hive-0.9.0-bin]# bin\/hive\r\nWARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.\r\nLogging initialized using configuration in jar:file:\/root\/hive-0.9.0-bin\/lib\/hive-common-0.9.0.jar!\/hive-log4j.properties\r\nHive history file=\/tmp\/root\/hive_job_log_root_201304301344_249377956.txt\r\nhive> CREATE TABLE x (a INT);\r\nOK\r\nTime taken: 14.982 seconds\r\nhive> select * from x;\r\nOK\r\nTime taken: 0.383 seconds\r\nhive> exit;\r\n[root@expressdb1 hive-0.9.0-bin]# for i in {1..100}; do\r\n> echo $i >> \/tmp\/l.txt\r\n> done\r\n[root@expressdb1 hive-0.9.0-bin]# bin\/hive\r\nWARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.\r\nLogging initialized using configuration in jar:file:\/root\/hive-0.9.0-bin\/lib\/hive-common-0.9.0.jar!\/hive-log4j.properties\r\nHive history file=\/tmp\/root\/hive_job_log_root_201304301351_1399235343.txt\r\nhive> LOAD DATA LOCAL INPATH '\/tmp\/l.txt' OVERWRITE INTO TABLE x;\r\nCopying data from file:\/tmp\/l.txt\r\nCopying file: file:\/tmp\/l.txt\r\nLoading data to table default.x\r\nrmr: DEPRECATED: Please use 'rm -r' instead.\r\nDeleted \/user\/hive\/warehouse\/x\r\nOK\r\nTime taken: 8.332 seconds\r\nhive> select * from x;\r\nOK\r\n1\r\n2\r\n3\r\n4\r\n5\r\n....\r\n98\r\n99\r\n100\r\nTime taken: 0.389 seconds\r\nhive> exit;\r\n[root@expressdb1 hive-0.9.0-bin]#\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a simple example for getting started with loading data into a hadoop environment front ended by hive. Notice how much longer simple operations take than they do in a RDBMS. This is attributable to the fact hadoop has&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2013\/04\/30\/apache-hive-inserts\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[43],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2797"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2797"}],"version-history":[{"count":4,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2797\/revisions"}],"predecessor-version":[{"id":2801,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2797\/revisions\/2801"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2797"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}