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