Skip to content
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

plan: fix a bug when eliminating projection #7257

Merged
merged 4 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions executor/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,8 @@ func (s *testSuite) TestUpdate(c *C) {
tk.MustExec("CREATE TABLE `t` ( `c1` year DEFAULT NULL, `c2` year DEFAULT NULL, `c3` date DEFAULT NULL, `c4` datetime DEFAULT NULL, KEY `idx` (`c1`,`c2`))")
_, err = tk.Exec("UPDATE t SET c2=16777215 WHERE c1>= -8388608 AND c1 < -9 ORDER BY c1 LIMIT 2")
c.Assert(err.Error(), Equals, "cannot convert datum from bigint to type year.")

tk.MustExec("update (select * from t) t set c1 = 1111111")
}

// TestUpdateCastOnlyModifiedValues for issue #4514.
Expand Down
6 changes: 2 additions & 4 deletions plan/rule_eliminate_projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ func eliminatePhysicalProjection(p PhysicalPlan) PhysicalPlan {
newRoot := doPhysicalProjectionElimination(p)
newCols := newRoot.Schema().Columns
for i, oldCol := range oldSchema.Columns {
newCols[i].DBName = oldCol.DBName
newCols[i].TblName = oldCol.TblName
newCols[i].ColName = oldCol.ColName
newCols[i].OrigTblName = oldCol.OrigTblName
oldCol.Index = newCols[i].Index
newRoot.Schema().Columns[i] = oldCol
}
return newRoot
}
Expand Down