Skip to content

Commit

Permalink
[SPARK-26065][FOLLOW-UP][SQL] Fix the Failure when having two Consecu…
Browse files Browse the repository at this point in the history
…tive Hints

## What changes were proposed in this pull request?

This is to fix a bug in apache#23036, which would lead to an exception in case of two consecutive hints.

## How was this patch tested?

Added a new test.

Closes apache#23501 from maryannxue/query-hint-followup.

Authored-by: maryannxue <[email protected]>
Signed-off-by: gatorsmile <[email protected]>
  • Loading branch information
maryannxue authored and gatorsmile committed Jan 9, 2019
1 parent e853afb commit 2d01bcc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object EliminateResolvedHint extends Rule[LogicalPlan] {
val rightHint = mergeHints(collectHints(j.right))
j.copy(hint = JoinHint(leftHint, rightHint))
}
pulledUp.transform {
pulledUp.transformUp {
case h: ResolvedHint => h.child
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,13 @@ class JoinHintSuite extends PlanTest with SharedSQLContext {
Some(HintInfo(broadcast = true))) :: Nil
)
}

test("nested hint") {
verifyJoinHint(
df.hint("broadcast").hint("broadcast").filter('id > 2).join(df, "id"),
JoinHint(
Some(HintInfo(broadcast = true)),
None) :: Nil
)
}
}

0 comments on commit 2d01bcc

Please sign in to comment.