-
Notifications
You must be signed in to change notification settings - Fork 181
adding capability in SQLQueryUtils to identify if SQL query is for creating a table or not. #4029
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
Conversation
Signed-off-by: Mayank Aggarwal <[email protected]>
Signed-off-by: Mayank Aggarwal <[email protected]>
penghuo
left a comment
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.
@ykmr1224 Please take another look.
| statement.accept(visitor); | ||
|
|
||
| // Remove duplicate table names | ||
| List<FullyQualifiedTableName> uniqueFullyQualifiedTableName = new LinkedList<>(); |
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.
nit: let's put s at the end of the variable name (since it is a list)
| new SqlBaseParser( | ||
| new CommonTokenStream(new SqlBaseLexer(new CaseInsensitiveCharStream(sqlQuery)))); | ||
| sqlBaseParser.addErrorListener(new SyntaxAnalysisErrorListener()); | ||
| return extractFullyQualifiedTableNamesWithMetadata(sqlQuery).getFullyQualifiedTableNames(); |
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.
Would it actually avoid parsing query twice?
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.
yes, users can use any of the method as per their requirement and the same visitor "SparkSqlTableNameVisitor" can be used
Signed-off-by: Mayank Aggarwal <[email protected]>
…eating a table or not. (#4029) * adding capability to identify if SQL query is create table or not Signed-off-by: Mayank Aggarwal <[email protected]> * fixing codestyle violations Signed-off-by: Mayank Aggarwal <[email protected]> * updating variable name Signed-off-by: Mayank Aggarwal <[email protected]> --------- Signed-off-by: Mayank Aggarwal <[email protected]> Co-authored-by: Mayank Aggarwal <[email protected]> (cherry picked from commit 5cb5181) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-4029-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5cb51814ed1bb527c47a5e827c773a1899c081e9
# Push it to GitHub
git push --set-upstream origin backport/backport-4029-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.xThen, create a pull request where the |
|
Need manual backport. |
…eating a table or not. (opensearch-project#4029) * adding capability to identify if SQL query is create table or not Signed-off-by: Mayank Aggarwal <[email protected]> * fixing codestyle violations Signed-off-by: Mayank Aggarwal <[email protected]> * updating variable name Signed-off-by: Mayank Aggarwal <[email protected]> --------- Signed-off-by: Mayank Aggarwal <[email protected]> Co-authored-by: Mayank Aggarwal <[email protected]>
…eating a table or not. (opensearch-project#4029) * adding capability to identify if SQL query is create table or not Signed-off-by: Mayank Aggarwal <[email protected]> * fixing codestyle violations Signed-off-by: Mayank Aggarwal <[email protected]> * updating variable name Signed-off-by: Mayank Aggarwal <[email protected]> --------- Signed-off-by: Mayank Aggarwal <[email protected]> Co-authored-by: Mayank Aggarwal <[email protected]> Signed-off-by: Paras jaggi <[email protected]>
…eating a table or not. (#4029) (#5007) * adding capability to identify if SQL query is create table or not * fixing codestyle violations * updating variable name --------- Signed-off-by: Mayank Aggarwal <[email protected]> Signed-off-by: Paras jaggi <[email protected]> Co-authored-by: Mayank Aggarwal <[email protected]> Co-authored-by: Mayank Aggarwal <[email protected]>
Description
[Describe what this change achieves]
adding capability in SQLQueryUtils to identify if SQL query is for creating a table or not.
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
NA
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.