From 4b96cc4fd51747b2b06bba7056a71eae077bd2aa Mon Sep 17 00:00:00 2001 From: Minni Mittal Date: Thu, 4 Jun 2026 14:31:12 +0000 Subject: [PATCH 1/3] [GLUTEN] Route bitmap_or_agg to native Velox execution Register bitmap_or_agg aggregate function for native Velox execution: - Add BITMAP_OR_AGG constant to ExpressionNames - Add bitmap_or_agg to C++ plan validator supportedAggFuncs - Register Sig[BitmapOrAgg] in Spark 3.5/4.0/4.1 shims - Add DefaultValidator() to CH_AGGREGATE_FUNC_BLACKLIST (CH fallback) - Add plan-shape assertion test (excluded until Velox function lands) - Add ClickHouse test exclusions for native-only test Note: The native Velox bitmap_or_agg function is pending upstream (facebookincubator/velox). The test is excluded in VeloxTestSettings until that PR is merged and Gluten's Velox dependency is updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../org/apache/gluten/utils/CHExpressionUtil.scala | 1 + .../substrait/SubstraitToVeloxPlanValidator.cc | 3 ++- .../utils/clickhouse/ClickHouseTestSettings.scala | 1 + .../gluten/utils/velox/VeloxTestSettings.scala | 2 ++ .../sql/GlutenBitmapExpressionsQuerySuite.scala | 13 +++++++++++++ .../utils/clickhouse/ClickHouseTestSettings.scala | 1 + .../gluten/utils/velox/VeloxTestSettings.scala | 2 ++ .../sql/GlutenBitmapExpressionsQuerySuite.scala | 13 +++++++++++++ .../utils/clickhouse/ClickHouseTestSettings.scala | 1 + .../gluten/utils/velox/VeloxTestSettings.scala | 2 ++ .../sql/GlutenBitmapExpressionsQuerySuite.scala | 13 +++++++++++++ .../apache/gluten/expression/ExpressionNames.scala | 1 + .../gluten/sql/shims/spark35/Spark35Shims.scala | 3 ++- .../gluten/sql/shims/spark40/Spark40Shims.scala | 3 ++- .../gluten/sql/shims/spark41/Spark41Shims.scala | 3 ++- 15 files changed, 58 insertions(+), 4 deletions(-) diff --git a/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala b/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala index 3bbb4a467f6..7b5e13e8c04 100644 --- a/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala +++ b/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala @@ -201,6 +201,7 @@ object CHExpressionUtil { REGR_INTERCEPT -> DefaultValidator(), REGR_SXY -> DefaultValidator(), BITMAP_CONSTRUCT_AGG -> DefaultValidator(), + BITMAP_OR_AGG -> DefaultValidator(), TO_UTC_TIMESTAMP -> UtcTimestampValidator(), FROM_UTC_TIMESTAMP -> UtcTimestampValidator(), STACK -> DefaultValidator(), diff --git a/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc b/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc index 1b1b2cbe854..1806c2e18ad 100644 --- a/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc +++ b/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc @@ -1324,7 +1324,8 @@ bool SubstraitToVeloxPlanValidator::validate(const ::substrait::AggregateRel& ag "regr_intercept", "regr_sxy", "regr_replacement", - "bitmap_construct_agg"}; + "bitmap_construct_agg", + "bitmap_or_agg"}; auto udafFuncs = UdfLoader::getInstance()->getRegisteredUdafNames(); diff --git a/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala b/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala index 0b7e2d40378..426e94d789f 100644 --- a/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala +++ b/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala @@ -92,6 +92,7 @@ class ClickHouseTestSettings extends BackendTestSettings { enableSuite[GlutenBitmapExpressionsQuerySuite] // bitmap_construct_agg is not supported natively in CH backend. .excludeCH("bitmap_construct_agg routes to native") + .excludeCH("bitmap_or_agg routes to native") enableSuite[GlutenBitwiseExpressionsSuite] enableSuite[GlutenBloomFilterAggregateQuerySuite] .excludeCH("Test bloom_filter_agg and might_contain") diff --git a/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala b/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala index 0680080345f..4ea54f83394 100644 --- a/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala +++ b/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala @@ -916,6 +916,8 @@ class VeloxTestSettings extends BackendTestSettings { .excludeByPrefix("row index generation") .excludeByPrefix("invalid row index column type") enableSuite[GlutenBitmapExpressionsQuerySuite] + // bitmap_or_agg native Velox function not yet available (pending Velox PR). + .exclude("bitmap_or_agg routes to native") enableSuite[GlutenEmptyInSuite] enableSuite[GlutenRuntimeNullChecksV2Writes] // Velox assert_not_null throws VeloxUserError instead of SparkRuntimeException diff --git a/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala b/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala index 97072bfeff7..184aa368552 100644 --- a/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala +++ b/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala @@ -37,4 +37,17 @@ class GlutenBitmapExpressionsQuerySuite "Expected native HashAggregateExecBaseTransformer in plan" ) } + + test("bitmap_or_agg routes to native") { + val df = spark.sql( + "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " + + "FROM values (1L), (2L), (3L) AS t(col)") + df.collect() + assert( + collectWithSubqueries(df.queryExecution.executedPlan) { + case h: HashAggregateExecBaseTransformer => h + }.nonEmpty, + "Expected native HashAggregateExecBaseTransformer in plan" + ) + } } diff --git a/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala b/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala index cfcfe8198f6..2afa48225dc 100644 --- a/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala +++ b/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala @@ -91,6 +91,7 @@ class ClickHouseTestSettings extends BackendTestSettings { enableSuite[GlutenBitmapExpressionsQuerySuite] // bitmap_construct_agg is not supported natively in CH backend. .excludeCH("bitmap_construct_agg routes to native") + .excludeCH("bitmap_or_agg routes to native") enableSuite[GlutenBitwiseExpressionsSuite] enableSuite[GlutenBloomFilterAggregateQuerySuite] .excludeCH("Test bloom_filter_agg and might_contain") diff --git a/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala b/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala index 3692322e6e9..6b09c34de34 100644 --- a/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala +++ b/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala @@ -1145,6 +1145,8 @@ class VeloxTestSettings extends BackendTestSettings { .excludeByPrefix("row index generation") .excludeByPrefix("invalid row index column type") enableSuite[GlutenBitmapExpressionsQuerySuite] + // bitmap_or_agg native Velox function not yet available (pending Velox PR). + .exclude("bitmap_or_agg routes to native") enableSuite[GlutenEmptyInSuite] enableSuite[GlutenRuntimeNullChecksV2Writes] // Velox assert_not_null throws VeloxUserError instead of SparkRuntimeException diff --git a/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala b/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala index 97072bfeff7..184aa368552 100644 --- a/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala +++ b/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala @@ -37,4 +37,17 @@ class GlutenBitmapExpressionsQuerySuite "Expected native HashAggregateExecBaseTransformer in plan" ) } + + test("bitmap_or_agg routes to native") { + val df = spark.sql( + "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " + + "FROM values (1L), (2L), (3L) AS t(col)") + df.collect() + assert( + collectWithSubqueries(df.queryExecution.executedPlan) { + case h: HashAggregateExecBaseTransformer => h + }.nonEmpty, + "Expected native HashAggregateExecBaseTransformer in plan" + ) + } } diff --git a/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala b/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala index cfcfe8198f6..2afa48225dc 100644 --- a/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala +++ b/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/clickhouse/ClickHouseTestSettings.scala @@ -91,6 +91,7 @@ class ClickHouseTestSettings extends BackendTestSettings { enableSuite[GlutenBitmapExpressionsQuerySuite] // bitmap_construct_agg is not supported natively in CH backend. .excludeCH("bitmap_construct_agg routes to native") + .excludeCH("bitmap_or_agg routes to native") enableSuite[GlutenBitwiseExpressionsSuite] enableSuite[GlutenBloomFilterAggregateQuerySuite] .excludeCH("Test bloom_filter_agg and might_contain") diff --git a/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala b/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala index 1f5eaf3ac51..73cd8559e18 100644 --- a/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala +++ b/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala @@ -1150,6 +1150,8 @@ class VeloxTestSettings extends BackendTestSettings { .excludeByPrefix("row index generation") .excludeByPrefix("invalid row index column type") enableSuite[GlutenBitmapExpressionsQuerySuite] + // bitmap_or_agg native Velox function not yet available (pending Velox PR). + .exclude("bitmap_or_agg routes to native") enableSuite[GlutenEmptyInSuite] enableSuite[GlutenRuntimeNullChecksV2Writes] // Velox assert_not_null throws VeloxUserError instead of SparkRuntimeException diff --git a/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala b/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala index 97072bfeff7..184aa368552 100644 --- a/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala +++ b/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala @@ -37,4 +37,17 @@ class GlutenBitmapExpressionsQuerySuite "Expected native HashAggregateExecBaseTransformer in plan" ) } + + test("bitmap_or_agg routes to native") { + val df = spark.sql( + "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " + + "FROM values (1L), (2L), (3L) AS t(col)") + df.collect() + assert( + collectWithSubqueries(df.queryExecution.executedPlan) { + case h: HashAggregateExecBaseTransformer => h + }.nonEmpty, + "Expected native HashAggregateExecBaseTransformer in plan" + ) + } } diff --git a/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala b/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala index edd285b0f84..8bad4ebafde 100644 --- a/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala +++ b/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala @@ -33,6 +33,7 @@ object ExpressionNames { final val COLLECT_SET = "collect_set" final val BLOOM_FILTER_AGG = "bloom_filter_agg" final val BITMAP_CONSTRUCT_AGG = "bitmap_construct_agg" + final val BITMAP_OR_AGG = "bitmap_or_agg" final val VAR_SAMP = "var_samp" final val VAR_POP = "var_pop" final val BIT_AND_AGG = "bit_and" diff --git a/shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala b/shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala index 28c1bb177a8..2d97e63b023 100644 --- a/shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala +++ b/shims/spark35/src/main/scala/org/apache/gluten/sql/shims/spark35/Spark35Shims.scala @@ -81,7 +81,8 @@ class Spark35Shims extends SparkShims { Sig[RegrIntercept](ExpressionNames.REGR_INTERCEPT), Sig[RegrSXY](ExpressionNames.REGR_SXY), Sig[RegrReplacement](ExpressionNames.REGR_REPLACEMENT), - Sig[BitmapConstructAgg](ExpressionNames.BITMAP_CONSTRUCT_AGG) + Sig[BitmapConstructAgg](ExpressionNames.BITMAP_CONSTRUCT_AGG), + Sig[BitmapOrAgg](ExpressionNames.BITMAP_OR_AGG) ) } diff --git a/shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala b/shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala index 6363be33038..b903458d349 100644 --- a/shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala +++ b/shims/spark40/src/main/scala/org/apache/gluten/sql/shims/spark40/Spark40Shims.scala @@ -86,7 +86,8 @@ class Spark40Shims extends SparkShims { Sig[RegrIntercept](ExpressionNames.REGR_INTERCEPT), Sig[RegrSXY](ExpressionNames.REGR_SXY), Sig[RegrReplacement](ExpressionNames.REGR_REPLACEMENT), - Sig[BitmapConstructAgg](ExpressionNames.BITMAP_CONSTRUCT_AGG) + Sig[BitmapConstructAgg](ExpressionNames.BITMAP_CONSTRUCT_AGG), + Sig[BitmapOrAgg](ExpressionNames.BITMAP_OR_AGG) ) } diff --git a/shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala b/shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala index 226c2953893..4a8e7aacf9b 100644 --- a/shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala +++ b/shims/spark41/src/main/scala/org/apache/gluten/sql/shims/spark41/Spark41Shims.scala @@ -85,7 +85,8 @@ class Spark41Shims extends SparkShims { Sig[RegrIntercept](ExpressionNames.REGR_INTERCEPT), Sig[RegrSXY](ExpressionNames.REGR_SXY), Sig[RegrReplacement](ExpressionNames.REGR_REPLACEMENT), - Sig[BitmapConstructAgg](ExpressionNames.BITMAP_CONSTRUCT_AGG) + Sig[BitmapConstructAgg](ExpressionNames.BITMAP_CONSTRUCT_AGG), + Sig[BitmapOrAgg](ExpressionNames.BITMAP_OR_AGG) ) } From 08f18fdbfd0b469ae5fb32ad48c7cba140287f4c Mon Sep 17 00:00:00 2001 From: Minni Mittal Date: Thu, 4 Jun 2026 16:46:06 +0000 Subject: [PATCH 2/3] Remove bitmap_or_agg test exclusion (Velox PR merged) The native bitmap_or_agg function has been merged upstream in Velox. Remove the .exclude() entries from VeloxTestSettings so the plan-shape assertion test now runs on CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala | 2 -- .../scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala | 2 -- .../scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala | 2 -- 3 files changed, 6 deletions(-) diff --git a/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala b/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala index 4ea54f83394..0680080345f 100644 --- a/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala +++ b/gluten-ut/spark35/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala @@ -916,8 +916,6 @@ class VeloxTestSettings extends BackendTestSettings { .excludeByPrefix("row index generation") .excludeByPrefix("invalid row index column type") enableSuite[GlutenBitmapExpressionsQuerySuite] - // bitmap_or_agg native Velox function not yet available (pending Velox PR). - .exclude("bitmap_or_agg routes to native") enableSuite[GlutenEmptyInSuite] enableSuite[GlutenRuntimeNullChecksV2Writes] // Velox assert_not_null throws VeloxUserError instead of SparkRuntimeException diff --git a/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala b/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala index 6b09c34de34..3692322e6e9 100644 --- a/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala +++ b/gluten-ut/spark40/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala @@ -1145,8 +1145,6 @@ class VeloxTestSettings extends BackendTestSettings { .excludeByPrefix("row index generation") .excludeByPrefix("invalid row index column type") enableSuite[GlutenBitmapExpressionsQuerySuite] - // bitmap_or_agg native Velox function not yet available (pending Velox PR). - .exclude("bitmap_or_agg routes to native") enableSuite[GlutenEmptyInSuite] enableSuite[GlutenRuntimeNullChecksV2Writes] // Velox assert_not_null throws VeloxUserError instead of SparkRuntimeException diff --git a/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala b/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala index 73cd8559e18..1f5eaf3ac51 100644 --- a/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala +++ b/gluten-ut/spark41/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala @@ -1150,8 +1150,6 @@ class VeloxTestSettings extends BackendTestSettings { .excludeByPrefix("row index generation") .excludeByPrefix("invalid row index column type") enableSuite[GlutenBitmapExpressionsQuerySuite] - // bitmap_or_agg native Velox function not yet available (pending Velox PR). - .exclude("bitmap_or_agg routes to native") enableSuite[GlutenEmptyInSuite] enableSuite[GlutenRuntimeNullChecksV2Writes] // Velox assert_not_null throws VeloxUserError instead of SparkRuntimeException From deafd51c4b325d64fdb428c5afedfd7b297e38d5 Mon Sep 17 00:00:00 2001 From: Minni Mittal Date: Thu, 4 Jun 2026 16:50:37 +0000 Subject: [PATCH 3/3] Fix nested aggregate in bitmap_or_agg test SQL Use a subquery to avoid nesting bitmap_construct_agg inside bitmap_or_agg at the same aggregation level. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../spark/sql/GlutenBitmapExpressionsQuerySuite.scala | 6 ++++-- .../spark/sql/GlutenBitmapExpressionsQuerySuite.scala | 6 ++++-- .../spark/sql/GlutenBitmapExpressionsQuerySuite.scala | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala b/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala index 184aa368552..d0a8545bd86 100644 --- a/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala +++ b/gluten-ut/spark35/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala @@ -40,8 +40,10 @@ class GlutenBitmapExpressionsQuerySuite test("bitmap_or_agg routes to native") { val df = spark.sql( - "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " + - "FROM values (1L), (2L), (3L) AS t(col)") + "SELECT bitmap_or_agg(bm) FROM (" + + "SELECT bitmap_construct_agg(bitmap_bit_position(col)) AS bm " + + "FROM values (1L), (2L), (3L) AS t(col)" + + ") sub") df.collect() assert( collectWithSubqueries(df.queryExecution.executedPlan) { diff --git a/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala b/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala index 184aa368552..d0a8545bd86 100644 --- a/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala +++ b/gluten-ut/spark40/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala @@ -40,8 +40,10 @@ class GlutenBitmapExpressionsQuerySuite test("bitmap_or_agg routes to native") { val df = spark.sql( - "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " + - "FROM values (1L), (2L), (3L) AS t(col)") + "SELECT bitmap_or_agg(bm) FROM (" + + "SELECT bitmap_construct_agg(bitmap_bit_position(col)) AS bm " + + "FROM values (1L), (2L), (3L) AS t(col)" + + ") sub") df.collect() assert( collectWithSubqueries(df.queryExecution.executedPlan) { diff --git a/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala b/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala index 184aa368552..d0a8545bd86 100644 --- a/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala +++ b/gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala @@ -40,8 +40,10 @@ class GlutenBitmapExpressionsQuerySuite test("bitmap_or_agg routes to native") { val df = spark.sql( - "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " + - "FROM values (1L), (2L), (3L) AS t(col)") + "SELECT bitmap_or_agg(bm) FROM (" + + "SELECT bitmap_construct_agg(bitmap_bit_position(col)) AS bm " + + "FROM values (1L), (2L), (3L) AS t(col)" + + ") sub") df.collect() assert( collectWithSubqueries(df.queryExecution.executedPlan) {