Monday, July 17, 2017

HIVE load csv text file

First column must not contain spaces, otherwise it will load NULL! Intermediate columns can contain spaces, it is suggested to load them as String and then convert to the required type.
1.Load into special text table
CREATE TABLE tt (
  id BIGINT,
  data STRING
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE
2.Move to the normal table