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

view was able to created even though the syntax is invalid #729

Open
ye11ow opened this issue May 15, 2024 · 3 comments
Open

view was able to created even though the syntax is invalid #729

ye11ow opened this issue May 15, 2024 · 3 comments
Assignees
Labels
bug Something isn't working community Feedback from community

Comments

@ye11ow
Copy link

ye11ow commented May 15, 2024

Describe what's wrong

The user created a view with invalid SQL. Proton doesn't block the request.

How to reproduce

We don't have the original SQL yet but the broken SQL seems to be WHERE time >= (now() - INTERVAL MINUTE)

Error message and/or stacktrace

Show create stream XXX

image

Additional context

@ye11ow ye11ow added the bug Something isn't working label May 15, 2024
@ye11ow ye11ow added the community Feedback from community label May 15, 2024
@jovezhong
Copy link
Contributor

To reproduce this, create an external stream or even a regular stream, then create a view
create view v as select count() from stream where _tp_time>now()- interval '1 minute' Such interval '1 minute' is not supported yet, but the view will be created but cannot be read again. The expected behavior is views with incorrect sql syntax should be created.

@chenziliang chenziliang assigned lizhou1111 and unassigned zliang-min May 17, 2024
@lizhou1111
Copy link
Collaborator

timeplus-OptiPlex-7000 :) create stream test(id int, value int)

CREATE STREAM test
(
  `id` int,
  `value` int
)

Query id: 72725950-684c-49d2-9b07-91843e84e449

Ok.

0 rows in set. Elapsed: 0.124 sec. 

timeplus-OptiPlex-7000 :) insert into test(id, value) values (1, 2)

INSERT INTO test (id, value) FORMAT Values

Query id: edfe1456-0007-453e-bba2-cdb70adb5824

Ok.

1 row in set. Elapsed: 0.009 sec. 

timeplus-OptiPlex-7000 :) insert into test(id, value) values (1, 8)

INSERT INTO test (id, value) FORMAT Values

Query id: 9392862e-7441-4d77-83bb-e3e1a37079fc

Ok.

1 row in set. Elapsed: 0.008 sec. 

timeplus-OptiPlex-7000 :) select count() from test where _tp_time>now()- interval '1 minute'

SELECT
  count()
FROM
  test
WHERE
  _tp_time > (now() - INTERVAL  MINUTE)

Query id: e9fbb28f-7f57-47d1-931e-8074e403208e

┌─count()─┐
│       2 │
└─────────┘
Cancelling query.
Query was cancelled.

1 row in set. Elapsed: 3.330 sec. 

timeplus-OptiPlex-7000 :) create view v as select count() from test where _tp_time>now()- interval '1 minute'

CREATE VIEW v AS
SELECT
  count()
FROM
  test
WHERE
  _tp_time > (now() - INTERVAL  MINUTE)

Query id: e46d6db7-c304-4308-8de9-418d9c66f2ca

Ok.

0 rows in set. Elapsed: 0.010 sec. 

timeplus-OptiPlex-7000 :) select * from v

SELECT
  *
FROM
  v

Query id: d1207fad-5449-49c9-859b-0c9e0916fad2

┌─count()─┐
│       2 │
└─────────┘
Cancelling query.
Query was cancelled.

1 row in set. Elapsed: 3.438 sec. 

timeplus-OptiPlex-7000 :) 

I don't see any problem here, and the interval '1 minute' works well and the view is also ok.Did i miss something?

@ye11ow
Copy link
Author

ye11ow commented May 21, 2024

image

@jovezhong @lizhou1111 if you check the screenshot here, there is no 1 between INTERVAL and MINUTE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community Feedback from community
Projects
None yet
Development

No branches or pull requests

4 participants