I'm trying to create an internal (managed) table in hive that can store my incremental log data. The table goes like this:
CREATE TABLE logs (foo INT, bar STRING, created_date TIMESTAMP)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '<=>'
STORED AS TEXTFILE;
I need to load data into this table periodically.
LOAD DATA INPATH '/user/foo/data/logs' INTO TABLE logs;
But the data is not getting inserted into the table properly. There might be some problem with the delimiter.Can't find why.
Example log line:
120<=>abcdefg<=>2016-01-01 12:14:11
On select * from logs;
I get,
120 =>abcdefg NULL
first attribute is fine, the second contains a part of delimiter but since it's string that is getting inserted and third will be null since it expects date time.
Can anyone please help on how to provide custom delimiters and load data successfully.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…