Skip to content

Commit 2d01bcc

Browse files
maryannxuegatorsmile
authored andcommitted
[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 #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 <[email protected]> Signed-off-by: gatorsmile <[email protected]>
1 parent e853afb commit 2d01bcc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/EliminateResolvedHint.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object EliminateResolvedHint extends Rule[LogicalPlan] {
3434
val rightHint = mergeHints(collectHints(j.right))
3535
j.copy(hint = JoinHint(leftHint, rightHint))
3636
}
37-
pulledUp.transform {
37+
pulledUp.transformUp {
3838
case h: ResolvedHint => h.child
3939
}
4040
}

sql/core/src/test/scala/org/apache/spark/sql/JoinHintSuite.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,13 @@ class JoinHintSuite extends PlanTest with SharedSQLContext {
190190
Some(HintInfo(broadcast = true))) :: Nil
191191
)
192192
}
193+
194+
test("nested hint") {
195+
verifyJoinHint(
196+
df.hint("broadcast").hint("broadcast").filter('id > 2).join(df, "id"),
197+
JoinHint(
198+
Some(HintInfo(broadcast = true)),
199+
None) :: Nil
200+
)
201+
}
193202
}

0 commit comments

Comments
 (0)