Reply
Highlighted
New Contributor
Posts: 4
Registered: ‎03-31-2016

How to store date and timestamp in hive using timestamp column ?

I am trying to read the date and timestamp values from the file by using the timestamp data typ in hive , but it returns NULL for date values and return the original timestamp.

 

Input date:

 

2015-01-01

2015-02-02 12:00:00.2323

2015-06-06

 

Output i get :

 

NULL

2015-02-02 12:00:00.2323
NULL

 

DDL:

 

create external table mytime(id string ,t timestamp) ROW FORMAT DELIMITED
  FIELDS TERMINATED BY ','
STORED AS INPUTFORMAT
  'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION 'hdfs://xxx/data/dev/ind/'

 

Is there a way to solve the problem.