-
Notifications
You must be signed in to change notification settings - Fork 298
Support Update join #761
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
base: master
Are you sure you want to change the base?
Support Update join #761
Conversation
# Conflicts: # pkg/datasource/sql/exec/at/base_executor.go # pkg/datasource/sql/exec/at/update_executor_test.go
|
pkg/datasource/sql/conn.go
Outdated
@@ -244,6 +244,10 @@ func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, e | |||
) | |||
} | |||
|
|||
func (c *Conn) GetDbVersion() string { | |||
return c.res.GetDbVersion() |
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.
我认为是需要支持的,不过或许可以提另外的issues分开去做?
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.
done
pkg/datasource/sql/conn.go
Outdated
@@ -244,6 +244,10 @@ func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, e | |||
) | |||
} | |||
|
|||
func (c *Conn) GetDbVersion() string { | |||
return c.res.GetDbVersion() |
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.
Maybe 'c.res' was nil?
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.
另一个issue 进行开发
|
||
// NewUpdateJoinExecutor get executor | ||
func NewUpdateJoinExecutor(parserCtx *types.ParseContext, execContent *types.ExecContext, hooks []exec.SQLHook) executor { | ||
minimumVersion, _ := util.ConvertDbVersion("5.7.5") |
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.
Avoid using the magic value '5.7.5'.
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.
改为配置或是常量的方式定义 version
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.
done
待添加新的issue,读取数据库的元数据,查询版本 |
Merged |
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.
Pull Request Overview
This PR adds support for UPDATE … JOIN statements by introducing a dedicated executor, extending argument traversal, select-field building, and covering the logic with new tests.
- Introduce
updateJoinExecutor
to build before-/after-image SELECTs for joined updates - Route
NewUpdateExecutor
to use the join executor when a JOIN is present - Extend
baseExecutor
with join-aware argument traversal, select-field logic, and a commonrowsPrepare
helper - Add comprehensive unit tests in
update_join_executor_test.go
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/datasource/sql/exec/at/update_join_executor_test.go | New tests for building before-image SQL in UPDATE … JOIN cases |
pkg/datasource/sql/exec/at/update_join_executor.go | Implementation of updateJoinExecutor and SQL builders |
pkg/datasource/sql/exec/at/update_executor.go | Dispatches to join executor when a JOIN clause is detected |
pkg/datasource/sql/exec/at/base_executor.go | Added join argument traversal, select-field builder, and rowsPrepare |
What this PR does:
This pr will support update join
Which issue(s) this PR fixes:
Fixes #703
Special notes for your reviewer:
Does this PR introduce a user-facing change?: