wecharyu commented on code in PR #13710:
URL: https://github.com/apache/gluten/pull/13710#discussion_r4661547123


##########
backends-velox/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala:
##########
@@ -274,4 +274,37 @@ case class BroadcastHashJoinContext(
         substraitJoinType == JoinRel.JoinType.JOIN_TYPE_LEFT_ANTI
     )
   }
+
+  /**
+   * Identifies the native hash table this join needs from a broadcast 
relation, which every join
+   * reusing the broadcast exchange shares. Joins with the same key can share 
a hash table. For an
+   * anti join, `droppedDuplicates` also tells whether it has a filter.
+   */
+  def hashTableBuildKey: HashTableBuildKey = {
+    // An anti join with a null-intolerant filter leaves out the build rows 
that are null in the
+    // filter's build columns 
(HashTableBuilder::removeInputRowsForAntiJoinFilter). The columns
+    // are given by position: a reused exchange gives them other expression 
IDs.
+    val nullFilteredColumns =
+      if (
+        substraitJoinType == JoinRel.JoinType.JOIN_TYPE_LEFT_ANTI &&
+        hasMixedFiltCondition && filterPropagatesNulls
+      ) {
+        val buildColumns = 
buildSideStructure.map(ConverterUtils.genColumnNameWithExprId)
+        filterBuildColumns.map(buildColumns.indexOf(_)).sorted.distinct.toList
+      } else {
+        Nil
+      }
+    HashTableBuildKey(
+      droppedDuplicates,
+      isNullAwareAntiJoin,
+      nullFilteredColumns,
+      bloomFilterPushdownSize)

Review Comment:
   `isNullAwareAntiJoin` and `bloomFilterPushdownSize` look redundant in the 
key. `isNullAware` is part of `HashedRelationBroadcastMode`, so joins that 
differ in it never share an exchange. `bloomFilterPushdownSize` comes from 
session confs and only decides whether a bloom filter is built, not which rows 
the table holds. Could we drop them?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to