diff --git a/ast/dml.go b/ast/dml.go index 0fd5a5304..9970d80c6 100755 --- a/ast/dml.go +++ b/ast/dml.go @@ -764,6 +764,8 @@ type SelectStmt struct { IsAfterUnionDistinct bool // IsInBraces indicates whether it's a stmt in brace. IsInBraces bool + // QueryBlockOffset indicates the order of this SelectStmt if counted from left to right in the sql text. + QueryBlockOffset int } // Restore implements Node interface. @@ -906,6 +908,14 @@ func (n *SelectStmt) Accept(v Visitor) (Node, bool) { n.TableHints = newHints } + if n.Fields != nil { + node, ok := n.Fields.Accept(v) + if !ok { + return n, false + } + n.Fields = node.(*FieldList) + } + if n.From != nil { node, ok := n.From.Accept(v) if !ok { @@ -922,14 +932,6 @@ func (n *SelectStmt) Accept(v Visitor) (Node, bool) { n.Where = node.(ExprNode) } - if n.Fields != nil { - node, ok := n.Fields.Accept(v) - if !ok { - return n, false - } - n.Fields = node.(*FieldList) - } - if n.GroupBy != nil { node, ok := n.GroupBy.Accept(v) if !ok {