使用配置单元删除特殊字符

Remove special character using hive

在原始 table 中,日期列已以字符串格式保存(例如,2020-11-19T15:59:30.702+0000)。我需要将其转换为时间戳格式 (2020-11-19 15:59:30.702).

我试过 concat_ws cast(concat_ws('.',from_unixtime(unix_timestamp(regexp_replace('2020-11-19T15:59:30.702+0000','T',''), 'yyyy-MM-ddHH:mm:ss')),REGEXP_REPLACE(split(createdat,'\.')[1],'[^0-9A-Za-z ]+', ''))

如果不需要时区转换(如果一直是+0000时区),去掉T和时区:

 select timestamp(regexp_replace("2020-11-19T15:59:30.702+0000", '^(.+?)T(.+?)\+',' '));

结果:

2020-11-19 15:59:30.702