baibaichen commented on code in PR #10182: URL: https://github.com/apache/incubator-gluten/pull/10182#discussion_r2204341546
########## backends-clickhouse/src/main/scala/org/apache/spark/sql/execution/joins/ClickHouseBuildSideRelation.scala: ########## @@ -44,31 +44,41 @@ case class ClickHouseBuildSideRelation( override def asReadOnlyCopy(): ClickHouseBuildSideRelation = this - private var hashTableData: Long = 0L + private var existHashTableData: Long = 0L + private var existBroadCastHashJoinContext: BroadCastHashJoinContext = null def buildHashTable( broadCastContext: BroadCastHashJoinContext): (Long, ClickHouseBuildSideRelation) = synchronized { - if (hashTableData == 0) { + if (couldReuseHashTableData(broadCastContext)) { logDebug( s"BHJ value size: " + s"${broadCastContext.buildHashTableId} = ${batches.length}") // Build the hash table - hashTableData = StorageJoinBuilder.build( + existHashTableData = StorageJoinBuilder.build( batches, numOfRows, broadCastContext, newBuildKeys.asJava, output.asJava, hasNullKeyValues) - (hashTableData, this) + existBroadCastHashJoinContext = broadCastContext + (existHashTableData, this) } else { - (StorageJoinBuilder.nativeCloneBuildHashTable(hashTableData), null) + (StorageJoinBuilder.nativeCloneBuildHashTable(existHashTableData), null) } } def reset(): Unit = synchronized { - hashTableData = 0 + existHashTableData = 0 Review Comment: reset existBroadCastHashJoinContext ? -- 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: commits-unsubscr...@gluten.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@gluten.apache.org For additional commands, e-mail: commits-h...@gluten.apache.org