0

I have a csv file in hdfs and need to create a external table in Hive. I also need to add a extra column timestamp that should by default hold the value of record insert timestamp. I read that it is not possible in hive to set a default value like SQL Server.

How to handle this case?

1 Answers1

0

in lower versions, looks like hive CURRENT_DATE is not available, hence you can use

select TO_DATE(FROM_UNIXTIME(UNIX_TIMESTAMP())) as timestamp;

In higher versions say hive 2.0, you can use :

select CURRENT_DATE as timestamp;
Sahil Desai
  • 3,418
  • 4
  • 20
  • 41