Petro
Petro

Reputation: 3652

HCatalog Date in PIG with Hive table

I'm trying to load a date field from PIG into a hive table, the PIG script has the field as:

testdate:chararray

The Hive table description is:

col_name    data_type   
testdate      date

Pig 'chararray' type in column 0 cannot map to HCat 'DATE'type. Target filed must be of HCat type {STRING or CHAR or VARCHAR}

I looked up http://pig.apache.org/docs/r0.9.1/basic.html and discovered PIG does not have a format for date with HCatalog. What is the best solution for storing this value as a date in HIVE if I must use PIG? Thanks.

Upvotes: 0

Views: 583

Answers (1)

Petro
Petro

Reputation: 3652

Ok I figured it out, since there is limited info on this topic:

https://cwiki.apache.org/confluence/display/Hive/HCatalog+LoadStore#HCatalogLoadStore-TypesinHive0.13.0andLater.1

I needed to use the DATETIME instead of chararray

Table of type conversions: enter image description here

Upvotes: 1

Related Questions