Pig 转换传递给 pig 脚本的时间戳并使用 replace 函数

Pig converting a time stamp passed to a pig script and using the replace function

REPLACE(ToDate('$current__ts', 'yyyy-MM-dd HH:mm:ss'),'-','') as new_DT,

我正在尝试在 YYYY-mm-dd 之间转换通过删除 - 传递的 current_ts 或时间戳,因此输出应为 yyyyMMdd HH:mm:ss

但我收到错误: 无法推断 org.apache.pig.builtin.REPLACE 的匹配函数,因为它们中有多个或 none 个匹配。请使用显式转换。

我也试过下面同样的错误

REPLACE((datetime)ToDate('$current__ts', 'yyyy-MM-dd HH:mm:ss'),'-','') as new_DT,

ToDate returns a datetime object.REPLACE works on a string. You have to cast the datetime object from the ToDate to a chararray and then use it in the REPLACE function.See ToString

REPLACE(ToString(ToDate('$current__ts', 'yyyy-MM-dd HH:mm:ss')),'-','') as new_DT,