The Wayback Machine - https://web.archive.org/web/20201101004319/https://github.com/cube-js/cube.js/issues/669
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

Interval based refreshKey creates invalid SQL statement for ClickHouse DB #669

Open
ralfbecher opened this issue May 26, 2020 · 1 comment
Open

Comments

@ralfbecher
Copy link

@ralfbecher ralfbecher commented May 26, 2020

Describe the bug
An interval based refreshKey defined as

  refreshKey: {
    every: '5 seconds'
  }

creates this PostgreSQL dialect SQL statement:

SELECT FLOOR(EXTRACT(EPOCH FROM NOW()) / 5)

This gets an Syntax error: failed at position 28: FROM NOW()) / 5) in ClickHouse.

The valid SQL statement for ClickHouse would be something like this:

SELECT floor(toUInt64(now()) / 5)

Version:
0.19.19

@ralfbecher ralfbecher changed the title Interval based refreshKey creates invalid SQL statement for ClichHouse DB Interval based refreshKey creates invalid SQL statement for ClickHouse DB May 26, 2020
@paveltiunov
Copy link
Contributor

@paveltiunov paveltiunov commented May 26, 2020

@ralfbecher Thanks for posting this! Yep. Solution is to add unixTimestampSql() method override in ClickHouseQuery similar to:

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.