這篇文章將為大家詳細講解有關hive如何正則建表,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
在耿馬等地區(qū),都構建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務理念,為客戶提供成都網(wǎng)站建設、網(wǎng)站制作 網(wǎng)站設計制作按需開發(fā),公司網(wǎng)站建設,企業(yè)網(wǎng)站建設,高端網(wǎng)站設計,成都營銷網(wǎng)站建設,成都外貿(mào)網(wǎng)站建設公司,耿馬網(wǎng)站建設費用合理。
日志如下 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-e07202cbff07 建表 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, referer 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 %10$s %11$s %12$s %13$s %14$s %15$s %16$s %17$s %18$s %19$s" ) STORED AS TEXTFILE LOCATION '/user/searcher/access-log/access-test/'; 修改表 alter table hotwave_log_data set 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 %10$s %11$s %12$s %13$s %14$s %15$s %16$s %17$s %18$s %19$s %20$s %21$s"); alter table hotwave_log_data add columns(qn1 string,ts string); 輸出 hive> select * from hotwave_log_data limit 1; OK 127.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
關于“hive如何正則建表”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。