File tree Expand file tree Collapse file tree 8 files changed +6
-53
lines changed Expand file tree Collapse file tree 8 files changed +6
-53
lines changed Original file line number Diff line number Diff line change @@ -73,15 +73,6 @@ func (idx *Index) Expressions() []string {
73
73
return exprs
74
74
}
75
75
76
- func (idx * Index ) UnqualifiedExpressions () []string {
77
- exprs := make ([]string , len (idx .Exprs ))
78
- for i , e := range idx .Exprs {
79
- str := e .String ()
80
- exprs [i ] = str [strings .IndexByte (str , '.' )+ 1 :]
81
- }
82
- return exprs
83
- }
84
-
85
76
func (idx * Index ) ExtendedExpressions () []string {
86
77
var exprs []string
87
78
foundCols := make (map [string ]struct {})
Original file line number Diff line number Diff line change 15
15
package analyzer
16
16
17
17
import (
18
- "strings"
19
18
"testing"
20
19
21
20
"github.com/stretchr/testify/require"
@@ -132,26 +131,18 @@ type dummyIdx struct {
132
131
133
132
var _ sql.Index = (* dummyIdx )(nil )
134
133
135
- func (i dummyIdx ) CanSupport (context * sql.Context , r ... sql.Range ) bool {
134
+ func (i * dummyIdx ) CanSupport (context * sql.Context , r ... sql.Range ) bool {
136
135
return true
137
136
}
138
137
139
- func (i dummyIdx ) Expressions () []string {
138
+ func (i * dummyIdx ) Expressions () []string {
140
139
var exprs []string
141
140
for _ , e := range i .expr {
142
141
exprs = append (exprs , e .String ())
143
142
}
144
143
return exprs
145
144
}
146
145
147
- func (i dummyIdx ) UnqualifiedExpressions () []string {
148
- exprs := make ([]string , len (i .expr ))
149
- for i , e := range i .expr {
150
- str := e .String ()
151
- exprs [i ] = str [strings .IndexByte (str , '.' )+ 1 :]
152
- }
153
- return exprs
154
- }
155
146
func (i * dummyIdx ) ID () string { return i .id }
156
147
func (i * dummyIdx ) Database () string { return i .database }
157
148
func (i * dummyIdx ) Table () string { return i .table }
Original file line number Diff line number Diff line change @@ -102,8 +102,6 @@ type Index interface {
102
102
// one expression, it means the index has multiple columns indexed. If it's
103
103
// just one, it means it may be an expression or a column.
104
104
Expressions () []string
105
- // UnqualifiedExpressions returns the indexed expressions without the source.
106
- UnqualifiedExpressions () []string
107
105
// IsUnique returns whether this index is unique
108
106
IsUnique () bool
109
107
// IsSpatial returns whether this index is a spatial index
Original file line number Diff line number Diff line change @@ -188,14 +188,6 @@ func (i testIndex) Expressions() []string {
188
188
return res
189
189
}
190
190
191
- func (i testIndex ) UnqualifiedExpressions () []string {
192
- res := make ([]string , i .numcols )
193
- for i := range res {
194
- res [i ] = fmt .Sprintf ("column_%d" , i )
195
- }
196
- return res
197
- }
198
-
199
191
func (testIndex ) IsUnique () bool {
200
192
return false
201
193
}
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ package sql
16
16
17
17
import (
18
18
"fmt"
19
- "strings"
20
19
"testing"
21
20
22
21
"github.com/stretchr/testify/require"
@@ -445,15 +444,6 @@ func (i dummyIdx) Expressions() []string {
445
444
return exprs
446
445
}
447
446
448
- func (i dummyIdx ) UnqualifiedExpressions () []string {
449
- exprs := make ([]string , len (i .expr ))
450
- for i , e := range i .expr {
451
- str := e .String ()
452
- exprs [i ] = str [strings .IndexByte (str , '.' )+ 1 :]
453
- }
454
- return exprs
455
- }
456
-
457
447
func (i dummyIdx ) ID () string { return i .id }
458
448
func (i dummyIdx ) Database () string { return i .database }
459
449
func (i dummyIdx ) Table () string { return i .table }
Original file line number Diff line number Diff line change @@ -133,9 +133,9 @@ func newRelProps(rel RelExpr) *relProps {
133
133
// idxExprsColumns returns the column names used in an index's expressions.
134
134
// Identifiers are ambiguous.
135
135
func idxExprsColumns (idx sql.Index ) []string {
136
- columns := idx .UnqualifiedExpressions ()
136
+ columns := idx .Expressions ()
137
137
for i := 0 ; i < len (columns ); i ++ {
138
- columns [i ] = strings .ToLower (columns [i ])
138
+ columns [i ] = strings .ToLower (columns [i ][ strings . IndexByte ( columns [ i ], '.' ) + 1 :] )
139
139
}
140
140
return columns
141
141
}
@@ -789,7 +789,7 @@ func sortedColsForRel(rel RelExpr) sql.Schema {
789
789
}
790
790
case * MergeJoin :
791
791
var ret sql.Schema
792
- for _ , e := range r .InnerScan .Table .Index ().UnqualifiedExpressions () {
792
+ for _ , e := range r .InnerScan .Table .Index ().Expressions () {
793
793
// TODO columns can have "." characters, this will miss cases
794
794
ret = append (ret , & sql.Column {
795
795
Name : strings .ToLower (e ),
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package memo
2
2
3
3
import (
4
4
"fmt"
5
- "strings"
6
5
"testing"
7
6
8
7
"github.com/stretchr/testify/require"
@@ -218,14 +217,6 @@ func (i dummyIndex) Expressions() []string {
218
217
return i .cols
219
218
}
220
219
221
- func (i dummyIndex ) UnqualifiedExpressions () []string {
222
- res := make ([]string , len (i .cols ))
223
- for idx , col := range i .cols {
224
- res [idx ] = col [strings .IndexByte (col , '.' )+ 1 :]
225
- }
226
- return res
227
- }
228
-
229
220
func (dummyIndex ) IsUnique () bool {
230
221
return true
231
222
}
Original file line number Diff line number Diff line change @@ -412,7 +412,7 @@ func (b *Builder) getIndexDefs(table sql.Table) sql.IndexDefs {
412
412
constraint = sql .IndexConstraint_Unique
413
413
}
414
414
}
415
- exprs := idx .UnqualifiedExpressions ()
415
+ exprs := idx .Expressions ()
416
416
columns := make ([]sql.IndexColumn , len (exprs ))
417
417
for i , col := range exprs {
418
418
columns [i ] = sql.IndexColumn {Name : col }
You can’t perform that action at this time.
0 commit comments