{"id":519,"date":"2021-02-19T16:45:41","date_gmt":"2021-02-19T07:45:41","guid":{"rendered":"https:\/\/www.opentone.co.jp\/optonlabos\/?p=519"},"modified":"2025-05-12T10:06:21","modified_gmt":"2025-05-12T01:06:21","slug":"hadoop-hive%e3%80%80sql%e3%83%a9%e3%82%a4%e3%82%af%e3%81%aa%e3%82%af%e3%82%a8%e3%83%aa%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%83%93%e3%83%83%e3%82%b0%e3%83%87%e3%83%bc%e3%82%bf%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.opentone.co.jp\/ot-lab\/all\/uncategorized\/hadoop-hive%e3%80%80sql%e3%83%a9%e3%82%a4%e3%82%af%e3%81%aa%e3%82%af%e3%82%a8%e3%83%aa%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%83%93%e3%83%83%e3%82%b0%e3%83%87%e3%83%bc%e3%82%bf%e8%a7%a3%e6%9e%90","title":{"rendered":"Hadoop\/Hive\u3000SQL\u30e9\u30a4\u30af\u306a\u30af\u30a8\u30ea\u3092\u4f7f\u3063\u3066\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u89e3\u6790\uff08\u524d\u7de8\uff09"},"content":{"rendered":"\n<p>\u5148\u65e5\u3001\u5148\u8f29\u306ekoglen\u3055\u3093\u304cHadoop\u306b\u95a2\u3059\u308b\u8a18\u4e8b\u3092\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u306e\u3067\u3001<br>\u6d41\u308c\u306b\u306e\u3063\u3066\u4eca\u56de\u306f\u540c\u3058Hadoop\u30d7\u30ed\u30c0\u30af\u30c8\u306eHive\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"200\" height=\"179\" src=\"https:\/\/www.opentone.co.jp\/optonlabos\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png\" alt=\"\" class=\"wp-image-520\" title=\"hive\" \/><\/figure><\/div>\n\n\n\n<p>\u524d\u7de8\u306f\u3001\u57fa\u790e\u7de8\u3068\u3057\u3066Hive\u306b\u95a2\u3059\u308b\u6982\u8981\u3092\u7c21\u5358\u306b\u89e3\u8aac\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u3001<br>\u5f8c\u7de8\u306f\u3001\u5b9f\u8df5\u7de8\u3068\u3057\u3066\u672c\u30b5\u30a4\u30c8\u306e\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u3092\u89e3\u6790\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u203b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306a\u3069\u306e\u5c0e\u5165\u7de8\u306f\u5272\u611b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h1 class=\"wp-block-heading\">Hive\u3068\u306f\uff1f<\/h1>\n\n\n\n<p>Hadoop\u306b\u3088\u308b\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u89e3\u6790\u3067\u306f\u4e00\u822c\u7684\u306bJava\u3092\u4f7f\u3044\u3001MapReduce\u306e\u5b9f\u88c5\u3092\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3059\u304c\u3001<br>\u89e3\u6790\u65b9\u6cd5\u3092\u8003\u3048\u305f\u308a\u3001\u305d\u308c\u3092\u5b9f\u969b\u306b\u30ed\u30b8\u30c3\u30af\u306b\u3059\u308b\u306e\u306f\u7d50\u69cb\u5927\u5909\u306a\u4f5c\u696d\u3060\u3068\u601d\u3044\u307e\u3059\u3002<br>\u305d\u3053\u3067\u767b\u5834\u3057\u305f\u306e\u304cHive\u3067\u3059\u3002<br><a href=\"http:\/\/hadoop.apache.org\/hive\/\">http:\/\/hadoop.apache.org\/hive\/<\/a><\/p>\n\n\n\n<p>Hive\u306fHDFS\u4e0a\u306b\u4fdd\u5b58\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u30c6\u30fc\u30d6\u30eb\u3068\u3057\u3066\u898b\u505a\u3057\u3001<br>HiveQL\u3068\u547c\u3070\u308c\u308b\u3001SQL\u30e9\u30a4\u30af\u306aDSL\u8a00\u8a9e\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001<br>MapReduce\u3092\u610f\u8b58\u3059\u308b\u3053\u3068\u306a\u304f\u3001\u30c7\u30fc\u30bf\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u540c\u69d8\u306e\u30d7\u30ed\u30c0\u30af\u30c8\u3068\u3057\u3066\u306f\u3001\u300cPig\u300d\u3068\u547c\u3070\u308c\u308bDSL\u8a00\u8a9e\u3082\u5b58\u5728\u3057\u307e\u3059\u304c\u3001<br>\u300cHive\u300d\u306fSQL\u30e9\u30a4\u30af\u306a\u8a00\u8a9e\u3067\u3042\u308b\u3068\u3044\u3046\u70b9\u304c\u3001\u5927\u304d\u306a\u9b45\u529b\u3067\u3059\u3002<br>\u3061\u306a\u307f\u306b\u300cHive\u300d\u306fFacebook\u304c\u3001\u300cPig\u300d\u306fYahoo\uff01\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">HiveQL(DDL)<\/h1>\n\n\n\n<p>HiveQL\u306f\u4f55\u5ea6\u3082\u8ff0\u3079\u3066\u3044\u307e\u3059\u3088\u3046\u306b\u3001SQL\u306b\u4f3c\u3066\u3044\u307e\u3059\u3002<br>\u672c\u8a18\u4e8b\u3067\u306f\u5fc5\u8981\u6700\u4f4e\u9650\u306e\u7d39\u4ecb\u306b\u7559\u3081\u3055\u305b\u3066\u9802\u304d\u307e\u3059\u3002<br>\u5b8c\u5168\u306a\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306f\u4e0b\u8a18\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<br><a href=\"https:\/\/cwiki.apache.org\/confluence\/display\/Hive\/LanguageManual\">https:\/\/cwiki.apache.org\/confluence\/display\/Hive\/LanguageManual<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6307\u5b9a\u3067\u304d\u308b\u30c7\u30fc\u30bf\u578b<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u578b\u306e\u7a2e\u985e<\/th><th>\u30c7\u30fc\u30bf\u578b\u540d<\/th><th>\u5185\u5bb9<\/th><\/tr><tr><td>\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b<\/td><td>\u6574\u6570\u578b<\/td><td>TINYINT<\/td><td>1Byte\u306e\u6574\u6570<\/td><\/tr><tr><td>SMALLINT<\/td><td>2Byte\u306e\u6574\u6570<\/td><\/tr><tr><td>INT<\/td><td>4Byte\u306e\u6574\u6570<\/td><\/tr><tr><td>BIGINT<\/td><td>8Byte\u306e\u6574\u6570<\/td><\/tr><tr><td>\u6d6e\u52d5\u5c0f\u6570\u70b9\u578b<\/td><td>FLOAT<\/td><td>\u5358\u7cbe\u5ea6\u306e\u6d6e\u52d5\u5c0f\u6570\u70b9<\/td><\/tr><tr><td>DOUBLE<\/td><td>\u500d\u7cbe\u5ea6\u306e\u6d6e\u52d5\u5c0f\u6570\u70b9<\/td><\/tr><tr><td>\u8ad6\u7406\u578b<\/td><td>BOOLEAN<\/td><td>TRUE\u3068FALSE<\/td><\/tr><tr><td>\u6587\u5b57\u5217\u578b<\/td><td>STRING<\/td><td>\u6587\u5b57\u5217<\/td><\/tr><tr><td>\u914d\u5217\u578b<\/td><td>ARRAY &lt; \u30c7\u30fc\u30bf\u578b &gt;<\/td><td>\u30c7\u30fc\u30bf\u578b\u3092\u914d\u5217\u3068\u3057\u3066\u6271\u3046<\/td><\/tr><tr><td>\u30de\u30c3\u30d7\u578b<\/td><td>MAP &lt;\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b, \u30c7\u30fc\u30bf\u578b&gt;<\/td><td>Key, Value\u5f62\u5f0f\u3067\u30c7\u30fc\u30bf\u3092\u6271\u3046<\/td><\/tr><tr><td>\u69cb\u9020\u578b<\/td><td>STRUCT&lt;\u30ab\u30e9\u30e0\u540d\uff1a\u30c7\u30fc\u30bf\u578b ,,,&gt;<\/td><td>\u8907\u6570\u306e\u30c7\u30fc\u30bf\u578b\u3092\u69cb\u9020\u5316\u3059\u308b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nCREATE [EXTERNAL] TABLE [IF NOT EXISTS] \u30c6\u30fc\u30d6\u30eb\u540d\n [(\u9805\u76ee\u540d \u578b [COMMENT \u30b3\u30e1\u30f3\u30c8], \u2026)]\n [ROW FORMAT row_format ]\n[\/sql]<\/pre>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u306e\u4e00\u756a\u7c21\u5358\u306a\u5f62\u5f0f\u3067\u3059\u3002<br>\u4ed6\u306b\u3082\u683c\u7d0d\u6642\u306e\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u3084\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u306a\u3069\u69d8\u3005\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u5272\u611b\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>ROW FORMAT\u53e5\u884c\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u6307\u5b9a\u3067\u3059\u3002\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u6642\u306b\u3001\u3053\u3053\u3067\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5f93\u3063\u3066\u9805\u76ee\u5024\u3092\u5206\u5272\u3057\u3001\u30c6\u30fc\u30d6\u30eb\u306b\u683c\u7d0d\u3057\u307e\u3059\u3002<\/li><li>\u30b5\u30f3\u30d7\u30eb<br>TSV\u30d5\u30a1\u30a4\u30eb\u3092\u30bf\u30d6\u3067\u533a\u5207\u3063\u305f\u5024\u3068\u3057\u30661\u884c\u3054\u3068\u306b\u683c\u7d0d\u3057\u305f\u4f8b[sql] CREATE TABLE logs ( id INT, created_at STRING ) ROW\u3000FORMAT DELIMITED FIELDS TERMINATED BY \u2018,\u2018 [\/sql]<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u64cd\u4f5c<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u30c6\u30fc\u30d6\u30eb\u524a\u9664<br>drop\u3059\u308b\u3068\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u81ea\u4f53\u304c\u6d88\u3048\u307e\u3059\u3002[sql] DROP TABLE [IF EXISTS] \u30c6\u30fc\u30d6\u30eb\u540d; [\/sql]<\/li><li>\u30c6\u30fc\u30d6\u30eb\u540d\u5909\u66f4[sql] ALTER TABLE \u30c6\u30fc\u30d6\u30eb\u540d\u3000RENAME TO \u65b0\u30c6\u30fc\u30d6\u30eb\u540d; [\/sql]<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u60c5\u5831\u53c2\u7167<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u30c6\u30fc\u30d6\u30eb\u306e\u4e00\u89a7\u3092\u8868\u793a[sql] SHOW TABLES; [\/sql]<\/li><li>\u30d1\u30c6\u30fc\u30b7\u30e7\u30f3\u8868\u793a[sql] SHOW PARTITIONS \u30c6\u30fc\u30d6\u30eb\u540d; [\/sql]<\/li><li>\u30c6\u30fc\u30d6\u30eb\u306e\u5185\u5bb9\u3092\u8868\u793a[sql] DESCRIBE [EXTENDED] \u30c6\u30fc\u30d6\u30eb\u540d; &#8212; \u7701\u7565\u5f62\u306eDESC\u3082\u4f7f\u7528\u53ef\u80fd &#8212; EXTENDED\u3092\u4ed8\u3051\u308b\u3068\u8a73\u7d30\u60c5\u5831\u3092\u8868\u793a [\/sql]<\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">HiveQL(DML)<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">SELECT\u6587<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nSELECT [ALL | DISTINCT] \u30ab\u30e9\u30e0\u540d1,\u30ab\u30e9\u30e0\u540d\uff12, ...\nFROM \u30c6\u30fc\u30d6\u30eb\u540d\n[WHERE \u6761\u4ef6]\n[GROUP BY col_list]\n[LIMIT number]\n[\/sql]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u306e\u96c6\u8a08\u51e6\u7406<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>GROUP BY\u53e5(\u30b0\u30eb\u30fc\u30d7\u5316)[sql] SELECT * FROM \u30c6\u30fc\u30d6\u30eb\u540d GROUP BY \u30ab\u30e9\u30e0\u540d; [\/sql]<\/li><li>HAVING\u53e5(\u30b0\u30eb\u30fc\u30d7\u5316\u5f8c\u306e\u6761\u4ef6)[sql] SELECT * FROM \u30c6\u30fc\u30d6\u30eb\u540d GROUP BY \u30ab\u30e9\u30e0\u540d HAVING \u6761\u4ef6; [\/sql]<\/li><li>LIMIT\u53e5[sql] SELECT * FROM \u30c6\u30fc\u30d6\u30eb\u540d LIMIT Number; &#8212; \u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30af\u30a8\u30ea\u306f\u3001MapReduce\u3057\u306a\u3044\u306e\u3067\u9ad8\u901f &#8212; SELECT * FROM table_name LIMIT 3 [\/sql]<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u306e\u7d50\u5408<\/h3>\n\n\n\n<p>FROM\u53e5\u3067\u306e\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u7f85\u5217\u4e0d\u53ef\u306e\u305f\u3081\u3001\u7d50\u5408\u3059\u308b\u5834\u5408\u306f\u3001JOIN\u53e5\u3092\u4f7f\u7528\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nSELECT * FROM \u30c6\u30fc\u30d6\u30eb\u540d\uff11 t1\n{LEFT|RIGHT|FULL} [OUTER] JOIN \u30c6\u30fc\u30d6\u30eb\u540d2 t2 ON t1.c1 = t2.c1;\n[\/sql]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u306e\u683c\u7d0d<\/h2>\n\n\n\n<p>\u3053\u3053\u304c\u4e00\u822c\u7684\u306aSQL\u3068\u9055\u3046\u3068\u3053\u308d\u3067\u3059\u304c\u3001\u4f5c\u6210\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u3078\u306e\u30c7\u30fc\u30bf\u306e\u683c\u7d0d\u306b\u306f\u3001INSERT\u6587\u3067\u306f\u306a\u304fLOAD\u6587\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br>LOAD\u6587\u3067\u306fHDFS\u4e0a\u3001\u30ed\u30fc\u30ab\u30eb\u30c7\u30a3\u30b9\u30af\u4e0a\u304b\u3089\u305d\u308c\u305e\u308c\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nLOAD DATA [LOCAL] INPAT '\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9' [OVERWRITE] INTO TABLE \u30c6\u30fc\u30d6\u30eb\u540d\n[\/sql]<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>LOCAL\u30aa\u30d7\u30b7\u30e7\u30f3<br>\u30ed\u30fc\u30ab\u30eb\u30c7\u30a3\u30b9\u30af\u4e0a\u306e\u30c7\u30fc\u30bf\u3092Hive\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u683c\u7d0d\u3059\u308b\u5834\u5408\u306b\u3064\u3051\u307e\u3059\u3002<\/li><li>OVERWRITE\u30aa\u30d7\u30b7\u30e7\u30f3<br>OVERWRITE\u3092\u4ed8\u3051\u305f\u5834\u5408\u3001\u4e0a\u66f8\u304d(\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u306e\u307f\uff09<br>\u4ed8\u3051\u306a\u3044\u5834\u5408\u306f\u3001\u30c7\u30fc\u30bf\u8ffd\u52a0<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5225\u30c6\u30fc\u30d6\u30eb\u3068\u3057\u3066\u4fdd\u5b58<\/h3>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\uff08SELECT\u6587\uff09\u304b\u3089\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3001\u30c7\u30fc\u30bf\u3092\u5165\u308c\u308b\u306e\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<br>\u3053\u306e\u969b\u30c6\u30fc\u30d6\u30eb\u306e\u30c7\u30fc\u30bf\u306f\u3059\u3079\u3066\u4e0a\u66f8\u304d\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nINSERT OVERWRITE TABLE \u30c6\u30fc\u30d6\u30eb\u540d SELECT\u6587 FROM \uff5e\n[\/sql]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58<\/h3>\n\n\n\n<p>HDFS\u4e0a\u3084\u30ed\u30fc\u30ab\u30eb\u30c7\u30a3\u30b9\u30af\u4e0a\u306b\u3082\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4fdd\u5b58\u3092\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nINSERT OVERWRITE [LOCAL] DIRECTORY '\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9' SELECT\u6587 FROM \uff5e\n[\/sql]<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>LOCAL<br>LOCAL\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u305f\u5834\u5408\u3001\u30ed\u30fc\u30ab\u30eb\u30c7\u30a3\u30b9\u30af\u4e0a\u306b\u30af\u30a8\u30ea\u7d50\u679c\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">\u3010\u52d5\u4f5c\u30b5\u30f3\u30d7\u30eb\u3011Word Count<\/h1>\n\n\n\n<p>\u305d\u308c\u3067\u306f\u524d\u7de8\u306e\u4ed5\u4e0a\u3052\u306b\u304a\u306a\u3058\u307f\u306eWord Count\u3092\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30fc\u30bf\u306f\u305b\u3063\u304b\u304f\u3067\u3059\u306e\u3067\u3001Koglen\u3055\u3093\u304c\u751f\u306eHadoop\u3067\u5229\u7528\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u3061\u306a\u307f\u306bHive\u3092\u5229\u7528\u3059\u308b\u90fd\u5408\u3001\u5358\u8a9e\u3054\u3068\u306b\u6539\u884c\u3092\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[bash]\ncat \/tmp\/hoge.txt\nhoge\nabc\ndef\nghi\njkl\nmno\npqe\nstu\nvwx\nyz\nhoge\nhoge\n[\/bash]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nCREATE TABLE hoge (\n  word string\n);\n[\/sql]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u683c\u7d0d<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nLOAD DATA LOCAL INPATH '\/tmp\/hoge.txt'\nOVERWRITE INTO TABLE hoge;\n[\/sql]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30ef\u30fc\u30c9\u30ab\u30a6\u30f3\u30c8\u5b9f\u884c<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">[sql]\nSELECT word, count(*) FROM hoge GROUP BY word;\n[\/sql]<\/pre>\n\n\n\n<p>\u5b9f\u969b\u306bHiveQL\u3092\u5b9f\u884c\u3057\u305f\u969b\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u30ed\u30b0\u3067\u3059\u3002<br>SELECT\u6587\u304b\u3089Hadoop\u306eMap Reduce\u304c\u547c\u3073\u51fa\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br>\u7d50\u679c\u3082Koglen\u3055\u3093\u306eWord Count\u306e\u7d50\u679c\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"760\" height=\"570\" src=\"https:\/\/www.opentone.co.jp\/optonlabos\/wp-content\/uploads\/sites\/11\/2021\/02\/hive_sample.png\" alt=\"\" class=\"wp-image-521\" title=\"hive_sample\" srcset=\"https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive_sample.png 760w, https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive_sample-300x225.png 300w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/figure><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h1>\n\n\n\n<p>\u4ee5\u4e0a\u3001\u7c21\u5358\u3067\u306f\u3042\u308a\u307e\u3057\u305f\u304cHive\u306e\u6982\u8981\u3092\u7d39\u4ecb\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<br>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067MapReduce\u3092\u66f8\u304f\u5fc5\u8981\u304c\u306a\u304f\u3001<br>\u6163\u308c\u3057\u305f\u3093\u3060SQL\u3092\u4f7f\u3063\u3066MapReduce\u3092\u64cd\u4f5c\u3067\u304d\u308b\u306e\u306f\u5927\u5909\u9b45\u529b\u7684\u3060\u3068\u601d\u3044\u307e\u3059\u3002<br>\u6700\u8fd1\u306f\u65e5\u672c\u8a9e\u306e\u89e3\u8aac\u3082\u5897\u3048\u3066\u304d\u307e\u3057\u305f\u306e\u3067\u3001\u3053\u308c\u3092\u6a5f\u306b\u89e6\u308c\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n\n\n\n<p>\u5f8c\u7de8\u3067\u306fApache\u306e\u30ed\u30b0\u3092\u7528\u3044\u3066\u3001\u89e3\u6790\u3092\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002&nbsp;<\/p>\n<div class=\"opent-_2\" style=\"margin-top: 10px;margin-right: 10px;margin-bottom: 10px;margin-left: 10px;\" id=\"opent-2583887723\"><a href=\"https:\/\/www.opentone.co.jp\/backlog\/\" aria-label=\"twitter_backlogskt_new\"><img src=\"https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2023\/02\/twitter_backlogskt_new.jpg\" alt=\"\"  srcset=\"https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2023\/02\/twitter_backlogskt_new.jpg 1024w, https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2023\/02\/twitter_backlogskt_new-300x157.jpg 300w, https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2023\/02\/twitter_backlogskt_new-768x401.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" width=\"384\" height=\"200\"   \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>\u5148\u65e5\u3001\u5148\u8f29\u306ekoglen\u3055\u3093\u304cHadoop\u306b\u95a2\u3059\u308b\u8a18\u4e8b\u3092\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u306e\u3067\u3001\u6d41\u308c\u306b\u306e\u3063\u3066\u4eca\u56de\u306f\u540c\u3058<\/p>\n","protected":false},"author":1,"featured_media":520,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[15,16],"class_list":["post-519","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-hadoop","tag-hive",""],"acf":[],"aioseo_notices":[],"uagb_featured_image_src":{"full":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"thumbnail":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive-150x150.png",150,150,true],"medium":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"medium_large":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"large":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"1536x1536":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"2048x2048":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"engage-mag-carousel-img":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"engage-mag-carousel-img-landscape":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"engage-mag-carousel-large-img":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"engage-mag-carousel-large-img-landscape":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"engage-mag-large-thumb":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false],"engage-mag-small-thumb":["https:\/\/www.opentone.co.jp\/ot-lab\/wp-content\/uploads\/sites\/11\/2021\/02\/hive.png",200,179,false]},"uagb_author_info":{"display_name":"ah106rx4o4","author_link":"https:\/\/www.opentone.co.jp\/ot-lab\/author\/ah106rx4o4"},"uagb_comment_info":36,"uagb_excerpt":"\u5148\u65e5\u3001\u5148\u8f29\u306ekoglen\u3055\u3093\u304cHadoop\u306b\u95a2\u3059\u308b\u8a18\u4e8b\u3092\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u306e\u3067\u3001\u6d41\u308c\u306b\u306e\u3063\u3066\u4eca\u56de\u306f\u540c\u3058","_links":{"self":[{"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/posts\/519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/comments?post=519"}],"version-history":[{"count":1,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/posts\/519\/revisions\/522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/media\/520"}],"wp:attachment":[{"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/media?parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/categories?post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.opentone.co.jp\/ot-lab\/wp-json\/wp\/v2\/tags?post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}