Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,8 @@ case class SubqueryAlias(

override def metadataOutput: Seq[Attribute] = {
val qualifierList = identifier.qualifier :+ alias
child.metadataOutput.map(_.withQualifier(qualifierList))
val nonHiddenMetadataOutput = child.metadataOutput.filter(!_.supportsQualifiedStar)
nonHiddenMetadataOutput.map(_.withQualifier(qualifierList))
}

override def maxRows: Option[Long] = child.maxRows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,26 @@ class DataFrameJoinSuite extends QueryTest
)
}
}

test("SPARK-39376: Hide duplicated columns in star expansion of subquery alias from USING JOIN") {
val joinDf = testData2.as("testData2").join(
testData3.as("testData3"), usingColumns = Seq("a"), joinType = "fullouter")
val equivalentQueries = Seq(
joinDf.select($"*"),
joinDf.as("r").select($"*"),
joinDf.as("r").select($"r.*")
)
equivalentQueries.foreach { query =>
checkAnswer(query,
Seq(
Row(1, 1, null),
Row(1, 2, null),
Row(2, 1, 2),
Row(2, 2, 2),
Row(3, 1, null),
Row(3, 2, null)
)
)
}
}
}