{"id":2619,"date":"2020-07-31T13:59:04","date_gmt":"2020-07-31T05:59:04","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=2619"},"modified":"2021-09-23T15:55:43","modified_gmt":"2021-09-23T07:55:43","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8brange%e5%88%86%e5%8c%ba%e6%98%af%e5%90%a6%e6%88%90%e5%8a%9f%e7%94%9f%e6%95%88","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=2619","title":{"rendered":"\u5982\u4f55\u901a\u8fc7\u5f00\u542finceptor server\u7684DEBUG\u65e5\u5fd7\u67e5\u770brange\u5206\u533a\u662f\u5426\u6210\u529f\u751f\u6548"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<hr \/>\n<p>\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\uff0c\u5982\u4f55\u901a\u8fc7\u5f00\u542finceptor server\u7684DEBUG\u65e5\u5fd7\u67e5\u770brange\u5206\u533a\u662f\u5426\u6210\u529f\u751f\u6548\u3002<font color=red>\u4e00\u822c\u6765\u8bf4\u96c6\u7fa4\u4e0d\u5efa\u8bae\u5f00\u542fDEBUG\u65e5\u5fd7\u7ea7\u522b\uff0c\u4f1a\u9020\u6210hive-server2.log\u65e5\u5fd7\u8fc7\u5927\uff0c\u4ec5\u4f9b\u5b66\u4e60\u53c2\u8003\u3002<\/font><\/p>\n<p>\u4f17\u6240\u5468\u77e5\uff0c\u5206\u533a\u8868\u8bbe\u8ba1 Hive \u5206\u533a\u662f\u63d0\u9ad8\u8f83\u5927\u8868\u7684\u67e5\u8be2\u6027\u80fd\u7684\u6700\u6709\u6548\u65b9\u6cd5\u4e4b\u4e00\u3002\u5177\u6709\u5206\u533a\u8fc7\u6ee4\u7684\u67e5\u8be2\u5c06\u4ec5\u52a0\u8f7d\u6765\u81ea\u6307\u5b9a\u5206\u533a\uff08\u5b50\u76ee\u5f55\uff09\u7684\u6570\u636e\uff0c\u56e0\u6b64\u5b83\u7684\u6267\u884c\u901f\u5ea6\u6bd4\u901a\u8fc7\u975e\u5206\u533a\u5b57\u6bb5\u8fc7\u6ee4\u7684\u666e\u901a\u67e5\u8be2\u5feb\u5f97\u591a\u3002<br \/>\n\u53e6\u5916\uff0c\u5206\u533a\u5e94\u8be5\u662f\u4e00\u4e2a\u4f4e\u57fa\u6570\u5c5e\u6027\uff0c\u4ee5\u907f\u514d\u975e\u5e38\u591a\u7684\u5206\u533a\u5b50\u76ee\u5f55\u7684\u5f00\u9500\u3002<\/p>\n<p><strong>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u4f5c\u5206\u533a\u952e\u7684\u5c5e\u6027\uff1a<\/strong><\/p>\n<ul>\n<li>\u6309\u65e5\u671f\u548c\u65f6\u95f4\u5206\u533a\uff1a\u4f7f\u7528\u65e5\u671f\u548c\u65f6\u95f4\uff08\u5982\u5e74\uff0c\u6708\u548c\u65e5\uff08\u751a\u81f3\u5c0f\u65f6\uff09\uff09\u4f5c\u4e3a\u6570\u636e\u4e0e\u65e5\u671f\/\u65f6\u95f4\u5217\u5173\u8054\u65f6\u7684\u5206\u533a\u952e\uff0c\u4f8b\u5982as load_date\uff0cbusiness_date\uff0crun_date\u7b49<\/li>\n<li>\u6309\u4f4d\u7f6e\u5206\u533a\uff1a\u5f53\u6570\u636e\u4e0e\u4f4d\u7f6e\u76f8\u5173\u65f6\uff0c\u4f7f\u7528\u56fd\u5bb6\uff0c\u5730\u533a\uff0c\u5dde\u548c\u57ce\u5e02\u4f5c\u4e3a\u5206\u533a\u952e<\/li>\n<li>\u6309\u4e1a\u52a1\u903b\u8f91\u5212\u5206\u5206\u533a\uff1a\u4f7f\u7528\u90e8\u95e8\uff0c\u9500\u552e\u533a\u57df\uff0c\u5e94\u7528\u7a0b\u5e8f\uff0c\u5ba2\u6237\u7b49\u4f5c\u4e3a\u5206\u533a\u952e<\/li>\n<\/ul>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<hr \/>\n<ul>\n<li>\u73af\u5883\u51c6\u5907\uff1aTDH6.0.2<\/li>\n<\/ul>\n<h4>1. \u521b\u5efa\u8303\u56f4\u5206\u533a\u8868<\/h4>\n<pre><code class=\"language-sql\">>DROP TABLE IF EXISTS people_torc_partition_5_buckets;\n--\u6307\u5b9aborndate\u4e3a\u5206\u533a\u952e\uff0cid\u4e3a\u5206\u6876\u952e\uff0c6\u4e2a\u5206\u533a\uff0c\u6bcf\u4e2a\u5206\u533a3\u4e2a\u5206\u6876\n>CREATE  TABLE people_torc_partition_5_buckets(\n  name string DEFAULT NULL, \n  sex string DEFAULT NULL, \n  nation string DEFAULT NULL, \n  id string DEFAULT NULL, \n  --borndate string DEFAULT NULL, \n  phonenumber string DEFAULT NULL, \n  email string DEFAULT NULL, \n  homeaddress string DEFAULT NULL\n)\nPARTITIONED BY RANGE (borndate DATE) (\nPARTITION before1990 VALUES LESS THAN ('1990-12-31'),\nPARTITION before1995 VALUES LESS THAN ('1995-12-31'),\nPARTITION before2000 VALUES LESS THAN ('2000-12-31'),\nPARTITION before2005 VALUES LESS THAN ('2005-12-31'),\nPARTITION before2010 VALUES LESS THAN ('2010-12-31'),\nPARTITION beforemax VALUES LESS THAN (MAXVALUE)\n)\nclustered by (id) into 3 BUCKETS STORED AS ORC_TRANSACTION;<\/code><\/pre>\n<h4>2. \u5411\u8303\u56f4\u5206\u533a\u63d2\u5165\u6570\u636e<\/h4>\n<pre><code class=\"language-sql\">--\u5176\u5b9e\u6d4b\u8bd5\u8303\u56f4\u5206\u533a\u662f\u5426\u751f\u6548\u4e0d\u63d2\u5165\u6570\u636e\u4e5f\u662f\u4e00\u6837\u7684\u6548\u679c\n--\u6ce8\u610f\u5206\u533a\u952e\u8981\u653e\u5728\u6700\u540e\n> INSERT INTO people_torc_partition_5_buckets SELECT name,sex,nation,id,phonenumber,email,homeaddress,borndate FROM people_torc_1000w_5_buckets;<\/code><\/pre>\n<h4>3. \u5c06hive.log4j\u7684print level\u8bbe\u7f6e\u4e3aDEBUG\u6a21\u5f0f<\/h4>\n<ul>\n<li>\u53c2\u8003KB\u94fe\u63a5\uff1a\u5982\u4f55\u8c03\u6574hive\u65e5\u5fd7\u7ea7\u522b\u4e3aDEBUG\u6a21\u5f0f<\/li>\n<\/ul>\n<h4>4. \u6253\u5f00\u53c2\u6570\u5f00\u5173<\/h4>\n<ul>\n<li>SET hive.rpp.show.results = TRUE;<\/li>\n<\/ul>\n<h4>5. \u4f7f\u7528\u8fc7\u6ee4\u64cd\u4f5c\u67e5\u627e\u4ec5\u5c5e\u4e8e\u90e8\u5206\u5206\u533a\u7684\u8bb0\u5f55<\/h4>\n<pre><code class=\"language-sql\">SELECT * FROM people_torc_partition_5_buckets WHERE borndate <'2009-12-31'<\/code><\/pre>\n<h4>6. \u5728hive-server2.log\u65e5\u5fd7\u4e2d\u67e5\u627eafter range partition pruner\u7684\u8bb0\u5f55<\/h4>\n<p><strong>\u53ef\u4ee5\u770b\u5230\u6839\u636eborndate\u5b57\u6bb5\u8fc7\u6ee4\u65f6\u95f4\u5c0f\u4e8e2009-12-31\u7684\uff0c\u5bf9\u5e94\u8be5\u8868\u76846\u4e2a\u5206\u533a\uff0c\u53ea\u9700\u8981\u67e5\u8be2\u9664beforemax\u5206\u533a\u4ee5\u5916\u76845\u4e2a\u5206\u533a\uff0c\u6240\u4ee5\u65e5\u5fd7\u91cc\u9762\u663e\u793aafter range partition pruner 5\uff0c5\u5c0f\u4e8e6\uff0c\u4ee3\u8868\u5206\u533a\u6210\u529f<\/strong><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2020\/03\/image-1584368865130.png\" alt=\"file\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 \u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\uff0c\u5982\u4f55\u901a\u8fc7\u5f00\u542finceptor server\u7684DEBUG\u65e5\u5fd7\u67e5\u770brange\u5206\u533a\u662f\u5426\u6210\u529f\u751f ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=2619\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121],"tags":[],"class_list":["post-2619","post","type-post","status-publish","format-standard","hentry","category-121"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/2619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2619"}],"version-history":[{"count":2,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/2619\/revisions"}],"predecessor-version":[{"id":2621,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/2619\/revisions\/2621"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}