github.com/matrixorigin/matrixone@v0.7.0/pkg/vm/types.go (about) 1 // Copyright 2021 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 vm 16 17 import "github.com/matrixorigin/matrixone/pkg/vm/process" 18 19 const ( 20 Top = iota 21 Limit 22 Order 23 Group 24 Output 25 Offset 26 Product 27 Restrict 28 Dispatch 29 Connector 30 Projection 31 32 Join 33 LoopJoin 34 Left 35 LoopLeft 36 Single 37 LoopSingle 38 Semi 39 LoopSemi 40 Anti 41 LoopAnti 42 Mark 43 LoopMark 44 45 Merge 46 MergeTop 47 MergeLimit 48 MergeOrder 49 MergeGroup 50 MergeOffset 51 52 Deletion 53 Insert 54 Update 55 External 56 57 Minus 58 Intersect 59 IntersectAll 60 61 HashBuild 62 63 TableFunction 64 // MergeBlock is used to recieve S3 block metLoc Info, and write 65 // them to S3 66 MergeBlock 67 // LastInstructionOp is not a true operator and must set at last. 68 // It was used by unit testing to ensure that 69 // all functions related to instructions can reach 100% coverage. 70 LastInstructionOp 71 ) 72 73 // Instruction contains relational algebra 74 type Instruction struct { 75 // Op specified the operator code of an instruction. 76 Op int 77 // Idx specified the analysis information index. 78 Idx int 79 // Arg contains the operand of this instruction. 80 Arg InstructionArgument 81 82 // flag for analyzeInfo record the row information 83 IsFirst bool 84 IsLast bool 85 } 86 87 type InstructionArgument interface { 88 // Free release all the memory allocated from mPool in an operator. 89 // pipelineFailed marks the process status of the pipeline when the method is called. 90 Free(proc *process.Process, pipelineFailed bool) 91 } 92 93 type Instructions []Instruction 94 95 func (ins *Instruction) IsBrokenNode() bool { 96 switch ins.Op { 97 case Order, MergeOrder: 98 return true 99 case Limit, MergeLimit: 100 return true 101 case Offset, MergeOffset: 102 return true 103 case Group, MergeGroup: 104 return true 105 case Top, MergeTop: 106 return true 107 } 108 return false 109 }