Presto(AWS Athena)中datefromparts的替代方法是什么
What is the alternative of datefromparts in Presto (AWS Athena)
AWS Athena (Presto DB) 中 datefromparts SQL 函数的最佳性能替代方案是什么?
用例是:
我有日期部分(即日、月和年)并需要这些日期。
您通常会使用 parse_date()
, with the proper format specifiers. If your date is in ISO format, you can directly use from_iso_date()
(or from_iso_timestamp()
).
另一方面,如果你需要提取日期部分,你可以使用extract()
,比如:
extract(hour from current_timestamp)
请注意,Presto 还提供了完整范围的短函数名称,对应于可能的提取部分:year()
、quarter()
、month()
、...
AWS Athena (Presto DB) 中 datefromparts SQL 函数的最佳性能替代方案是什么?
用例是:
我有日期部分(即日、月和年)并需要这些日期。
您通常会使用 parse_date()
, with the proper format specifiers. If your date is in ISO format, you can directly use from_iso_date()
(or from_iso_timestamp()
).
另一方面,如果你需要提取日期部分,你可以使用extract()
,比如:
extract(hour from current_timestamp)
请注意,Presto 还提供了完整范围的短函数名称,对应于可能的提取部分:year()
、quarter()
、month()
、...