小编noo*_*erp的帖子

Amazon Athena:将 bigint 时间戳转换为可读时间戳

我正在使用 Athena 查询以 bigInt 格式存储的日期。我想将其转换为友好的时间戳。

我试过了:

    from_unixtime(timestamp DIV 1000) AS readableDate
Run Code Online (Sandbox Code Playgroud)

     to_timestamp((timestamp::bigInt)/1000, 'MM/DD/YYYY HH24:MI:SS') at time zone 'UTC' as readableDate
Run Code Online (Sandbox Code Playgroud)

我收到了两者的错误。我是 AWS 的新手。请帮忙!

sql amazon-web-services presto amazon-athena

8
推荐指数
1
解决办法
1万
查看次数

postgreSQL 中的 CASE 不允许使用返回集合的函数

我正在尝试运行此查询,直到不久前才能够运行。我不知道出了什么问题,我现在开始收到此错误?

Your database returned: ERROR: set-returning functions are not allowed in CASE Hint: You might be able to move the set-returning function into a LATERAL FROM item.

我的查询:

SELECT distinct
(CASE
WHEN {PERIOD} = 'Previous Quarter' AND pto.pto_start_date < (date_trunc('quarter', now() - INTERVAL '1 month') + INTERVAL '1 month')::date AND pto.pto_end_date >= (date_trunc('quarter', now() - INTERVAL '1 month') + INTERVAL '1 month')::date
THEN generate_series(pto.pto_start_date, pto.pto_end_date, '2 day'::interval)
WHEN {PERIOD} = 'Current Quarter' AND pto.pto_start_date < (date_trunc('quarter', now() - INTERVAL '1 …
Run Code Online (Sandbox Code Playgroud)

sql postgresql sql-function generate-series chartio

4
推荐指数
1
解决办法
7047
查看次数

Presto SQL:TO_UNIXTIME

我想将可读的时间戳转换为 UNIX 时间。

例如:我想转换2018-08-24 18:42:161535136136000.

这是我的语法:

    TO_UNIXTIME('2018-08-24 06:42:16') new_year_ut
Run Code Online (Sandbox Code Playgroud)

我的错误是:

   SYNTAX_ERROR: line 1:77: Unexpected parameters (varchar(19)) for function to_unixtime. Expected: to_unixtime(timestamp) , to_unixtime(timestamp with time zone)
Run Code Online (Sandbox Code Playgroud)

amazon-web-services presto amazon-athena trino

3
推荐指数
1
解决办法
1万
查看次数