Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unix_timestamp() is Error #3221

Closed
luhea opened this issue Mar 26, 2024 · 1 comment · Fixed by #3225
Closed

unix_timestamp() is Error #3221

luhea opened this issue Mar 26, 2024 · 1 comment · Fixed by #3225
Assignees

Comments

@luhea
Copy link

luhea commented Mar 26, 2024

Original Hive SQL:
select
pt_dt,sum(reg_pid_cnt)
from table1
where pt_dt >= date_sub( from_unixtime(unix_timestamp(),'yyyy-MM-dd'),30)
group by pt_dt
order by pt_dt asc
Transpile to Trino or Presto:
SELECT pt_dt, SUM(reg_pid_cnt) FROM table1 WHERE pt_dt >= DATE_ADD('DAY', 30 * -1, CAST(CAST(DATE_FORMAT(FROM_UNIXTIME(TO_UNIXTIME(DATE_PARSE('%Y-%m-%d %T'))), '%Y-%m-%d') AS TIMESTAMP) AS DATE)) GROUP BY pt_dt ORDER BY pt_dt ASC

Can Not to Run In Trino

@luhea luhea changed the title unix_timestamp() is Errio unix_timestamp() is Error Mar 26, 2024
@georgesittas
Copy link
Collaborator

I'll take a look, but it would be appreciated if you included more info in future issues, such as what's the reason the output query fails in the target engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants