github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/colexec/value_scan/value_scan.go (about) 1 // Copyright 2021-2023 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package value_scan 16 17 import ( 18 "bytes" 19 20 "github.com/matrixorigin/matrixone/pkg/vm" 21 "github.com/matrixorigin/matrixone/pkg/vm/process" 22 ) 23 24 const argName = "value_scan" 25 26 func (arg *Argument) String(buf *bytes.Buffer) { 27 buf.WriteString(argName) 28 buf.WriteString(": value_scan ") 29 } 30 31 func (arg *Argument) Prepare(proc *process.Process) (err error) { 32 return nil 33 } 34 35 func (arg *Argument) Call(proc *process.Process) (vm.CallResult, error) { 36 if err, isCancel := vm.CancelCheck(proc); isCancel { 37 return vm.CancelResult, err 38 } 39 40 result := vm.NewCallResult() 41 42 //select { 43 //case <-proc.Ctx.Done(): 44 // result.Status = vm.ExecStop 45 // return result, proc.Ctx.Err() 46 //default: 47 //} 48 49 if arg.idx < len(arg.Batchs) { 50 result.Batch = arg.Batchs[arg.idx] 51 if arg.idx > 0 { 52 proc.PutBatch(arg.Batchs[arg.idx-1]) 53 arg.Batchs[arg.idx-1] = nil 54 } 55 arg.idx += 1 56 } 57 58 return result, nil 59 }