Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-20231] [SQL] Refactor star schema code for the subsequent star join detection in CBO #17544

Closed
wants to merge 2 commits into from

Conversation

ioana-delaney
Copy link
Contributor

What changes were proposed in this pull request?

This commit moves star schema code from join.scala to StarSchemaDetection.scala. It also applies some minor fixes in StarJoinReorderSuite.scala.

How was this patch tested?

Run existing StarJoinReorderSuite.scala.

@ioana-delaney
Copy link
Contributor Author

@gatorsmile I did a small refactoring for star schema. Would you please review. Thank you.

@gatorsmile
Copy link
Member

add to whitelist

@gatorsmile
Copy link
Member

ok to test

*/
def findStarJoins(
input: Seq[LogicalPlan],
conditions: Seq[Expression]): Seq[LogicalPlan] = {
Copy link
Member

Choose a reason for hiding this comment

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

To the other reviewers, this is to address the comment by @cloud-fan in the previous PR.
#15363 (comment)

// dimension table is a FK-PK join. Heuristically, a selective dimension may reduce
// the result of a join.
// Also, conservatively assume that a fact table is joined with more than one dimension.
if (dimTables.size >= 2 && isSelectiveStarJoin(dimTables, conditions)) {
Copy link
Member

Choose a reason for hiding this comment

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

dimTables.size >= 2 is removed in the new code? Could you please explain it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gatorsmile I moved the condition from reorderStarJoin to findStarJoin to be used by both ReorderJoin and CostBasedReorder.

@SparkQA
Copy link

SparkQA commented Apr 5, 2017

Test build #75557 has finished for PR 17544 at commit 99732ff.

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

}
}

if (eligibleDimPlans.isEmpty || eligibleDimPlans.size < 2) {
Copy link
Member

Choose a reason for hiding this comment

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

uh, you move it to here.

@gatorsmile
Copy link
Member

LGTM. Look forward to your next PR for merging start join detection with CBO.

@gatorsmile
Copy link
Member

Thanks! Merging to master.

@ioana-delaney
Copy link
Contributor Author

@gatorsmile Thank you!

@asfgit asfgit closed this in 4000f12 Apr 6, 2017
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