This is an automated email from the ASF dual-hosted git repository.
yaooqinn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 843d7fcf5e [GLUTEN-13709][VL] Don't give a join reusing a broadcast
another join's hash table (#13710)
843d7fcf5e is described below
commit 843d7fcf5eeb2a9fd8c1c6ac1775e9d3b2defdd4
Author: YangJie <[email protected]>
AuthorDate: Fri Nov 27 03:41:43 2026 -0500
[GLUTEN-13709][VL] Don't give a join reusing a broadcast another join's
hash table (#13710)
* [VL] Key the broadcast relation's hash table cache by every build
parameter
* [VL] Key the hash table only by what changes it and keep native handles
out of serialization
* [VL] Drop the null-aware flag and bloom filter size from the hash table
key
---
.../gluten/execution/HashJoinExecTransformer.scala | 25 ++++++++++
.../execution/SerializedBroadcastHashTable.scala | 9 +---
.../execution/VeloxBroadcastBuildSideCache.scala | 26 +++++-----
.../execution/VeloxSerializedBroadcastRDD.scala | 1 +
.../sql/execution/ColumnarBuildSideRelation.scala | 40 ++++++++--------
.../unsafe/UnsafeColumnarBuildSideRelation.scala | 38 +++++++--------
.../gluten/execution/VeloxHashJoinSuite.scala | 56 ++++++++++++++++++++++
7 files changed, 136 insertions(+), 59 deletions(-)
diff --git
a/backends-velox/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala
b/backends-velox/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala
index 581fe0d5b8..81304ccffa 100644
---
a/backends-velox/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala
+++
b/backends-velox/src/main/scala/org/apache/gluten/execution/HashJoinExecTransformer.scala
@@ -294,4 +294,29 @@ 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 (Velox
HashBuild::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, nullFilteredColumns)
+ }
}
+
+/** See [[BroadcastHashJoinContext.hashTableBuildKey]]. */
+case class HashTableBuildKey(droppedDuplicates: Boolean, nullFilteredColumns:
List[Int])
diff --git
a/backends-velox/src/main/scala/org/apache/gluten/execution/SerializedBroadcastHashTable.scala
b/backends-velox/src/main/scala/org/apache/gluten/execution/SerializedBroadcastHashTable.scala
index 323b88a420..8ad7ceb92d 100644
---
a/backends-velox/src/main/scala/org/apache/gluten/execution/SerializedBroadcastHashTable.scala
+++
b/backends-velox/src/main/scala/org/apache/gluten/execution/SerializedBroadcastHashTable.scala
@@ -33,19 +33,17 @@ class SerializedBroadcastHashTable(
var numRows: Long,
var ignoreNullKeys: Boolean,
var joinHasNullKeys: Boolean,
- var droppedDuplicates: Boolean,
var bloomFilterBlocksByteSize: Long,
var hashProbeDynamicFiltersProduced: Long,
var buildSideRelation: BuildSideRelation)
extends Externalizable {
- def this() = this(null, 0, false, false, false, 0, 0, null) // Required for
Externalizable
+ def this() = this(null, 0, false, false, 0, 0, null) // Required for
Externalizable
override def writeExternal(out: ObjectOutput): Unit = {
out.writeLong(numRows)
out.writeBoolean(ignoreNullKeys)
out.writeBoolean(joinHasNullKeys)
- out.writeBoolean(droppedDuplicates)
out.writeLong(bloomFilterBlocksByteSize)
out.writeLong(hashProbeDynamicFiltersProduced)
serializedData.writeExternal(out)
@@ -56,7 +54,6 @@ class SerializedBroadcastHashTable(
numRows = in.readLong()
ignoreNullKeys = in.readBoolean()
joinHasNullKeys = in.readBoolean()
- droppedDuplicates = in.readBoolean()
bloomFilterBlocksByteSize = in.readLong()
hashProbeDynamicFiltersProduced = in.readLong()
val data = new UnsafeByteArray()
@@ -92,7 +89,6 @@ object SerializedBroadcastHashTable {
numRows: Long,
ignoreNullKeys: Boolean,
joinHasNullKeys: Boolean,
- droppedDuplicates: Boolean,
bloomFilterBlocksByteSize: Long,
hashProbeDynamicFiltersProduced: Long,
buildSideRelation: BuildSideRelation): SerializedBroadcastHashTable =
@@ -101,7 +97,6 @@ object SerializedBroadcastHashTable {
numRows,
ignoreNullKeys,
joinHasNullKeys,
- droppedDuplicates,
bloomFilterBlocksByteSize,
hashProbeDynamicFiltersProduced,
buildSideRelation)
@@ -120,7 +115,6 @@ object SerializedBroadcastHashTable {
hashTableHandle: Long,
cacheKey: String,
buildSideRelation: BuildSideRelation,
- droppedDuplicates: Boolean,
numRows: Long): SerializedBroadcastHashTable = {
try {
val serializedSize =
HashJoinBuilder.serializedHashTableSizeDirect(hashTableHandle)
@@ -144,7 +138,6 @@ object SerializedBroadcastHashTable {
numRows,
ignoreNullKeys,
joinHasNullKeys,
- droppedDuplicates,
bloomFilterBlocksByteSize,
hashProbeDynamicFiltersProduced,
buildSideRelation)
diff --git
a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala
b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala
index 3ab7868808..1b583118d4 100644
---
a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala
+++
b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala
@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit
case class BroadcastHashTable(
pointer: Long,
relation: BuildSideRelation,
- droppedDuplicates: Boolean)
+ buildKey: HashTableBuildKey)
/**
* `VeloxBroadcastBuildSideCache` is used for controlling to build bhj hash
table once.
@@ -116,7 +116,7 @@ object VeloxBroadcastBuildSideCache
(_: String) => {
// The native side caches the table under the id of the context.
val context = broadcastContext.copy(buildHashTableId = cacheKey)
- val (pointer, relation, droppedDuplicates) = broadcast.value match {
+ val (pointer, relation, buildKey) = broadcast.value match {
case columnar: ColumnarBuildSideRelation =>
columnar.buildHashTable(context)
case unsafe: UnsafeColumnarBuildSideRelation =>
@@ -126,7 +126,7 @@ object VeloxBroadcastBuildSideCache
broadcastContext.hashTableMemorySizeMetric.foreach(
_ += HashJoinBuilder.getHashTableMemoryUsage(pointer))
- BroadcastHashTable(pointer, relation, droppedDuplicates)
+ BroadcastHashTable(pointer, relation, buildKey)
}
)
}
@@ -150,9 +150,9 @@ object VeloxBroadcastBuildSideCache
return cached
}
- def resetRelation(droppedDuplicates: Boolean): Unit = relation match {
- case r: ColumnarBuildSideRelation => r.reset(droppedDuplicates)
- case r: UnsafeColumnarBuildSideRelation => r.reset(droppedDuplicates)
+ def resetRelation(buildKey: HashTableBuildKey): Unit = relation match {
+ case r: ColumnarBuildSideRelation => r.reset(buildKey)
+ case r: UnsafeColumnarBuildSideRelation => r.reset(buildKey)
case _ =>
}
@@ -174,8 +174,8 @@ object VeloxBroadcastBuildSideCache
"DriverBroadcastHashTableBuild"
)
- resetRelation(broadcastContext.droppedDuplicates)
- val (hashTableHandle, _, droppedDuplicates) = relation match {
+ resetRelation(broadcastContext.hashTableBuildKey)
+ val (hashTableHandle, _, buildKey) = relation match {
case r: ColumnarBuildSideRelation =>
r.buildHashTableWithRuntime(broadcastContext, runtime)
case r: UnsafeColumnarBuildSideRelation =>
@@ -191,7 +191,6 @@ object VeloxBroadcastBuildSideCache
hashTableHandle,
broadcastId,
relation,
- droppedDuplicates,
numRows)
val serializeTimeMs = System.currentTimeMillis() - startSerializeTime
@@ -208,7 +207,7 @@ object VeloxBroadcastBuildSideCache
driverSerializedCache.put(broadcastId, result)
result
} finally {
- resetRelation(droppedDuplicates)
+ resetRelation(buildKey)
}
}
}
@@ -218,6 +217,7 @@ object VeloxBroadcastBuildSideCache
def deserializeOnExecutor(
serialized: SerializedBroadcastHashTable,
broadcastHashTableId: String,
+ buildKey: HashTableBuildKey,
deserializeHashTableTimeMetric:
Option[org.apache.spark.sql.execution.metric.SQLMetric] =
None): BroadcastHashTable = {
@@ -233,7 +233,7 @@ object VeloxBroadcastBuildSideCache
BroadcastHashTable(
hashTableHandle,
serialized.buildSideRelation,
- serialized.droppedDuplicates)
+ buildKey)
}
)
}
@@ -270,9 +270,9 @@ object VeloxBroadcastBuildSideCache
if (value.relation != null) {
value.relation match {
case columnar: ColumnarBuildSideRelation =>
- columnar.reset(value.droppedDuplicates)
+ columnar.reset(value.buildKey)
case unsafe: UnsafeColumnarBuildSideRelation =>
- unsafe.reset(value.droppedDuplicates)
+ unsafe.reset(value.buildKey)
}
}
diff --git
a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxSerializedBroadcastRDD.scala
b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxSerializedBroadcastRDD.scala
index 761d000097..e8fdf415d9 100644
---
a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxSerializedBroadcastRDD.scala
+++
b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxSerializedBroadcastRDD.scala
@@ -42,6 +42,7 @@ case class VeloxSerializedBroadcastRDD(
VeloxBroadcastBuildSideCache.deserializeOnExecutor(
serialized,
broadcastContext.buildHashTableId,
+ broadcastContext.hashTableBuildKey,
broadcastContext.deserializeHashTableTimeMetric
)
diff --git
a/backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
b/backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
index 37203fdc9f..cf885a9d1e 100644
---
a/backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
+++
b/backends-velox/src/main/scala/org/apache/spark/sql/execution/ColumnarBuildSideRelation.scala
@@ -19,7 +19,7 @@ package org.apache.spark.sql.execution
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.columnarbatch.ColumnarBatches
import org.apache.gluten.config.GlutenConfig
-import org.apache.gluten.execution.BroadcastHashJoinContext
+import org.apache.gluten.execution.{BroadcastHashJoinContext,
HashTableBuildKey}
import org.apache.gluten.expression.ConverterUtils
import org.apache.gluten.expression.ExpressionUtils
import org.apache.gluten.iterator.Iterators
@@ -167,15 +167,16 @@ case class ColumnarBuildSideRelation(
override def asReadOnlyCopy(): ColumnarBuildSideRelation = this
- // The relation can be reused as different hash tables by whether dropping
duplicates or not.
- private val hashTableData = Map.empty[Boolean, Long]
+ // Joins that reuse this relation can need different hash tables, one per
build key. The handles
+ // are native, so they are not serialized with the relation.
+ @transient private lazy val hashTableData = Map.empty[HashTableBuildKey,
Long]
def buildHashTable(
broadcastContext: BroadcastHashJoinContext)
- : (Long, ColumnarBuildSideRelation, Boolean) =
+ : (Long, ColumnarBuildSideRelation, HashTableBuildKey) =
synchronized {
- val droppedDuplicates = broadcastContext.droppedDuplicates
- if (!hashTableData.contains(droppedDuplicates)) {
+ val buildKey = broadcastContext.hashTableBuildKey
+ if (!hashTableData.contains(buildKey)) {
val startTime = System.nanoTime()
val runtime = Runtimes.contextInstance(
BackendsApiManager.getBackendName,
@@ -230,7 +231,7 @@ case class ColumnarBuildSideRelation(
try {
// Build the hash table
- hashTableData(droppedDuplicates) = hashJoinBuilder
+ hashTableData(buildKey) = hashJoinBuilder
.nativeBuild(
broadcastContext.buildHashTableId,
batchArray.toArray,
@@ -253,14 +254,14 @@ case class ColumnarBuildSideRelation(
val elapsedTime = System.nanoTime() - startTime
broadcastContext.buildHashTableTimeMetric.foreach(_ += elapsedTime /
1000000)
- (hashTableData(droppedDuplicates), this, droppedDuplicates)
+ (hashTableData(buildKey), this, buildKey)
} else {
(
HashJoinBuilder.cloneHashTable(
broadcastContext.buildHashTableId,
- hashTableData(droppedDuplicates)),
+ hashTableData(buildKey)),
null,
- droppedDuplicates)
+ buildKey)
}
}
@@ -270,10 +271,11 @@ case class ColumnarBuildSideRelation(
*/
def buildHashTableWithRuntime(
broadcastContext: BroadcastHashJoinContext,
- runtime: org.apache.gluten.runtime.Runtime): (Long,
ColumnarBuildSideRelation, Boolean) =
+ runtime: org.apache.gluten.runtime.Runtime)
+ : (Long, ColumnarBuildSideRelation, HashTableBuildKey) =
synchronized {
- val droppedDuplicates = broadcastContext.droppedDuplicates
- if (!hashTableData.contains(droppedDuplicates)) {
+ val buildKey = broadcastContext.hashTableBuildKey
+ if (!hashTableData.contains(buildKey)) {
val startTime = System.nanoTime()
val jniWrapper = ColumnarBatchSerializerJniWrapper.create(runtime)
val serializeHandle: Long = {
@@ -325,7 +327,7 @@ case class ColumnarBuildSideRelation(
try {
// Build the hash table
- hashTableData(droppedDuplicates) = hashJoinBuilder
+ hashTableData(buildKey) = hashJoinBuilder
.nativeBuild(
broadcastContext.buildHashTableId,
batchArray.toArray,
@@ -348,19 +350,19 @@ case class ColumnarBuildSideRelation(
val elapsedTime = System.nanoTime() - startTime
broadcastContext.buildHashTableTimeMetric.foreach(_ += elapsedTime /
1000000)
- (hashTableData(droppedDuplicates), this, droppedDuplicates)
+ (hashTableData(buildKey), this, buildKey)
} else {
(
HashJoinBuilder.cloneHashTable(
broadcastContext.buildHashTableId,
- hashTableData(droppedDuplicates)),
+ hashTableData(buildKey)),
null,
- droppedDuplicates)
+ buildKey)
}
}
- def reset(droppedDuplicates: Boolean): Unit = synchronized {
- hashTableData.remove(droppedDuplicates)
+ def reset(buildKey: HashTableBuildKey): Unit = synchronized {
+ hashTableData.remove(buildKey)
}
/**
diff --git
a/backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala
b/backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala
index 47c2b13175..c188f4377c 100644
---
a/backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala
+++
b/backends-velox/src/main/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelation.scala
@@ -19,7 +19,7 @@ package org.apache.spark.sql.execution.unsafe
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.columnarbatch.ColumnarBatches
import org.apache.gluten.config.GlutenConfig
-import org.apache.gluten.execution.BroadcastHashJoinContext
+import org.apache.gluten.execution.{BroadcastHashJoinContext,
HashTableBuildKey}
import org.apache.gluten.expression.ConverterUtils
import org.apache.gluten.expression.ExpressionUtils
import org.apache.gluten.iterator.Iterators
@@ -127,14 +127,14 @@ class UnsafeColumnarBuildSideRelation(
batches
}
- // The relation can be reused as different hash tables by whether dropping
duplicates or not.
- private val hashTableData = Map.empty[Boolean, Long]
+ // Joins that reuse this relation can need different hash tables, one per
build key.
+ private val hashTableData = Map.empty[HashTableBuildKey, Long]
def buildHashTable(broadcastContext: BroadcastHashJoinContext)
- : (Long, BuildSideRelation, Boolean) =
+ : (Long, BuildSideRelation, HashTableBuildKey) =
synchronized {
- val droppedDuplicates = broadcastContext.droppedDuplicates
- if (!hashTableData.contains(droppedDuplicates)) {
+ val buildKey = broadcastContext.hashTableBuildKey
+ if (!hashTableData.contains(buildKey)) {
val startTime = System.nanoTime()
val runtime = Runtimes.contextInstance(
BackendsApiManager.getBackendName,
@@ -190,7 +190,7 @@ class UnsafeColumnarBuildSideRelation(
try {
// Build the hash table
- hashTableData(droppedDuplicates) = hashJoinBuilder
+ hashTableData(buildKey) = hashJoinBuilder
.nativeBuild(
broadcastContext.buildHashTableId,
batchArray.toArray,
@@ -213,14 +213,14 @@ class UnsafeColumnarBuildSideRelation(
val elapsedTime = System.nanoTime() - startTime
broadcastContext.buildHashTableTimeMetric.foreach(_ += elapsedTime /
1000000)
- (hashTableData(droppedDuplicates), this, droppedDuplicates)
+ (hashTableData(buildKey), this, buildKey)
} else {
(
HashJoinBuilder.cloneHashTable(
broadcastContext.buildHashTableId,
- hashTableData(droppedDuplicates)),
+ hashTableData(buildKey)),
null,
- droppedDuplicates)
+ buildKey)
}
}
@@ -230,10 +230,10 @@ class UnsafeColumnarBuildSideRelation(
*/
def buildHashTableWithRuntime(
broadcastContext: BroadcastHashJoinContext,
- runtime: org.apache.gluten.runtime.Runtime): (Long, BuildSideRelation,
Boolean) =
+ runtime: org.apache.gluten.runtime.Runtime): (Long, BuildSideRelation,
HashTableBuildKey) =
synchronized {
- val droppedDuplicates = broadcastContext.droppedDuplicates
- if (!hashTableData.contains(droppedDuplicates)) {
+ val buildKey = broadcastContext.hashTableBuildKey
+ if (!hashTableData.contains(buildKey)) {
val startTime = System.nanoTime()
val jniWrapper = ColumnarBatchSerializerJniWrapper.create(runtime)
val serializeHandle: Long = {
@@ -286,7 +286,7 @@ class UnsafeColumnarBuildSideRelation(
try {
// Build the hash table
- hashTableData(droppedDuplicates) = hashJoinBuilder
+ hashTableData(buildKey) = hashJoinBuilder
.nativeBuild(
broadcastContext.buildHashTableId,
batchArray.toArray,
@@ -309,19 +309,19 @@ class UnsafeColumnarBuildSideRelation(
val elapsedTime = System.nanoTime() - startTime
broadcastContext.buildHashTableTimeMetric.foreach(_ += elapsedTime /
1000000)
- (hashTableData(droppedDuplicates), this, droppedDuplicates)
+ (hashTableData(buildKey), this, buildKey)
} else {
(
HashJoinBuilder.cloneHashTable(
broadcastContext.buildHashTableId,
- hashTableData(droppedDuplicates)),
+ hashTableData(buildKey)),
null,
- droppedDuplicates)
+ buildKey)
}
}
- def reset(droppedDuplicates: Boolean): Unit = synchronized {
- hashTableData.remove(droppedDuplicates)
+ def reset(buildKey: HashTableBuildKey): Unit = synchronized {
+ hashTableData.remove(buildKey)
}
override def writeExternal(out: ObjectOutput): Unit = Utils.tryOrIOException
{
diff --git
a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala
b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala
index fe3d50b980..b80ae00e41 100644
---
a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala
+++
b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala
@@ -825,4 +825,60 @@ class VeloxHashJoinSuite extends
VeloxWholeStageTransformerSuite {
assert(ex.getErrorClass == "_LEGACY_ERROR_TEMP_2249")
}
}
+
+ test("joins that reuse a broadcast but filter nulls differently get their
own hash table") {
+ withTempView("probe", "build") {
+ withTempPath {
+ dir =>
+ Seq((1, 5), (2, 1), (3, 7), (4, 2), (5, 9), (6, 0), (7, 4))
+ .toDF("k", "x")
+ .write
+ .parquet(s"$dir/probe")
+ Seq[(Int, Option[Int])](
+ (1, Some(3)),
+ (1, None),
+ (2, None),
+ (3, Some(8)),
+ (4, Some(1)),
+ (5, None),
+ (8, Some(2)))
+ .toDF("k", "y")
+ .write
+ .parquet(s"$dir/build")
+ spark.read.parquet(s"$dir/probe").createOrReplaceTempView("probe")
+ spark.read.parquet(s"$dir/build").createOrReplaceTempView("build")
+ // This anti join's filter is null-intolerant, so its hash table
leaves out the build
+ // rows whose y is null. The other join's filter is true for them,
so it needs them.
+ val nullDropping =
+ "SELECT 'a' t, k, x FROM probe WHERE NOT EXISTS " +
+ "(SELECT 1 FROM build WHERE probe.k = build.k AND probe.x >
build.y)"
+ val nullDroppingRows = Seq((2, 1), (3, 7), (5, 9), (6, 0), (7, 4))
+ Seq(
+ "NOT EXISTS" -> Seq((3, 7), (6, 0), (7, 4)),
+ "EXISTS" -> Seq((1, 5), (2, 1), (4, 2), (5, 9))
+ ).foreach {
+ case (predicate, rows) =>
+ val nullKeeping =
+ s"SELECT 'b' t, k, x FROM probe WHERE $predicate (SELECT 1
FROM build " +
+ "WHERE probe.k = build.k AND (probe.x > build.y OR build.y
IS NULL))"
+ val expected = nullDroppingRows.map { case (k, x) => Row("a", k,
x) } ++
+ rows.map { case (k, x) => Row("b", k, x) }
+ // Which join builds the shared hash table first depends on the
order they run.
+ Seq(s"$nullDropping UNION ALL $nullKeeping", s"$nullKeeping
UNION ALL $nullDropping")
+ .foreach {
+ query =>
+ val df = spark.sql(query)
+ checkAnswer(df, expected)
+ val plan = df.queryExecution.executedPlan
+ assert(
+ collect(plan) { case j: BroadcastHashJoinExecTransformer
=> j }.size == 2,
+ plan)
+ assert(
+ collectWithSubqueries(plan) { case r: ReusedExchangeExec
=> r }.nonEmpty,
+ s"Expected the joins to share one broadcast: $query")
+ }
+ }
+ }
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]