Sizou
Sizou

Reputation: 1

Sqoop export from Hive to Teradata Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]

I'm trying to export data from Hadoop Hive to Teradata. My data contains Timestamps that can be NULL.

When I do the export, For the lines that have a NULL Timestamp, I got the following error :
"Timestamp format must be yyyy-mm-dd hh:mm:Ss[.fffffffff]"

In my sqoop export I do add the two options --input-null-string '\N' and --input-null-non-string '\N'.

Do you know any way to solve this issue ?

Thanks.

Upvotes: 0

Views: 2304

Answers (1)

K S Nidhin
K S Nidhin

Reputation: 2650

The column with data type timestamp in Teradata need to have the value in the following format yyyy-mm-dd hh:mm:Ss and the data in your hive table doesnt have this format.

Change the values in the hive table for the corresponding null valued timestamp using some of these hive udfs:

  • unix_timestamp(string date, string pattern)
  • or simply check for null and replace with empty string using

    CASE WHEN date='' THEN '' ELSE date END ,

Hope this helps

Upvotes: 1

Related Questions