Keywords as JSON properties #24

sixtus opened this Issue Mar 19, 2013 · 7 comments


None yet

4 participants


I am unable to figure out how to read "timestamp" from my json, as hive

FAILED: ParseException line 3:2 mismatched input 'timestamp' expecting Identifier near ',' in column specification

is there an "as ts" syntax?


That's a good point though. JSON doesn't care about hive keywords. One thing I did in another serde (lwes-java) is to add mappings in the serdeproperties:
SERDE JsonSerde WITH SERDEPROPERTIES( 'mapping.timestamp'='ts' )
and map JSON field 'timestamp' into hive column 'ts'. Would that work for you guys ?


I have a preliminary version in a feature branch, if you guys feel like compiling it.
Will merge the feature soon (and have a look at the other issues as well).

@rcongiu rcongiu added a commit that closed this issue Mar 26, 2013
@rcongiu fixes #24 b26d5c8
@rcongiu rcongiu closed this in b26d5c8 Mar 26, 2013

Awesome! I'll try asap.

@brndnmtthws brndnmtthws added a commit to brndnmtthws/Hive-JSON-Serde that referenced this issue Jul 11, 2013
@rcongiu fixes #24 8482689

How can this be done in the JSON input?

For example:
{ "IsDeleted": true } SerDe output creates a boolean field
{ "BillingLatitude": 0 } SerDe output creates an int field
{ "Message": "Hello World" } SerDe output creates a string field
{ "LastActivityTime": "1980-01-01 00:00:00.0" } SerDe output DOES NOT create a timestamp field rather it creates a string field

What value in the JSON input would drive the creation of a timestamp field?


You have to declare it as timestamp in the hive table. Internally, the SerDe uses the JSON library to parse the JSON object, in this case to string, then when hive requests the timestamp, a conversion is made from string to timestamp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment