[SPARK-26065][FOLLOW-UP][SQL] Fix the Failure when having two Consecutive Hints

## What changes were proposed in this pull request?

This is to fix a bug in https://github.com/apache/spark/pull/23036, which would lead to an exception in case of two consecutive hints.

## How was this patch tested?

Added a new test.

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

Authored-by: maryannxue <maryannxue@apache.org>
Signed-off-by: gatorsmile <gatorsmile@gmail.com>
This commit is contained in:
maryannxue 2019-01-09 14:31:26 -08:00 committed by gatorsmile
parent e853afb416
commit 2d01bccbd4
2 changed files with 10 additions and 1 deletions

View file

@ -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
}
}

View file

@ -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
)
}
}