Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would this field be set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks pretty weird that the values is set from another repo, can we set it during the induction of parser?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that there is no way to set it correctly here, since the subpart of select stmt will get the offset first. I don't find good ways to set it correctly here.

Comment thread
alivxxx marked this conversation as resolved.
}

// Restore implements Node interface.
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down