-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(static): static select support (#3369)
* feat(static): static select support static queries now support arbitrary select expressions.
- Loading branch information
1 parent
a7a7309
commit e4b3275
Showing
15 changed files
with
1,355 additions
and
582 deletions.
There are no files selected for viewing
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
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
46 changes: 46 additions & 0 deletions
46
ksql-engine/src/main/java/io/confluent/ksql/analyzer/ContinuousQueryValidator.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2019 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.analyzer; | ||
|
||
import io.confluent.ksql.parser.tree.Query; | ||
import io.confluent.ksql.parser.tree.ResultMaterialization; | ||
import io.confluent.ksql.parser.tree.Sink; | ||
import io.confluent.ksql.util.KsqlException; | ||
import java.util.Optional; | ||
|
||
public class ContinuousQueryValidator implements QueryValidator { | ||
|
||
@Override | ||
public void preValidate( | ||
final Query query, | ||
final Optional<Sink> sink | ||
) { | ||
if (query.isStatic()) { | ||
throw new IllegalArgumentException("static"); | ||
} | ||
|
||
if (query.getResultMaterialization() != ResultMaterialization.CHANGES) { | ||
throw new KsqlException("Continuous queries do not yet support `EMIT FINAL`. " | ||
+ "Consider changing to `EMIT CHANGES`." | ||
+ QueryAnalyzer.NEW_QUERY_SYNTAX_HELP | ||
); | ||
} | ||
} | ||
|
||
@Override | ||
public void postValidate(final Analysis analysis) { | ||
} | ||
} |
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
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
30 changes: 30 additions & 0 deletions
30
ksql-engine/src/main/java/io/confluent/ksql/analyzer/QueryValidator.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2019 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.analyzer; | ||
|
||
import io.confluent.ksql.parser.tree.Query; | ||
import io.confluent.ksql.parser.tree.Sink; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Validator used by {@link QueryAnalyzer}. | ||
*/ | ||
interface QueryValidator { | ||
|
||
void preValidate(Query query, Optional<Sink> sink); | ||
|
||
void postValidate(Analysis analysis); | ||
} |
Oops, something went wrong.