You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/05/13 02:47:32 UTC
[GitHub] [spark] maropu commented on a change in pull request #32528: [SPARK-35350][SQL] Add code-gen for left semi sort merge join
maropu commented on a change in pull request #32528:
URL: https://github.com/apache/spark/pull/32528#discussion_r631525737
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala
##########
@@ -724,9 +749,32 @@ case class SortMergeJoinExec(
""".stripMargin
}
+ lazy val semiJoin = {
Review comment:
How about extracting this block as a private method like `codegenXXXX` just like `HashJoin`?
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala
##########
@@ -424,8 +424,18 @@ case class SortMergeJoinExec(
// A list to hold all matched rows from buffered side.
val clsName = classOf[ExternalAppendOnlyUnsafeRowArray].getName
+ // Flag to only buffer first matched row, to avoid buffering unnecessary rows.
+ val onlyBufferFirstMatchedRow = (joinType, condition) match {
+ case (LeftSemi, None) => true
+ case _ => false
+ }
+ val inMemoryThreshold =
+ if (onlyBufferFirstMatchedRow) {
Review comment:
How about moving this branch into the `getInMemoryThreshold` side?
```
// Flag to only buffer first matched row, to avoid buffering unnecessary rows.
private lazy val onlyBufferFirstMatchedRow = (joinType, condition) match {
case (LeftSemi, None) => true
case _ => false
}
private def getInMemoryThreshold: Int = {
if (onlyBufferFirstMatchedRow) {
1
} else {
sqlContext.conf.sortMergeJoinExecBufferInMemoryThreshold
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org