-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: better error message when users enter old style syntax for query #3397
Merged
big-andy-coates
merged 16 commits into
confluentinc:master
from
big-andy-coates:static_help
Sep 24, 2019
Merged
fix: better error message when users enter old style syntax for query #3397
big-andy-coates
merged 16 commits into
confluentinc:master
from
big-andy-coates:static_help
Sep 24, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Say a user executes `SELECT * FROM X JOIN Y ON X.ID = Y.ID;` or similar. In older versions of KSQL this would be a streaming join and would work. With the introduction of static queries this example is now a static query, which don't support joins. Hence the user will get the error: `Static queries do not support joins`... which isn't very helpful if you don't know the query syntax has changed. With this PR the output is now: ``` Static queries do not support joins. Did you mean to execute a continuous query? If so, add an 'EMIT CHANGES' clause. Query syntax in KSQL has changed. There are now two broad categories of queries: - Static queries: query the current state of the system, return a result and terminate. - Streaming queries: query the state of the system in motion and will continue to output results until they meet any LIMIT clause criteria or are terminated by the user. 'EMIT CHANGES' is used to indicate a query is continuous and outputs all changes. To turn a static query into a streaming query, as was the default in older versions of KSQL, add `EMIT CHANGES` to the end of the statement before any limit clause. For example, the following are static queries: 'SELECT * FROM X WHERE ROWKEY=Y;' (non-windowed table) 'SELECT * FROM X WHERE ROWKEY=Y AND WINDOWSTART>=Z;' (windowed table) and, the following is a streaming query: 'SELECT * FROM X EMIT CHANGES;' Note: Persistent queries, e.g. `CREATE TABLE AS ...`, currently have an implicit `EMIT CHANGES`. However, it is recommended to add `EMIT CHANGES` to such statements going forward, as a this will be required in a future release. ```
@JimGalasyn, fancy correctly my terrible english in the above message? :D |
vcrfxia
approved these changes
Sep 23, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @big-andy-coates -- this is great!
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/ContinuousQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
…sQueryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
reviewed
Sep 23, 2019
ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Outdated
Show resolved
Hide resolved
JimGalasyn
approved these changes
Sep 23, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with a few suggestions.
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
…ryValidator.java Co-Authored-By: Jim Galasyn <[email protected]>
# Conflicts: # ksql-engine/src/main/java/io/confluent/ksql/analyzer/StaticQueryValidator.java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Say a user executes
SELECT * FROM X JOIN Y ON X.ID = Y.ID;
or similar. In older versions of KSQL this would be a streaming join and would work. With the introduction of static queries this example is now a static query, which don't support joins. Hence the user will get the error:Static queries do not support joins
... which isn't very helpful if you don't know the query syntax has changed. With this PR the output is now:Testing done
usual
Reviewer checklist