Skip to content

Conversation

@yhuai
Copy link
Contributor

@yhuai yhuai commented May 25, 2016

What changes were proposed in this pull request?

This PR add a rule at the end of analyzer to correct nullable fields of attributes in a logical plan by using nullable fields of the corresponding attributes in its children logical plans (these plans generate the input rows).

This is another approach for addressing SPARK-13484 (the first approach is #11371).

Close #113711

@SparkQA
Copy link

SparkQA commented May 25, 2016

Test build #59259 has finished for PR 13290 at commit 3cec4cc.

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

@SparkQA
Copy link

SparkQA commented May 25, 2016

Test build #59261 has finished for PR 13290 at commit fff3382.

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

val childrenOutput = q.children.flatMap(c => c.output).groupBy(_.exprId).flatMap {
case (exprId, attributes) =>
// If there are multiple Attributes having the same ExpirId, we need to resolve
// the conflict of nullable field.
Copy link
Member

Choose a reason for hiding this comment

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

Is this case is a possible state, output attributes with the same exprId and different nullability in children?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel it is not very possible. Let me think about it more.

@SparkQA
Copy link

SparkQA commented May 26, 2016

Test build #59334 has finished for PR 13290 at commit 127024d.

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

@yhuai
Copy link
Contributor Author

yhuai commented May 31, 2016

test this please

@SparkQA
Copy link

SparkQA commented May 31, 2016

Test build #59658 has finished for PR 13290 at commit 127024d.

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

case p if !p.resolved => p // Skip unresolved nodes.
case p: LogicalPlan if p.resolved =>
val childrenOutput = p.children.flatMap(c => c.output).groupBy(_.exprId).flatMap {
case (exprId, attributes) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

When will this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think with our current implementation, it will not happen.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then should we just put an assert/require here?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure we should add assert. Even when we hit that case, it is still fine to pass at here, right?

@yhuai yhuai changed the title [SQL] Prevent illegal NULL propagation when filtering outer-join results [SPARK-13484] [SQL] Prevent illegal NULL propagation when filtering outer-join results May 31, 2016
val childrenOutput = p.children.flatMap(c => c.output).groupBy(_.exprId).flatMap {
case (exprId, attributes) =>
// If there are multiple Attributes having the same ExprId, we need to resolve
// the conflict of nullable field.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe attributes.exist(_.nullable)?

@liancheng
Copy link
Contributor

LGTM except for a few minor comments.

@maropu
Copy link
Member

maropu commented Jun 1, 2016

@yhuai LGTM. Could you add 'Close #113711' in a commit log if this pr merged into master?

@cloud-fan
Copy link
Contributor

LGTM

@SparkQA
Copy link

SparkQA commented Jun 2, 2016

Test build #59780 has finished for PR 13290 at commit 071b670.

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

@liancheng
Copy link
Contributor

Merging to master and branch-2.0.

asfgit pushed a commit that referenced this pull request Jun 2, 2016
…ter-join results

## What changes were proposed in this pull request?
This PR add a rule at the end of analyzer to correct nullable fields of attributes in a logical plan by using nullable fields of the corresponding attributes in its children logical plans (these plans generate the input rows).

This is another approach for addressing SPARK-13484 (the first approach is #11371).

Close #113711

Author: Takeshi YAMAMURO <linguin.m.s@gmail.com>
Author: Yin Huai <yhuai@databricks.com>

Closes #13290 from yhuai/SPARK-13484.

(cherry picked from commit 5eea332)
Signed-off-by: Cheng Lian <lian@databricks.com>
@asfgit asfgit closed this in 5eea332 Jun 2, 2016
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.

5 participants