Skip to content

Commit

Permalink
Reuse Compile for prepare (#17647)
Browse files Browse the repository at this point in the history
Reuse Compile for prepare

Approved by: @badboynt1, @daviszhen
  • Loading branch information
ouyuanning authored Jul 23, 2024
1 parent dcf1332 commit f3a1ec7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 0 additions & 7 deletions pkg/frontend/mysql_cmd_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1084,13 +1084,6 @@ func createPrepareStmt(
comp.Release()
comp = nil
}

// @xxx when refactor prepare finish, remove this code
if comp != nil {
comp.SetIsPrepare(false)
comp.Release()
comp = nil
}
}

prepareStmt := &PrepareStmt{
Expand Down
9 changes: 9 additions & 0 deletions pkg/sql/compile/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ func (s *Scope) Run(c *Compile) (err error) {
if s.DataSource.isConst {
_, err = p.ConstRun(s.DataSource.Bat, s.Proc)
} else {
if s.DataSource.R == nil {
s.NodeInfo.Data = s.NodeInfo.Data[:0]
readers, _, err := s.getReaders(c, 1)
if err != nil {
return err
}
s.DataSource.R = readers[0]
}

var tag int32
if s.DataSource.node != nil && len(s.DataSource.node.RecvMsgList) > 0 {
tag = s.DataSource.node.RecvMsgList[0].MsgTag
Expand Down

0 comments on commit f3a1ec7

Please sign in to comment.