Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #380 from erizocosmico/fix/exchange-also-not-process
Browse files Browse the repository at this point in the history
sql/analyzer: also check node if it is not wrapped in query process
  • Loading branch information
ajnavarro committed Sep 25, 2018
2 parents 38ecd5d + 8d879e6 commit 9528594
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions sql/analyzer/parallelize.go
Expand Up @@ -5,17 +5,24 @@ import (
"gopkg.in/src-d/go-mysql-server.v0/sql/plan"
)

func shouldParallelize(node sql.Node) bool {
// Do not try to parallelize index operations.
switch node.(type) {
case *plan.CreateIndex, *plan.DropIndex, *plan.Describe:
return false
default:
return true
}
}

func parallelize(ctx *sql.Context, a *Analyzer, node sql.Node) (sql.Node, error) {
if a.Parallelism <= 1 || !node.Resolved() {
return node, nil
}

if proc, ok := node.(*plan.QueryProcess); ok {
// Do not try to parallelize index operations.
switch proc.Child.(type) {
case *plan.CreateIndex, *plan.DropIndex, *plan.Describe, *plan.DescribeQuery:
return node, nil
}
proc, ok := node.(*plan.QueryProcess)
if (ok && !shouldParallelize(proc.Child)) || !shouldParallelize(node) {
return node, nil
}

node, err := node.TransformUp(func(node sql.Node) (sql.Node, error) {
Expand Down

0 comments on commit 9528594

Please sign in to comment.