You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Mark Meyer <of...@googlemail.com> on 2011/05/18 14:52:40 UTC

String Escape rules

Hello!
I'm trying to create a table using RegexSerDe. But I'm completely lost
on the string escape rules for hive:

create table alerts (tstamp STRING, host STRING, service STRING,
status STRING) CLUSTERED BY(host, service) SORTED BY (tstamp) INTO
1024 BUCKETS ROW FORMAT SERDE
'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
WITH SERDEPROPERTIES ("input.regex" = "\\[([^\\]]*)\\] SERVICE ALERT:
([^;]*);([^;]*);([^;]*).*")
STORED AS SEQUENCEFILE;

FAILED: Parse Error: line 3:41 mismatched input '[' expecting
StringLiteral in specifying key/value property

I tested the Regex both in pcre and java (pcre minus one '\') and both
seem to work nicely. I can however supply regexes from other hive
examples (using "\\[" syntax) and these work nicely. So what's the
trick?

Thanks.

Kind regards, Mark