雅典娜中的Geeting无效\u cast\u参数错误(Presto)
我对sql非常陌生,我正在尝试一个简单的查询雅典娜中的Geeting无效\u cast\u参数错误(Presto),presto,Presto,我对sql非常陌生,我正在尝试一个简单的查询 select *, max(cast(version_date as date)) over (partition by id) mx_dt, min(cast(version_date as date)) over (partition by id) min_dt from "raw_data"."raw_brands"; 但我得到了这个错误: AWS Athena客户端引发了一个错误。无效
select
*,
max(cast(version_date as date)) over (partition by id) mx_dt,
min(cast(version_date as date)) over (partition by id) min_dt
from "raw_data"."raw_brands";
但我得到了这个错误:
AWS Athena客户端引发了一个错误。无效的\u CAST \u参数:迄今为止无法转换值:2020-01-16 19:09:25.086223有一些方法
presto> select date(date_parse('2020-01-16 19:09:25.086223', '%Y-%m-%d %H:%i:%s.%f'));
_col0
------------
2020-01-16
presto> select cast(date_parse('2020-01-16 19:09:25.086223', '%Y-%m-%d %H:%i:%s.%f') as date);
_col0
------------
2020-01-16
有一些方法
presto> select date(date_parse('2020-01-16 19:09:25.086223', '%Y-%m-%d %H:%i:%s.%f'));
_col0
------------
2020-01-16
presto> select cast(date_parse('2020-01-16 19:09:25.086223', '%Y-%m-%d %H:%i:%s.%f') as date);
_col0
------------
2020-01-16
presto> select cast(substr('2020-01-16 19:09:25.086223', 1, 10) as date);
_col0
------------
2020-01-16