Created
May 17, 2012 05:55
-
-
Save rjurney/2716816 to your computer and use it in GitHub Desktop.
Hacking Datetimes into mongo-hadoop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: Pig does not have a DateTime type yet, so this is hackery. | |
// See https://issues.apache.org/jira/browse/PIG-1314 | |
case DataType.CHARARRAY: | |
// If it starts like an ISODate... | |
if((String)d.startsWith("ISODate(")) { | |
// and it ends like an ISODate... | |
if((String)d.endsWith(")")) { | |
// lets treat it like an ISODate. | |
try { | |
builder.add( field.getName(), new Date((String)d)); | |
} | |
catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
builder.add( field.getName(), (String)d ); | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment