Skip to content

Conversation

@rxin
Copy link
Contributor

@rxin rxin commented Jun 14, 2017

What changes were proposed in this pull request?

This patch moves constraint related code into a separate trait QueryPlanConstraints, so we don't litter QueryPlan with a lot of constraint private functions.

How was this patch tested?

This is a simple move refactoring and should be covered by existing tests.

private lazy val aliasMap: AttributeMap[Expression] = AttributeMap(
expressions.collect {
case a: Alias => (a.toAttribute, a.child)
} ++ children.flatMap(_.asInstanceOf[QueryPlanConstraints[PlanType]].aliasMap))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the only weird part; the rest are straightforward copy.

I couldn't figure out how to get the compiler to past without the explicit cast.

Copy link
Contributor

Choose a reason for hiding this comment

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

what if we do trait QueryPlanConstraints[PlanType <: QueryPlan[PlanType]] extends QueryPlan[PlanType]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that would create a cyclic hierarchy ...

@SparkQA
Copy link

SparkQA commented Jun 14, 2017

Test build #78034 has started for PR 18298 at commit bbcd26f.

@SparkQA
Copy link

SparkQA commented Jun 14, 2017

Test build #78039 has finished for PR 18298 at commit a212b14.

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

@SparkQA
Copy link

SparkQA commented Jun 14, 2017

Test build #3797 has finished for PR 18298 at commit bbcd26f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • trait QueryPlanConstraints[PlanType <: QueryPlan[PlanType]]
  • * class of expressions. For example, Set(a = b, b = c, e = f) will generate the following

@gatorsmile
Copy link
Member

retest this please

@gatorsmile
Copy link
Member

LGTM

@SparkQA
Copy link

SparkQA commented Jun 14, 2017

Test build #78061 has finished for PR 18298 at commit a212b14.

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

lazy val constraints: ExpressionSet =
ExpressionSet(
validConstraints
.union(inferAdditionalConstraints(constraints))
Copy link
Member

Choose a reason for hiding this comment

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

validConstraints

ExpressionSet(
validConstraints
.union(inferAdditionalConstraints(constraints))
.union(constructIsNotNullConstraints(constraints))
Copy link
Member

Choose a reason for hiding this comment

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

validConstraints

@sameeragarwal
Copy link
Member

Thanks for the cleanup! LGTM modulo Xiao's comment.

@gatorsmile
Copy link
Member

LGTM

@rxin
Copy link
Contributor Author

rxin commented Jun 14, 2017

Merging in master.

@asfgit asfgit closed this in e254e86 Jun 14, 2017
@SparkQA
Copy link

SparkQA commented Jun 14, 2017

Test build #78067 has finished for PR 18298 at commit d8356b3.

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

dataknocker pushed a commit to dataknocker/spark that referenced this pull request Jun 16, 2017
## What changes were proposed in this pull request?
This patch moves constraint related code into a separate trait QueryPlanConstraints, so we don't litter QueryPlan with a lot of constraint private functions.

## How was this patch tested?
This is a simple move refactoring and should be covered by existing tests.

Author: Reynold Xin <[email protected]>

Closes apache#18298 from rxin/SPARK-21091.
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