-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat: Add support for Insert with row alias #15790
Conversation
Signed-off-by: Andres Taylor <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15790 +/- ##
==========================================
- Coverage 68.44% 68.44% -0.01%
==========================================
Files 1558 1558
Lines 195822 196129 +307
==========================================
+ Hits 134032 134233 +201
- Misses 61790 61896 +106 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
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.
Rest looks good to me!
// This is a check to ensure we send the correct query to the database. | ||
// "ActualQuery" should not be part of the plan output, if it does, it means the query was not rewritten correctly. | ||
if ins.Mid != nil { | ||
var mids []string | ||
for _, n := range ins.Mid { | ||
mids = append(mids, sqlparser.String(n)) | ||
} | ||
shardedQuery := ins.Prefix + strings.Join(mids, ", ") + ins.Alias + sqlparser.String(ins.Suffix) | ||
if shardedQuery != ins.Query { | ||
other["ActualQuery"] = shardedQuery | ||
} | ||
} | ||
|
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.
Was this code intended for debugging to see when the sharded query and the original query are different?
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.
I kept this for a reason to fail in future if anything goes wrong in the final query output.
Description
This adds planner support for new insert syntax
insert into t(id, col) values(1, 'apa') as dt(x) on duplicate key col = x
Related Issue(s)
Checklist
Deployment Notes