Skip to content

Commit 2bf2c60

Browse files
authored
Get field string concat (#2732)
* GetField.String avoids Sprintf * more avoid sprintf * fix typo
1 parent e00c563 commit 2bf2c60

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

sql/analyzer/fix_exec_indexes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (s *idxScope) addSchema(sch sql.Schema) {
170170
if c.Source == "" {
171171
s.columns = append(s.columns, c.Name)
172172
} else {
173-
s.columns = append(s.columns, fmt.Sprintf("%s.%s", c.Source, c.Name))
173+
s.columns = append(s.columns, c.Source+"."+c.Name)
174174
}
175175
}
176176
}

sql/expression/get_field.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ func (p *GetField) WithChildren(children ...sql.Expression) (sql.Expression, err
163163
func (p *GetField) String() string {
164164
if p.table == "" {
165165
if p.backTickNames {
166-
return fmt.Sprintf("`%s`", p.name)
166+
return "`" + p.name + "`"
167167
}
168168
return p.name
169169
}
170-
return fmt.Sprintf("%s.%s", p.table, p.name)
170+
return p.table + "." + p.name
171171
}
172172

173173
func (p *GetField) DebugString() string {

sql/planbuilder/scope.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package planbuilder
1616

1717
import (
18-
"fmt"
1918
"strings"
2019

2120
ast "github.com/dolthub/vitess/go/vt/sqlparser"
@@ -638,6 +637,6 @@ func (c scopeColumn) String() string {
638637
if c.table == "" {
639638
return c.col
640639
} else {
641-
return fmt.Sprintf("%s.%s", c.table, c.col)
640+
return c.table + "." + c.col
642641
}
643642
}

0 commit comments

Comments
 (0)