I want to create a HIVE Table with multi string character as a delimiter such as
CREATE EXTERNAL TABlE tableex(id INT, name STRING)
ROW FORMAT delimited fields terminated by ','
LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/user/myusername';
I want to have delimiter as a multi string like "~*".
CREATE EXTERNAL TABlE tableex(id INT, name STRING) ROW FORMAT delimited fields terminated by ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/user/myusername';
You can change the delimiter using the below alter table command.
Introduction. Introduced in HIVE-5871, MultiDelimitSerDe allows user to specify multiple-character string as the field delimiter when creating a table.
FILELDS TERMINATED BY
does not support multi-character delimiters. The easiest way to do this is to use RegexSerDe
:
CREATE EXTERNAL TABlE tableex(id INT, name STRING)
ROW FORMAT 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
"input.regex" = "^(\\d+)~\\*(.*)$"
)
STORED AS TEXTFILE
LOCATION '/user/myusername';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With