首页
\
问答
\
执行错误:来自org.apache.hadoop.hive.ql.exec.DDLTask(Execution Error: from org.apache.hadoop.hive.ql.exec.DDLTask)
执行错误:来自org.apache.hadoop.hive.ql.exec.DDLTask(Execution Error: from org.apache.hadoop.hive.ql.exec.DDLTask)
我使用下面的正则表达式(tab seperated)来解析给出的数据(也是分隔符)。
Hive表创建语法:
create table akmlogreg(logdate string, time string, clientip string, method string, uri string, status string, bytes string, TimeTakenMS string, referer string, useragent string, cs_Cookie string) ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' WITH SERDEPROPERTIES ( "input.regex" ="([0-9-]+) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) (\".*\"|[^ ]*) (\".*\"|[^ ]*) ([^\r\n]+)", "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");
通过这个正则表达式我想要删除任何注释(以#开头的行)并一次只选择一行。 但是当我尝试在配置单元中创建表时,此语法会出错。 制表符分隔正则表达式背后的逻辑是我的日志数据也是制表符分隔的。 任何人都可以给我一个更好的建议或解决方案,我可以解析这种使用正则表达式分隔的数据吗?
例外:
FAILED: Error in metadata: java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 10 ([0-9-]+)]+) ^ FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
数据:
#Version: 1.0 #Fields: date time cs-ip cs-method cs-uri sc-status sc-bytes time-taken cs(Referer) cs(User-Agent) cs(Cookie) 2013-07-02 00:00:00 242.242.242.242 GET /9699/14916.jpg 200 6783 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.23 Safari/534.10" "-" 2013-07-02 00:00:00 242.242.242.242 GET /169875/2006-2010-679336-640x428.JPG 200 78221 355 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36" "-" 2013-07-02 00:00:00 242.242.242.242 GET /169875/2006-2010-679339-640x428.JPG 200 86791 238 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36" "-"
I am using the below regex(tab seperated) to parse the data(also tab seperated) which is given.
Hive table creation syntax:
create table akmlogreg(logdate string, time string, clientip string, method string, uri string, status string, bytes string, TimeTakenMS string, referer string, useragent string, cs_Cookie string) ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' WITH SERDEPROPERTIES ( "input.regex" ="([0-9-]+) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) (\".*\"|[^ ]*) (\".*\"|[^ ]*) ([^\r\n]+)", "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");
through this regex i want any comments (lines starting with #) should be removed and select only one row at a time. But this syntax gives error when i try to create the table in hive. My logic behind tab separated regex is that my log data is also tab separated. Can anyone give me a better suggesion or solution by which i can parse this kind of data which is tab seperated using regex?
Exception:
FAILED: Error in metadata: java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 10 ([0-9-]+)]+) ^ FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
Data:
#Version: 1.0 #Fields: date time cs-ip cs-method cs-uri sc-status sc-bytes time-taken cs(Referer) cs(User-Agent) cs(Cookie) 2013-07-02 00:00:00 242.242.242.242 GET /9699/14916.jpg 200 6783 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.23 Safari/534.10" "-" 2013-07-02 00:00:00 242.242.242.242 GET /169875/2006-2010-679336-640x428.JPG 200 78221 355 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36" "-" 2013-07-02 00:00:00 242.242.242.242 GET /169875/2006-2010-679339-640x428.JPG 200 86791 238 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36" "-"
原文:https://stackoverflow.com/questions/17522962
更新时间:2023-06-28 08:06
最满意答案
尝试
if ( !isset($_SESSION['forceDesktop']) ) $_SESSION['forceDesktop'] = false; $detect = new Mobile_Detect(); // Exclude tablets. if( $detect->isMobile() && !$detect->isTablet() && !$_SESSION['forceDesktop'] ){ header("location:mobile/index.php"); } .... // some logic asking whether to force the desktop version .... $_SESSION['forceDesktop'] = true;
try
if ( !isset($_SESSION['forceDesktop']) ) $_SESSION['forceDesktop'] = false; $detect = new Mobile_Detect(); // Exclude tablets. if( $detect->isMobile() && !$detect->isTablet() && !$_SESSION['forceDesktop'] ){ header("location:mobile/index.php"); } .... // some logic asking whether to force the desktop version .... $_SESSION['forceDesktop'] = true;
相关问答
更多-
就我能理解你的问题而言,像这样的东西应该可以工作。 var MediaQuery = require('react-responsive'); var A = React.createClass({ render: function(){ let mediaComponent; if(/* enableMediaComponent */) { mediaComponent =
... -
仅重定向移动网站一次(redirect a mobile site only once)[2022-01-23]
按照http://www.ezmobilewebsitetools.com/howto-redirect.html上的说明操作: 将以下代码粘贴到index.html的部分