[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:
parent
e853afb416
commit
2d01bccbd4
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue