-
Notifications
You must be signed in to change notification settings - Fork 139
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
Implement SQL validation based on grammar element #3039
Merged
ykmr1224
merged 14 commits into
opensearch-project:main
from
ykmr1224:limit-sql-grammar
Sep 23, 2024
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
562113b
Implement SQL validation based on grammar element
ykmr1224 d77e408
Add function types
ykmr1224 c9f960f
fix style
ykmr1224 9665a62
Add security lake
ykmr1224 9fafcb9
Add File support
ykmr1224 424be12
Integrate into SparkQueryDispatcher
ykmr1224 7dde72a
Fix style
ykmr1224 71cfa18
Add tests
ykmr1224 57a5289
Integration
ykmr1224 11ca4ff
Add comments
ykmr1224 d31bdc8
Address comments
ykmr1224 683126e
Allow join types for now
ykmr1224 4e8a02c
Fix style
ykmr1224 b0e545e
Fix coverage check
ykmr1224 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,7 +130,7 @@ jacocoTestCoverageVerification { | |
} | ||
limit { | ||
counter = 'BRANCH' | ||
minimum = 1.0 | ||
minimum = 0.9 | ||
} | ||
} | ||
} | ||
|
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
13 changes: 13 additions & 0 deletions
13
...core/src/main/java/org/opensearch/sql/spark/validator/DefaultGrammarElementValidator.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,13 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.validator; | ||
|
||
public class DefaultGrammarElementValidator implements GrammarElementValidator { | ||
@Override | ||
public boolean isValid(GrammarElement element) { | ||
return true; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ore/src/main/java/org/opensearch/sql/spark/validator/DenyListGrammarElementValidator.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,19 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.validator; | ||
|
||
import java.util.Set; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class DenyListGrammarElementValidator implements GrammarElementValidator { | ||
private final Set<GrammarElement> denyList; | ||
|
||
@Override | ||
public boolean isValid(GrammarElement element) { | ||
return !denyList.contains(element); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Reduced since there was a branch which could not be covered due to Spark SQL grammar.
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.
Can we add it to the exclude list above instead of reducing this on entire module?