1

While creating table using a file in hue-hive interface we have to specify a delimiter. (Tab, Space, Comma etc.) . But my file delimited by one or more spaces. How to specify delimiter to delimit by one or more spaces.

enter image description here

Sachin Janani
  • 1,310
  • 1
  • 17
  • 33
Bruce
  • 8,609
  • 8
  • 54
  • 83

1 Answers1

0

You can create table use regex as delimiter via this way:

Data, put data to hdfs

1  2 3   4
a   b  c d

create table:

//grammar for create table
CREATE TABLE test1(
a string, 
b string, 
c string, 
d string
)
ROW FORMAT  SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'  WITH SERDEPROPERTIES  
(
"input.regex" ="([^\\s]*)\\s+([^\\s]*)\\s+([^\\s]*)\\s+([^\\s]*)",
"output.format.string" = "%1$s %2$s %3$s %4$s"
)  
LOCATION '/test1/';
Guo
  • 1,761
  • 2
  • 22
  • 45