vitess.io/vitess@v0.16.2/go/vt/vtgate/planbuilder/concatenateGen4.go (about) 1 /* 2 Copyright 2021 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package planbuilder 18 19 import ( 20 "vitess.io/vitess/go/vt/sqlparser" 21 "vitess.io/vitess/go/vt/vterrors" 22 "vitess.io/vitess/go/vt/vtgate/engine" 23 "vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext" 24 "vitess.io/vitess/go/vt/vtgate/semantics" 25 ) 26 27 type concatenateGen4 struct { 28 sources []logicalPlan 29 30 // These column offsets do not need to be typed checked - they usually contain weight_string() 31 // columns that are not going to be returned to the user 32 noNeedToTypeCheck []int 33 } 34 35 var _ logicalPlan = (*concatenateGen4)(nil) 36 37 // Order implements the logicalPlan interface 38 func (c *concatenateGen4) Order() int { 39 panic("implement me") 40 } 41 42 // ResultColumns implements the logicalPlan interface 43 func (c *concatenateGen4) ResultColumns() []*resultColumn { 44 panic("implement me") 45 } 46 47 // Reorder implements the logicalPlan interface 48 func (c *concatenateGen4) Reorder(order int) { 49 panic("implement me") 50 } 51 52 // Wireup implements the logicalPlan interface 53 func (c *concatenateGen4) Wireup(plan logicalPlan, jt *jointab) error { 54 panic("implement me") 55 } 56 57 // WireupGen4 implements the logicalPlan interface 58 func (c *concatenateGen4) WireupGen4(ctx *plancontext.PlanningContext) error { 59 for _, source := range c.sources { 60 err := source.WireupGen4(ctx) 61 if err != nil { 62 return err 63 } 64 } 65 return nil 66 } 67 68 // SupplyVar implements the logicalPlan interface 69 func (c *concatenateGen4) SupplyVar(from, to int, col *sqlparser.ColName, varname string) { 70 panic("implement me") 71 } 72 73 // SupplyCol implements the logicalPlan interface 74 func (c *concatenateGen4) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colNumber int) { 75 panic("implement me") 76 } 77 78 // SupplyWeightString implements the logicalPlan interface 79 func (c *concatenateGen4) SupplyWeightString(colNumber int, alsoAddToGroupBy bool) (weightcolNumber int, err error) { 80 panic("implement me") 81 } 82 83 // Primitive implements the logicalPlan interface 84 func (c *concatenateGen4) Primitive() engine.Primitive { 85 var sources []engine.Primitive 86 for _, source := range c.sources { 87 sources = append(sources, source.Primitive()) 88 } 89 90 return engine.NewConcatenate(sources, c.noNeedToTypeCheck) 91 } 92 93 // Rewrite implements the logicalPlan interface 94 func (c *concatenateGen4) Rewrite(inputs ...logicalPlan) error { 95 if len(inputs) != len(c.sources) { 96 return vterrors.VT13001("concatenateGen4: wrong number of inputs") 97 } 98 c.sources = inputs 99 return nil 100 } 101 102 // ContainsTables implements the logicalPlan interface 103 func (c *concatenateGen4) ContainsTables() semantics.TableSet { 104 var tableSet semantics.TableSet 105 for _, source := range c.sources { 106 tableSet = tableSet.Merge(source.ContainsTables()) 107 } 108 return tableSet 109 } 110 111 // Inputs implements the logicalPlan interface 112 func (c *concatenateGen4) Inputs() []logicalPlan { 113 return c.sources 114 } 115 116 // OutputColumns implements the logicalPlan interface 117 func (c *concatenateGen4) OutputColumns() []sqlparser.SelectExpr { 118 return c.sources[0].OutputColumns() 119 }