将 Twitter 时间转换为 Pig DateTime 对象

Convert Twitter Time into a Pig DateTime object

我正在处理 Twitter 数据并且有一个字段:user_created_at 看起来像 Thu Jun 11 16:41:35 +0000 2015

我不确定字段的类型是什么,因为我是用象鸟得到字段的。要将其转换为 datetime 类型,我做了:

ToDate(user_created_at, 'yyyy.MM.dd') as user_created_at

但失败并出现错误:

ERROR 0: Exception while executing [POUserFunc (Name: POUserFunc(org.apache.pig.builtin.ToDate2ARGS)[datetime] - scope-148 Operator Key: scope-148) children: null at []]: java.lang.IllegalArgumentException: Invalid format: "Thu Jun 11 16:41:35 +0000 2015"

怎么了?我正在使用 Pig 版本 0.15。感谢任何帮助。谢谢!

将日期时间格式与输入的日期时间字符串匹配。像这样。

ToDate(user_created_at, 'EEE MMM dd HH:mm:ss Z yyyy')