{"id":106842,"date":"2020-05-28T19:35:42","date_gmt":"2020-05-28T11:35:42","guid":{"rendered":"http:\/\/4563.org\/?p=106842"},"modified":"2020-05-28T19:35:42","modified_gmt":"2020-05-28T11:35:42","slug":"hive-%e6%98%af%e5%90%a6%e6%94%af%e6%8c%81%e4%bb%8e-hdfs-%e4%bb%a5%e5%a4%96%e7%9a%84%e6%95%b0%e6%8d%ae%e6%ba%90%e8%af%bb%e5%8f%96%e6%95%b0%e6%8d%ae%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=106842","title":{"rendered":"hive \u662f\u5426\u652f\u6301\u4ece hdfs \u4ee5\u5916\u7684\u6570\u636e\u6e90\u8bfb\u53d6\u6570\u636e\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  hive \u662f\u5426\u652f\u6301\u4ece hdfs \u4ee5\u5916\u7684\u6570\u636e\u6e90\u8bfb\u53d6\u6570\u636e\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : leavan <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u662f\u8fd9\u6837\u7684\uff0c\u6211\u73b0\u5728\u6709\u4e00\u4e2a\u9700\u6c42\u5c31\u662f\u5728 hivesql \u4e2d\u628a\u67d0\u4e2a partition_key \u5217\u4e3e\u51fa\u6765\uff0c\u6bd4\u5982\u5bf9\u4e8e\u8868 t<\/p>\n<pre><code>CREATE TABLE t (   num int) PARTITIONED BY (   p1 string,   p2 string); <\/code><\/pre>\n<p>\u6211\u9700\u8981\u628a p1 \u786e\u5b9a\u7684\u60c5\u51b5\u4e0b\u7684 p2 \u5217\u4e3e\u51fa\u6765\uff0c\u6bd4\u5982<\/p>\n<pre><code>select distinct(p2) from t where p1 = 'test'; <\/code><\/pre>\n<p>\u7406\u8bba\u4e0a\u6765\u8bf4\uff0c\u8fd9\u4e2a\u67e5\u8be2\u53ea\u6d89\u53ca\u5230\u5143\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\uff0c\u6ca1\u5fc5\u8981\u53bb hdfs \u4e0a\u628a\u6bcf\u6761\u6570\u636e\u90fd\u8bfb\u51fa\u6765\uff0c\u4f46 hive \u786e\u5b9e\u662f\u8fd9\u6837\u505a\u4e86\uff0c\u6548\u7387\u975e\u5e38\u4f4e\u3002<\/p>\n<p>\u6240\u4ee5\u73b0\u5728\u7684\u60f3\u6cd5\u5c31\u662f\u6211\u81ea\u5df1\u6765\u5b9e\u73b0\u8fd9\u4e2a\u903b\u8f91\uff0c\u5141\u8bb8 hive \u80fd\u591f\u76f4\u63a5\u4ece\u81ea\u5df1\u7684\u5143\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u4fe1\u606f\uff0c\u60f3\u77e5\u9053 hive \u6709\u6ca1\u6709\u4ece hdfs \u4ee5\u5916\u7684\u6570\u636e\u6e90\u8bfb\u53d6\u6570\u636e\u7684\u80fd\u529b\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1775652\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MinGo215 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u989d\uff0c\u5206\u533a\u4e0d\u591a\u7684\u8bdd\u76f4\u63a5 show partitions \u5c31\u597d\u4e86\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1775653\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 31p7410 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             show partitions, \u5206\u533a\u591a\u7684\u8bdd hadoop fs -ls \/user\/hive\/warehouse\/database.db\/t\/p1=test\/                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1775654\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ackoly <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bb0\u5f97\u652f\u6301\u5efa\u7acb\u6620\u5c04\u8868\uff0c\u76f4\u8bfb\u5173\u7cfb\u578b\u6570\u636e\u5e93                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1775655\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leavan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @MinGo215 \u662f\u60f3\u628a\u5206\u533a\u4fe1\u606f\u4f5c\u4e3a\u4e00\u4e2a\u8868\u53bb\u8bfb\u53d6\u548c\u5904\u7406\u8fd9\u4e9b\u4fe1\u606f\uff0cshow partitions \u53ea\u662f\u5355\u7eaf\u7684\u5217\u4e3e\u5206\u533a\uff0c\u800c\u4e14\u4e5f\u6ca1\u6cd5\u5199\u8fdb SQL \u91cc\u5427\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>hive \u662f\u5426\u652f\u6301\u4ece hdfs \u4ee5&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/106842"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=106842"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/106842\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=106842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=106842"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=106842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}