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

SQL compilation error when computing watermark in create table with string syntax #257

Closed
mwylde opened this issue Aug 18, 2023 · 0 comments
Labels
bug Something isn't working compilation-error sql Related to the DataFusion SQL integration

Comments

@mwylde
Copy link
Member

mwylde commented Aug 18, 2023

We have two syntaxes for creating an interval:

  • INTERVAL '5' second
  • '5 seconds'

Both work as arguments to window functions:

tumble(interval '5' second)
tumble('5 seconds')

But when performing calculations, only the first style plans in normal expressions:

-- plans
select event_time - interval '5' seconds from stream;
-- errors with "Cannot coerce arithmetic expression Timestamp(Nanosecond, None) - Utf8 to valid types"
select event_time - '5 seconds' from stream;

However, when computing virtual columns of a create table (for example for defining a watermark) both syntaxes plan, but the second one produces a compilation error:

CREATE TABLE (
  ...
  watermark TIMESTAMP GENERATED ALWAYS AS (CAST(timestamp as TIMESTAMP) - '5 seconds'),
error[E0277]: cannot subtract `std::string::String` from `SystemTime`
  --> pipeline/src/main.rs:98:39
   |
98 | ...                   } - "5 seconds".to_string()),
   |                         ^ no implementation for `SystemTime - std::string::String`
   |
@mwylde mwylde added bug Something isn't working sql Related to the DataFusion SQL integration compilation-error labels Aug 18, 2023
@mwylde mwylde closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compilation-error sql Related to the DataFusion SQL integration
Projects
None yet
Development

No branches or pull requests

1 participant