-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support table identifier contains dot with backticks #768
Conversation
Signed-off-by: Lantao Jin <[email protected]>
Signed-off-by: Lantao Jin <[email protected]>
Signed-off-by: Lantao Jin <[email protected]>
test("test describe FQN table clause") { | ||
val context = new CatalystPlanContext | ||
val logPlan = | ||
planTransformer.visit(plan(pplParser, "describe schema.default.http_logs"), context) | ||
planTransformer.visit(plan(pplParser, "describe catalog.schema.http_logs"), context) |
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.
This PR also fixes a bug of describe
command.
The pattern catalog.schema.table
will be converted to
TableIdentifier(table, Some(schema), Some(catalog))
Without patch, it was TableIdentifier(table, Some(catalog), Some(schema))
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.
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.
@LantaoJin nice catch - thanks
node.getQualifiedNames().forEach(q -> | ||
// Resolving the qualifiedName which is composed of a datasource.schema.table | ||
context.withRelation(new UnresolvedRelation(seq(of(t.split("\\."))), CaseInsensitiveStringMap.empty(), false)) | ||
context.withRelation(new UnresolvedRelation(getTableIdentifier(q).nameParts(), CaseInsensitiveStringMap.empty(), false)) |
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.
These are the key lines to fix the bug of "dot in backticks"
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.
Replace simple string manipulation with building a Spark TableIdentifier
. This fixing not only could identify a valid pattern catalog.schema.`table.name`
, but also could identify an invalid pattern catalog.schema.table.name
(more than 3 parts and without backticks)
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.
@LantaoJin thanks for the quick fix !!
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/opensearch-spark/backport-0.5 0.5
# Navigate to the new working tree
pushd ../.worktrees/opensearch-spark/backport-0.5
# Create a new branch
git switch --create backport/backport-768-to-0.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 fe5148cb4968917e532a1ddd745a80d4f58e576b
# Push it to GitHub
git push --set-upstream origin backport/backport-768-to-0.5
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/opensearch-spark/backport-0.5 Then, create a pull request where the |
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/opensearch-spark/backport-0.5-nexus 0.5-nexus
# Navigate to the new working tree
pushd ../.worktrees/opensearch-spark/backport-0.5-nexus
# Create a new branch
git switch --create backport/backport-768-to-0.5-nexus
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 fe5148cb4968917e532a1ddd745a80d4f58e576b
# Push it to GitHub
git push --set-upstream origin backport/backport-768-to-0.5-nexus
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/opensearch-spark/backport-0.5-nexus Then, create a pull request where the |
Backport to 0.5-nexus failed. Manually backporting |
Found some other missing commits due to backport failure of other PR, e.g. #743 |
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/opensearch-spark/backport-0.5 0.5
# Navigate to the new working tree
pushd ../.worktrees/opensearch-spark/backport-0.5
# Create a new branch
git switch --create backport/backport-768-to-0.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 fe5148cb4968917e532a1ddd745a80d4f58e576b
# Push it to GitHub
git push --set-upstream origin backport/backport-768-to-0.5
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/opensearch-spark/backport-0.5 Then, create a pull request where the |
Signed-off-by: YANGDB <[email protected]>
…icks (#774) * backport #768 to 0.5-nexus Signed-off-by: YANGDB <[email protected]> * support spark prior to 3.5 with its extended table identifier (existing table identifier only has 2 parts) Signed-off-by: YANGDB <[email protected]> --------- Signed-off-by: YANGDB <[email protected]>
Description
Table name
`_CWLBasic`.default.`Canary/service.log`
is incorrectly converted todefault
+Canary/service
+log
.It should be converted to
_CWLBasic
+default
+Canary/service.log
as long as the table identifier is wrapped by backticks.Issues Resolved
#767
Check List
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.