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-25121][SQL][FOLLOWUP] Add more unit tests for multi-part identifiers in join strategy hints #28013

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -242,51 +242,56 @@ class ResolveHintsSuite extends AnalysisTest {
caseSensitive = false)
}

test("Supports multi-part table names for broadcast hint resolution") {
// local temp table (single-part identifier case)
checkAnalysis(
UnresolvedHint("MAPJOIN", Seq("table", "table2"),
table("TaBlE").join(table("TaBlE2"))),
Join(
ResolvedHint(testRelation, HintInfo(strategy = Some(BROADCAST))),
ResolvedHint(testRelation2, HintInfo(strategy = Some(BROADCAST))),
Inner,
None,
JoinHint.NONE),
caseSensitive = false)

checkAnalysis(
UnresolvedHint("MAPJOIN", Seq("TaBlE", "table2"),
table("TaBlE").join(table("TaBlE2"))),
Join(
ResolvedHint(testRelation, HintInfo(strategy = Some(BROADCAST))),
testRelation2,
Inner,
None,
JoinHint.NONE),
caseSensitive = true)
test("Supports multi-part table names for join strategy hint resolution") {
Seq(("MAPJOIN", BROADCAST),
("MERGEJOIN", SHUFFLE_MERGE),
("SHUFFLE_HASH", SHUFFLE_HASH),
("SHUFFLE_REPLICATE_NL", SHUFFLE_REPLICATE_NL)).foreach { case (hintName, st) =>
// local temp table (single-part identifier case)
checkAnalysis(
UnresolvedHint(hintName, Seq("table", "table2"),
table("TaBlE").join(table("TaBlE2"))),
Join(
ResolvedHint(testRelation, HintInfo(strategy = Some(st))),
ResolvedHint(testRelation2, HintInfo(strategy = Some(st))),
Inner,
None,
JoinHint.NONE),
caseSensitive = false)

// global temp table (multi-part identifier case)
checkAnalysis(
UnresolvedHint("MAPJOIN", Seq("GlOBal_TeMP.table4", "table5"),
table("global_temp", "table4").join(table("global_temp", "table5"))),
Join(
ResolvedHint(testRelation4, HintInfo(strategy = Some(BROADCAST))),
ResolvedHint(testRelation5, HintInfo(strategy = Some(BROADCAST))),
Inner,
None,
JoinHint.NONE),
caseSensitive = false)
checkAnalysis(
UnresolvedHint(hintName, Seq("TaBlE", "table2"),
table("TaBlE").join(table("TaBlE2"))),
Join(
ResolvedHint(testRelation, HintInfo(strategy = Some(st))),
testRelation2,
Inner,
None,
JoinHint.NONE),
caseSensitive = true)

// global temp table (multi-part identifier case)
checkAnalysis(
UnresolvedHint(hintName, Seq("GlOBal_TeMP.table4", "table5"),
table("global_temp", "table4").join(table("global_temp", "table5"))),
Join(
ResolvedHint(testRelation4, HintInfo(strategy = Some(st))),
ResolvedHint(testRelation5, HintInfo(strategy = Some(st))),
Inner,
None,
JoinHint.NONE),
caseSensitive = false)

checkAnalysis(
UnresolvedHint("MAPJOIN", Seq("global_temp.TaBlE4", "table5"),
table("global_temp", "TaBlE4").join(table("global_temp", "TaBlE5"))),
Join(
ResolvedHint(testRelation4, HintInfo(strategy = Some(BROADCAST))),
testRelation5,
Inner,
None,
JoinHint.NONE),
caseSensitive = true)
checkAnalysis(
UnresolvedHint(hintName, Seq("global_temp.TaBlE4", "table5"),
table("global_temp", "TaBlE4").join(table("global_temp", "TaBlE5"))),
Join(
ResolvedHint(testRelation4, HintInfo(strategy = Some(st))),
testRelation5,
Inner,
None,
JoinHint.NONE),
caseSensitive = true)
}
}
}