Review Board 1.7.22


HIVE-3004: RegexSerDe should support other column types in addition to STRING

Review Request #8931 - Created Jan. 12, 2013 and updated

Shreepadma Venugopalan
HIVE-3004
HIVE-3004
Reviewers
hive
ashutoshc
hive-git
This patch enhances regex serde to parse column types other than STRING. Only primitive types are supported.
New test cases have been added and they pass.
ql/src/test/queries/clientnegative/serde_regex.q
Revision 6603b91 New Change
1
USE default;
1
USE default;
2
--  This should fail because Regex SerDe supports only columns of type string
2
--  This should fail because Regex SerDe doesn't support TIMESTAMP, STRUCT
3
CREATE TABLE serde_regex(
3
CREATE TABLE serde_regex(
4
  host STRING,
4
  host STRING,
5
  identity STRING,
5
  identity STRING,
6
  user STRING,
6
  user STRING,
7
  time STRING,
7
  time TIMESTAMP,
8
  request STRING,
8
  request STRING,
9
  status INT,
9
  status INT,
10
  size INT,
10
  size INT,
11
  referer STRING,
11
  referer STRING,
12
  agent STRING)
12
  agent STRING,

    
   
13
  strct STRUCT<a:INT, b:STRING>)
13
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
14
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
14
WITH SERDEPROPERTIES (
15
WITH SERDEPROPERTIES (
15
  "input.regex" = "([^ ]*) ([^ ]*) ([^ ]*) (-|\\[[^\\]]*\\]) ([^ \"]*|\"[^\"]*\") (-|[0-9]*) (-|[0-9]*)(?: ([^ \"]*|\"[^\"]*\") ([^ \"]*|\"[^\"]*\"))?")
16
  "input.regex" = "([^ ]*) ([^ ]*) ([^ ]*) (-|\\[[^\\]]*\\]) ([^ \"]*|\"[^\"]*\") (-|[0-9]*) (-|[0-9]*)(?: ([^ \"]*|\"[^\"]*\") ([^ \"]*|\"[^\"]*\"))?")
16
STORED AS TEXTFILE;
17
STORED AS TEXTFILE;
ql/src/test/queries/clientpositive/serde_regex.q
Revision c6809cb New Change
 
ql/src/test/results/clientnegative/serde_regex.q.out
Revision 03fe907 New Change
 
ql/src/test/results/clientpositive/serde_regex.q.out
Revision a8ce604 New Change
 
serde/src/java/org/apache/hadoop/hive/serde2/RegexSerDe.java
Revision e728244 New Change
 
  1. ql/src/test/queries/clientnegative/serde_regex.q: Loading...
  2. ql/src/test/queries/clientpositive/serde_regex.q: Loading...
  3. ql/src/test/results/clientnegative/serde_regex.q.out: Loading...
  4. ql/src/test/results/clientpositive/serde_regex.q.out: Loading...
  5. serde/src/java/org/apache/hadoop/hive/serde2/RegexSerDe.java: Loading...