Skip to content

Commit

Permalink
refactor: cleaner cloning API (vitessio#16079)
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
systay authored and harshit-gangal committed Jun 12, 2024
1 parent 087b363 commit 2c3d503
Show file tree
Hide file tree
Showing 34 changed files with 76 additions and 71 deletions.
2 changes: 1 addition & 1 deletion go/test/endtoend/vtgate/queries/random/query_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (t *tableT) addColumns(col ...column) {

func (t *tableT) clone() *tableT {
return &tableT{
tableExpr: sqlparser.CloneSimpleTableExpr(t.tableExpr),
tableExpr: sqlparser.Clone(t.tableExpr),
alias: t.alias,
cols: slices.Clone(t.cols),
}
Expand Down
2 changes: 1 addition & 1 deletion go/test/fuzzing/ast_fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func FuzzEqualsSQLNode(data []byte) int {
}

// Target 2:
newSQLNode := sqlparser.CloneSQLNode(inA)
newSQLNode := sqlparser.Clone(inA)
if !sqlparser.EqualsSQLNode(inA, newSQLNode) {
panic("These two nodes should be identical")
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/schema/online_ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func OnlineDDLFromCommentedStatement(stmt sqlparser.Statement) (onlineDDL *Onlin
// We clone the comments because they will end up being cached by the query planner. Then, the Directive() function actually modifies the comments.
// If comments are shared in cache, and Directive() modifies it, then we have a concurrency issue when someone else wants to read the comments.
// By cloning the comments we remove the concurrency problem.
comments = sqlparser.CloneRefOfParsedComments(comments)
comments = sqlparser.Clone(comments)
comments.ResetDirectives()

if comments.Length() == 0 {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/schemadiff/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func alterOptionCapableOfInstantDDL(alterOption sqlparser.AlterOption, createTab
return true, col.Type.Options.Storage
}
colStringStrippedDown := func(col *sqlparser.ColumnDefinition, stripDefault bool, stripEnum bool) string {
strippedCol := sqlparser.CloneRefOfColumnDefinition(col)
strippedCol := sqlparser.Clone(col)
if stripDefault {
strippedCol.Type.Options.Default = nil
strippedCol.Type.Options.DefaultLiteral = false
Expand Down
10 changes: 5 additions & 5 deletions go/vt/schemadiff/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ func (s *Schema) ValidateViewReferences() error {
schemaInformation.addTable("dual")

for _, view := range s.Views() {
sel := sqlparser.CloneSelectStatement(view.CreateView.Select) // Analyze(), below, rewrites the select; we don't want to actually modify the schema
sel := sqlparser.Clone(view.CreateView.Select) // Analyze(), below, rewrites the select; we don't want to actually modify the schema
_, err := semantics.AnalyzeStrict(sel, semanticKS.Name, schemaInformation)
formalizeErr := func(err error) error {
if err == nil {
Expand Down Expand Up @@ -1079,17 +1079,17 @@ func (s *Schema) getViewColumnNames(v *CreateViewEntity, schemaInformation *decl
case *sqlparser.StarExpr:
if tableName := node.TableName.Name.String(); tableName != "" {
for _, col := range schemaInformation.Tables[tableName].Columns {
name := sqlparser.CloneRefOfIdentifierCI(&col.Name)
columnNames = append(columnNames, name)
name := sqlparser.Clone(col.Name)
columnNames = append(columnNames, &name)
}
} else {
dependentNames := getViewDependentTableNames(v.CreateView)
// add all columns from all referenced tables and views
for _, entityName := range dependentNames {
if schemaInformation.Tables[entityName] != nil { // is nil for dual/DUAL
for _, col := range schemaInformation.Tables[entityName].Columns {
name := sqlparser.CloneRefOfIdentifierCI(&col.Name)
columnNames = append(columnNames, name)
name := sqlparser.Clone(col.Name)
columnNames = append(columnNames, &name)
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions go/vt/schemadiff/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (d *AlterTableEntityDiff) Clone() EntityDiff {
}
ann := *d.annotations
clone := &AlterTableEntityDiff{
alterTable: sqlparser.CloneRefOfAlterTable(d.alterTable),
alterTable: sqlparser.Clone(d.alterTable),
instantDDLCapability: d.instantDDLCapability,
annotations: &ann,
}
Expand Down Expand Up @@ -245,7 +245,7 @@ func (d *CreateTableEntityDiff) Clone() EntityDiff {
return nil
}
clone := &CreateTableEntityDiff{
createTable: sqlparser.CloneRefOfCreateTable(d.createTable),
createTable: sqlparser.Clone(d.createTable),
}
if d.to != nil {
clone.to = d.to.Clone().(*CreateTableEntity)
Expand Down Expand Up @@ -336,7 +336,7 @@ func (d *DropTableEntityDiff) Clone() EntityDiff {
return nil
}
clone := &DropTableEntityDiff{
dropTable: sqlparser.CloneRefOfDropTable(d.dropTable),
dropTable: sqlparser.Clone(d.dropTable),
}
if d.from != nil {
clone.from = d.from.Clone().(*CreateTableEntity)
Expand Down Expand Up @@ -428,7 +428,7 @@ func (d *RenameTableEntityDiff) Clone() EntityDiff {
return nil
}
clone := &RenameTableEntityDiff{
renameTable: sqlparser.CloneRefOfRenameTable(d.renameTable),
renameTable: sqlparser.Clone(d.renameTable),
}
if d.from != nil {
clone.from = d.from.Clone().(*CreateTableEntity)
Expand Down Expand Up @@ -526,7 +526,7 @@ func (c *CreateTableEntity) GetCollation() string {
}

func (c *CreateTableEntity) Clone() Entity {
return &CreateTableEntity{CreateTable: sqlparser.CloneRefOfCreateTable(c.CreateTable), Env: c.Env}
return &CreateTableEntity{CreateTable: sqlparser.Clone(c.CreateTable), Env: c.Env}
}

func getTableCharsetCollate(env *Environment, tableOptions *sqlparser.TableOptions) *charsetCollate {
Expand Down Expand Up @@ -1601,8 +1601,8 @@ func (c *CreateTableEntity) diffKeys(alterTable *sqlparser.AlterTable,
// Returns if this is a visibility only change and if true, whether
// the new visibility is invisible or not.
func indexOnlyVisibilityChange(t1Key, t2Key *sqlparser.IndexDefinition) (bool, bool) {
t1KeyCopy := sqlparser.CloneRefOfIndexDefinition(t1Key)
t2KeyCopy := sqlparser.CloneRefOfIndexDefinition(t2Key)
t1KeyCopy := sqlparser.Clone(t1Key)
t2KeyCopy := sqlparser.Clone(t2Key)
t1KeyKeptOptions := make([]*sqlparser.IndexOption, 0, len(t1KeyCopy.Options))
t2KeyInvisible := false
for _, opt := range t1KeyCopy.Options {
Expand Down
8 changes: 4 additions & 4 deletions go/vt/schemadiff/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (d *AlterViewEntityDiff) Clone() EntityDiff {
return nil
}
clone := &AlterViewEntityDiff{
alterView: sqlparser.CloneRefOfAlterView(d.alterView),
alterView: sqlparser.Clone(d.alterView),
}
if d.from != nil {
clone.from = d.from.Clone().(*CreateViewEntity)
Expand Down Expand Up @@ -200,7 +200,7 @@ func (d *CreateViewEntityDiff) Clone() EntityDiff {
return nil
}
return &CreateViewEntityDiff{
createView: sqlparser.CloneRefOfCreateView(d.createView),
createView: sqlparser.Clone(d.createView),
}
}

Expand Down Expand Up @@ -287,7 +287,7 @@ func (d *DropViewEntityDiff) Clone() EntityDiff {
return nil
}
clone := &DropViewEntityDiff{
dropView: sqlparser.CloneRefOfDropView(d.dropView),
dropView: sqlparser.Clone(d.dropView),
}
if d.from != nil {
clone.from = d.from.Clone().(*CreateViewEntity)
Expand Down Expand Up @@ -402,7 +402,7 @@ func (c *CreateViewEntity) Apply(diff EntityDiff) (Entity, error) {
}

func (c *CreateViewEntity) Clone() Entity {
return &CreateViewEntity{CreateView: sqlparser.CloneRefOfCreateView(c.CreateView)}
return &CreateViewEntity{CreateView: sqlparser.Clone(c.CreateView)}
}

func (c *CreateViewEntity) identicalOtherThanName(other *CreateViewEntity) bool {
Expand Down
5 changes: 5 additions & 0 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2776,3 +2776,8 @@ func (lock Lock) GetHighestOrderLock(newLock Lock) Lock {
}
return lock
}

// Clone returns a deep copy of the SQLNode, typed as the original type
func Clone[K SQLNode](x K) K {
return CloneSQLNode(x).(K)
}
2 changes: 1 addition & 1 deletion go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ func (e *Executor) planPrepareStmt(ctx context.Context, vcursor *vcursorImpl, qu
ctx,
vcursor,
query,
sqlparser.CloneStatement(stmt),
sqlparser.Clone(stmt),
vcursor.marginComments,
map[string]*querypb.BindVariable{},
reservedVars, /* normalize */
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func buildCreateViewCommon(
// because we don't trust the schema tracker to have up-to-date info, we don't want to expand any SELECT * here
var expressions []sqlparser.SelectExprs
_ = sqlparser.VisitAllSelects(ddlSelect, func(p *sqlparser.Select, idx int) error {
expressions = append(expressions, sqlparser.CloneSelectExprs(p.SelectExprs))
expressions = append(expressions, sqlparser.Clone(p.SelectExprs))
return nil
})
selectPlan, err := createInstructionFor(ctx, sqlparser.String(ddlSelect), ddlSelect, reservedVars, vschema, enableOnlineDDL, enableDirectDDL)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/aggregation_pushing.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ func splitAvgAggregations(ctx *plancontext.PlanningContext, aggr *Aggregator) (O

outputColumn := aeWrap(col.Expr)
outputColumn.As = sqlparser.NewIdentifierCI(col.ColumnName())
proj.addUnexploredExpr(sqlparser.CloneRefOfAliasedExpr(col), calcExpr)
proj.addUnexploredExpr(sqlparser.Clone(col), calcExpr)
col.Expr = sumExpr
found := false
for aggrOffset, aggregation := range aggr.Aggregations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (p *joinPusher) countStar(ctx *plancontext.PlanningContext) (*sqlparser.Ali
// It returns the expression of the aggregation as it should be used in the parent Aggregator.
func (p *joinPusher) addAggr(ctx *plancontext.PlanningContext, aggr Aggr) sqlparser.Expr {
copyAggr := aggr
expr := sqlparser.CloneExpr(aggr.Original.Expr)
expr := sqlparser.Clone(aggr.Original.Expr)
copyAggr.Original = aeWrap(expr)
// copy dependencies so we can keep track of which side expressions need to be pushed to
ctx.SemTable.Direct[expr] = p.tableID
Expand All @@ -291,7 +291,7 @@ func (p *joinPusher) pushThroughAggr(aggr Aggr) {
// It returns the expression of the GroupBy as it should be used in the parent Aggregator.
func (p *joinPusher) addGrouping(ctx *plancontext.PlanningContext, gb GroupBy) sqlparser.Expr {
copyGB := gb
expr := sqlparser.CloneExpr(gb.Inner)
expr := sqlparser.Clone(gb.Inner)
// copy dependencies so we can keep track of which side expressions need to be pushed to
ctx.SemTable.CopyDependencies(gb.Inner, expr)
// if the column exists in the selection then copy it down to the pushed aggregator operator.
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/operators/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func createOperatorFromDelete(ctx *plancontext.PlanningContext, deleteStmt *sqlp
return createDeleteWithInputOp(ctx, deleteStmt)
}

delClone := sqlparser.CloneRefOfDelete(deleteStmt)
delClone := sqlparser.Clone(deleteStmt)
var vTbl *vindexes.Table
op, vTbl = createDeleteOperator(ctx, deleteStmt)

Expand Down Expand Up @@ -315,7 +315,7 @@ func addOrdering(ctx *plancontext.PlanningContext, orderBy sqlparser.OrderBy, op
continue
}
ordering.Order = append(ordering.Order, OrderBy{
Inner: sqlparser.CloneRefOfOrder(order),
Inner: sqlparser.Clone(order),
SimplifiedExpr: order.Expr,
})
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/horizon.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func newHorizon(src Operator, query sqlparser.SelectStatement) *Horizon {
func (h *Horizon) Clone(inputs []Operator) Operator {
klone := *h
klone.Source = inputs[0]
klone.ColumnAliases = sqlparser.CloneColumns(h.ColumnAliases)
klone.ColumnAliases = sqlparser.Clone(h.ColumnAliases)
klone.Columns = slices.Clone(h.Columns)
klone.ColumnsOffset = slices.Clone(h.ColumnsOffset)
klone.QP = h.QP
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func createOperatorFromInsert(ctx *plancontext.PlanningContext, ins *sqlparser.I

delStmt := &sqlparser.Delete{
Comments: ins.Comments,
TableExprs: sqlparser.TableExprs{sqlparser.CloneRefOfAliasedTableExpr(ins.Table)},
TableExprs: sqlparser.TableExprs{sqlparser.Clone(ins.Table)},
Where: sqlparser.NewWhere(sqlparser.WhereClause, whereExpr),
}
delOp := createOpFromStmt(ctx, delStmt, false, "")
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Limit struct {
func (l *Limit) Clone(inputs []Operator) Operator {
return &Limit{
Source: inputs[0],
AST: sqlparser.CloneRefOfLimit(l.AST),
AST: sqlparser.Clone(l.AST),
Top: l.Top,
Pushed: l.Pushed,
}
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/operators/phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ func createDMLWithInput(ctx *plancontext.PlanningContext, op, src Operator, in *
targetQT := targetTable.QTable
qt := &QueryTable{
ID: targetQT.ID,
Alias: sqlparser.CloneRefOfAliasedTableExpr(targetQT.Alias),
Table: sqlparser.CloneTableName(targetQT.Table),
Alias: sqlparser.Clone(targetQT.Alias),
Table: sqlparser.Clone(targetQT.Table),
Predicates: []sqlparser.Expr{compExpr},
}

Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type (

func newProjExpr(ae *sqlparser.AliasedExpr) *ProjExpr {
return &ProjExpr{
Original: sqlparser.CloneRefOfAliasedExpr(ae),
Original: sqlparser.Clone(ae),
EvalExpr: ae.Expr,
ColExpr: ae.Expr,
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/projection_pushing.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func splitUnexploredExpression(
alias string,
dt *DerivedTable,
) applyJoinColumn {
original := sqlparser.CloneRefOfAliasedExpr(pe.Original)
original := sqlparser.Clone(pe.Original)
expr := pe.ColExpr

var colName *sqlparser.ColName
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/operators/query_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func planQuery(ctx *plancontext.PlanningContext, root Operator) Operator {
var selExpr sqlparser.SelectExprs
if horizon, isHorizon := root.(*Horizon); isHorizon {
sel := sqlparser.GetFirstSelect(horizon.Query)
selExpr = sqlparser.CloneSelectExprs(sel.SelectExprs)
selExpr = sqlparser.Clone(sel.SelectExprs)
}

output := runPhases(ctx, root)
Expand Down Expand Up @@ -252,7 +252,7 @@ func tryPushLimit(ctx *plancontext.PlanningContext, in *Limit) (Operator, *Apply
}

func createPushedLimit(ctx *plancontext.PlanningContext, src Operator, orig *Limit) Operator {
pushedLimit := sqlparser.CloneRefOfLimit(orig.AST)
pushedLimit := sqlparser.Clone(orig.AST)
if pushedLimit.Offset != nil {
// we can't push down an offset, so we need to convert it to a rowcount
// by adding it to the already existing rowcount, and then let the LIMIT running on the vtgate do the rest
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/operators/querygraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ func (qg *QueryGraph) AddPredicate(ctx *plancontext.PlanningContext, expr sqlpar
func (qt *QueryTable) Clone() *QueryTable {
return &QueryTable{
ID: qt.ID,
Alias: sqlparser.CloneRefOfAliasedTableExpr(qt.Alias),
Table: sqlparser.CloneTableName(qt.Table),
Alias: sqlparser.Clone(qt.Alias),
Table: sqlparser.Clone(qt.Table),
Predicates: qt.Predicates,
IsInfSchema: qt.IsInfSchema,
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/subquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (sq *SubQuery) Clone(inputs []Operator) Operator {
}
klone.JoinColumns = slices.Clone(sq.JoinColumns)
klone.Vars = maps.Clone(sq.Vars)
klone.Predicates = sqlparser.CloneExprs(sq.Predicates)
klone.Predicates = sqlparser.Clone(sq.Predicates)
return &klone
}

Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/subquery_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (sqb *SubQueryBuilder) pullOutValueSubqueries(
outerID semantics.TableSet,
isDML bool,
) (sqlparser.Expr, []*SubQuery) {
original := sqlparser.CloneExpr(expr)
original := sqlparser.Clone(expr)
sqe := extractSubQueries(ctx, expr, isDML)
if sqe == nil {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type (
func (to *Table) Clone([]Operator) Operator {
var columns []*sqlparser.ColName
for _, name := range to.Columns {
columns = append(columns, sqlparser.CloneRefOfColName(name))
columns = append(columns, sqlparser.Clone(name))
}
return &Table{
QTable: to.QTable,
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/operators/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@ func createUpdateOperator(ctx *plancontext.PlanningContext, updStmt *sqlparser.U
// updClone is used in foreign key planning to create the selection statements to be used for verification and selection.
// If we encounter subqueries, we want to fix the updClone to use the replaced expression, so that the pulled out subquery's
// result is used everywhere instead of running the subquery multiple times, which is wasteful.
updClone := sqlparser.CloneRefOfUpdate(updStmt)
updClone := sqlparser.Clone(updStmt)
var tblInfo semantics.TableInfo
var err error
for idx, updExpr := range updStmt.Exprs {
expr, subqs := sqc.pullOutValueSubqueries(ctx, updExpr.Expr, outerID, true)
if len(subqs) == 0 {
expr = updExpr.Expr
} else {
updClone.Exprs[idx].Expr = sqlparser.CloneExpr(expr)
updClone.Exprs[idx].Expr = sqlparser.Clone(expr)
ctx.SemTable.UpdateChildFKExpr(updExpr, expr)
}
proj := newProjExpr(aeWrap(expr))
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/upsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func createUpsertOperator(ctx *plancontext.PlanningContext, ins *sqlparser.Inser
updOp := createOpFromStmt(ctx, upd, false, "")

// replan insert statement without on duplicate key update.
newInsert := sqlparser.CloneRefOfInsert(ins)
newInsert := sqlparser.Clone(ins)
newInsert.OnDup = nil
newInsert.Rows = sqlparser.Values{row}
insOp = createOpFromStmt(ctx, newInsert, false, "")
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/simplifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestSimplifyBuggyQuery(t *testing.T) {
}
stmt, reserved, err := sqlparser.NewTestParser().Parse2(query)
require.NoError(t, err)
rewritten, _ := sqlparser.RewriteAST(sqlparser.CloneStatement(stmt), vschema.CurrentDb(), sqlparser.SQLSelectLimitUnset, "", nil, nil, nil)
rewritten, _ := sqlparser.RewriteAST(sqlparser.Clone(stmt), vschema.CurrentDb(), sqlparser.SQLSelectLimitUnset, "", nil, nil, nil)
reservedVars := sqlparser.NewReservedVars("vtg", reserved)

simplified := simplifier.SimplifyStatement(
Expand All @@ -68,7 +68,7 @@ func TestSimplifyPanic(t *testing.T) {
}
stmt, reserved, err := sqlparser.NewTestParser().Parse2(query)
require.NoError(t, err)
rewritten, _ := sqlparser.RewriteAST(sqlparser.CloneStatement(stmt), vschema.CurrentDb(), sqlparser.SQLSelectLimitUnset, "", nil, nil, nil)
rewritten, _ := sqlparser.RewriteAST(sqlparser.Clone(stmt), vschema.CurrentDb(), sqlparser.SQLSelectLimitUnset, "", nil, nil, nil)
reservedVars := sqlparser.NewReservedVars("vtg", reserved)

simplified := simplifier.SimplifyStatement(
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/semantics/early_rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func (r *earlyRewriter) rewriteAliasesInGroupBy(node sqlparser.Expr, sel *sqlpar
return
}

cursor.Replace(sqlparser.CloneExpr(item.expr))
cursor.Replace(sqlparser.Clone(item.expr))
}
}, nil)

Expand Down
Loading

0 comments on commit 2c3d503

Please sign in to comment.