Skip to content

Conversation

@rxin
Copy link
Contributor

@rxin rxin commented Dec 14, 2016

What changes were proposed in this pull request?

This is a bug introduced by subquery handling. numberedTreeString (which uses generateTreeString under the hood) numbers trees including innerChildren (used to print subqueries), but apply (which uses getNodeNumbered) ignores innerChildren. As a result, apply(i) would return the wrong plan node if there are subqueries.

This patch fixes the bug.

How was this patch tested?

Added a test case in SubquerySuite.scala to test both the depth-first traversal of numbering as well as making sure the two methods are consistent.


if (depth > 0) {
lastChildren.init.foreach { isLast =>
val prefixFragment = if (isLast) " " else ": "
Copy link
Contributor Author

Choose a reason for hiding this comment

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

all these variable names are pretty confusing, so I got rid of all of them.

@rxin
Copy link
Contributor Author

rxin commented Dec 14, 2016

cc @yhuai @liancheng @davies

children.init.foreach(
_.generateTreeString(depth + 1, lastChildren :+ false, builder, verbose, prefix))
children.last.generateTreeString(depth + 1, lastChildren :+ true, builder, verbose, prefix)
children.init.foreach(_.generateTreeString(
Copy link
Contributor Author

@rxin rxin Dec 14, 2016

Choose a reason for hiding this comment

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

i re-arranged this so it looks exactly the same as the way we traverse innerChildren (just 4 lines up) to make it more obvious.

@SparkQA
Copy link

SparkQA commented Dec 14, 2016

Test build #70125 has started for PR 16277 at commit e79306f.

@yhuai
Copy link
Contributor

yhuai commented Dec 14, 2016

LGTM

@SparkQA
Copy link

SparkQA commented Dec 14, 2016

Test build #3496 has finished for PR 16277 at commit e79306f.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 14, 2016

Test build #3497 has finished for PR 16277 at commit e79306f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@asfgit asfgit closed this in ffdd1fc Dec 15, 2016
asfgit pushed a commit that referenced this pull request Dec 15, 2016
…ubqueries

## What changes were proposed in this pull request?
This is a bug introduced by subquery handling. numberedTreeString (which uses generateTreeString under the hood) numbers trees including innerChildren (used to print subqueries), but apply (which uses getNodeNumbered) ignores innerChildren. As a result, apply(i) would return the wrong plan node if there are subqueries.

This patch fixes the bug.

## How was this patch tested?
Added a test case in SubquerySuite.scala to test both the depth-first traversal of numbering as well as making sure the two methods are consistent.

Author: Reynold Xin <rxin@databricks.com>

Closes #16277 from rxin/SPARK-18854.

(cherry picked from commit ffdd1fc)
Signed-off-by: Reynold Xin <rxin@databricks.com>
asfgit pushed a commit that referenced this pull request Dec 15, 2016
…ubqueries

This is a bug introduced by subquery handling. numberedTreeString (which uses generateTreeString under the hood) numbers trees including innerChildren (used to print subqueries), but apply (which uses getNodeNumbered) ignores innerChildren. As a result, apply(i) would return the wrong plan node if there are subqueries.

This patch fixes the bug.

Added a test case in SubquerySuite.scala to test both the depth-first traversal of numbering as well as making sure the two methods are consistent.

Author: Reynold Xin <rxin@databricks.com>

Closes #16277 from rxin/SPARK-18854.

(cherry picked from commit ffdd1fc)
Signed-off-by: Reynold Xin <rxin@databricks.com>
robert3005 pushed a commit to palantir/spark that referenced this pull request Dec 15, 2016
…ubqueries

## What changes were proposed in this pull request?
This is a bug introduced by subquery handling. numberedTreeString (which uses generateTreeString under the hood) numbers trees including innerChildren (used to print subqueries), but apply (which uses getNodeNumbered) ignores innerChildren. As a result, apply(i) would return the wrong plan node if there are subqueries.

This patch fixes the bug.

## How was this patch tested?
Added a test case in SubquerySuite.scala to test both the depth-first traversal of numbering as well as making sure the two methods are consistent.

Author: Reynold Xin <rxin@databricks.com>

Closes apache#16277 from rxin/SPARK-18854.
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…ubqueries

## What changes were proposed in this pull request?
This is a bug introduced by subquery handling. numberedTreeString (which uses generateTreeString under the hood) numbers trees including innerChildren (used to print subqueries), but apply (which uses getNodeNumbered) ignores innerChildren. As a result, apply(i) would return the wrong plan node if there are subqueries.

This patch fixes the bug.

## How was this patch tested?
Added a test case in SubquerySuite.scala to test both the depth-first traversal of numbering as well as making sure the two methods are consistent.

Author: Reynold Xin <rxin@databricks.com>

Closes apache#16277 from rxin/SPARK-18854.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants