Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build tables regularly by hive

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how hive regular table, Xiaobian think it is very practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.

Sun Zhi Ruxia 192.168.244.35 - - [03/Dec/2015:23:22:11 +0800] "POST /touch/appService.hotwave HTTP/1.0" 200 77 "-" "Apache-HttpClient/4.1.3 (java 1.5)" "-" 120.132.34.5 "touch.cut.hotwave.com" 15 - - - - 20fe3051-56bd-46f5-9964-e0720 drop table if exists access_log_data;CREATE external TABLE access_log_data ( host STRING, identity STRING, user STRING, time STRING, methon string, request STRING, httpversion string, status STRING, size STRING, reference STRING, agent STRING, qunarglobal STRING, realip STRING, reqHost STRING, processTime STRING, qn48 STRING, clickid STRING, it STRING, et STRING )partitioned by(dt string,server string)ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'WITH SERDEPROPERTIES ( "input.regex" = "([^ ]*) ([^ ]*) ([^ ]*) \\[([^\\]]*)\\] \"(GET|POST) ([^ ]*) ([^ ]*)\" (-|[0-9]*) (-|[0-9]*) \"([^ ]*|-)\"\\s\"((?: [^\"])+)\"\\s\"((?: [^\"])+)\"\\s([^ ]*|-)(?:, [^ ])?\\ s\"([^ ]*)\"\\s([^ ]*) ([^ ]*|-) ([^ ]*|-) ([^ ]*|-) ([^ ]*|-)", "output.format.string" = "%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s $s $s $s $s $s $s $s $s $s $s")STORED AS TEXTFILELOCATION '/user/searcher/access-log/access-test/'; alter table hotwave_log_data set serproperties ('input.regex'="([^ ]*)([^]*)([^]*) \\[([^\\]]*)\\] \"(GET| POST) ([^ ]*) ([^ ]*)\" (-|[0-9]*) (-|[0-9]*) \"([^ ]*|-)\"\\s\"((?: [^\"])+)\"\\s\"((?: [^\"])+)\"\\s([^ ]*|-)(?:, [^ ])?\\ s\"([^ ]*)\"\\s([^ ]*) ([^ ]*|-) ([^ ]*|-) ([^ ]*|-) ([^ ]*|-) ([^ ]*|-) ([^ ]*|-)", 'output.format.string'="%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s $s %20$s %21$s");alter table hotwave_log_data add columns(qn1 string,ts string); output hive> select * from hotwave_log_data limit 1;OK127.0.0.1 - - 02/Apr/2015:00:00:00 +0800 GET //touch/styles/common.js HTTP/1.0 200 2738 - Mozilla/5.0 (Linux; Android 4.4.2; SM-G9008V Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36 - 113.69.127.64 touch.hotwave.hotwave.com 0 - - - - NULL NULL 2015-04-02 l-xx.cx6 on "how to regular table hive" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report