Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,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(),
Expand Down
3 changes: 2 additions & 1 deletion cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,8 @@ bool SubstraitToVeloxPlanValidator::validate(const ::substrait::AggregateRel& ag
"regr_sxy",
"regr_replacement",
"bitmap_construct_agg",
"bitmapaggregator"};
"bitmapaggregator",
"bitmap_or_agg"};

auto udafFuncs = UdfLoader::getInstance()->getRegisteredUdafNames();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ class ClickHouseTestSettings extends BackendTestSettings {
// Exception.
.exclude("column pruning - non-readable file")
enableSuite[GlutenBitmapExpressionsQuerySuite]
// bitmap_construct_agg is not supported natively in CH backend.
// bitmap_construct_agg and bitmap_or_agg are 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.apache.spark.sql

import org.apache.gluten.execution.HashAggregateExecBaseTransformer

import org.apache.spark.sql.catalyst.expressions.BitmapOrAgg
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper

class GlutenBitmapExpressionsQuerySuite
Expand All @@ -37,4 +38,23 @@ class GlutenBitmapExpressionsQuerySuite
"Expected native HashAggregateExecBaseTransformer in plan"
)
}

test("bitmap_or_agg routes to native") {
Comment thread
minni31 marked this conversation as resolved.
val df = spark.sql(
"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()
val nativeBitmapOrAggs = collectWithSubqueries(df.queryExecution.executedPlan) {
case h: HashAggregateExecBaseTransformer
if h.aggregateExpressions.exists(
_.aggregateFunction.isInstanceOf[BitmapOrAgg]) =>
h
}
assert(
nativeBitmapOrAggs.nonEmpty,
"Expected native HashAggregateExecBaseTransformer with bitmap_or_agg in plan"
)
}
Comment thread
minni31 marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ class ClickHouseTestSettings extends BackendTestSettings {
// Exception.
.exclude("column pruning - non-readable file")
enableSuite[GlutenBitmapExpressionsQuerySuite]
// bitmap_construct_agg is not supported natively in CH backend.
// bitmap_construct_agg and bitmap_or_agg are 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.apache.spark.sql

import org.apache.gluten.execution.HashAggregateExecBaseTransformer

import org.apache.spark.sql.catalyst.expressions.BitmapOrAgg
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper

class GlutenBitmapExpressionsQuerySuite
Expand All @@ -37,4 +38,23 @@ class GlutenBitmapExpressionsQuerySuite
"Expected native HashAggregateExecBaseTransformer in plan"
)
}

test("bitmap_or_agg routes to native") {
Comment thread
minni31 marked this conversation as resolved.
val df = spark.sql(
"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()
val nativeBitmapOrAggs = collectWithSubqueries(df.queryExecution.executedPlan) {
case h: HashAggregateExecBaseTransformer
if h.aggregateExpressions.exists(
_.aggregateFunction.isInstanceOf[BitmapOrAgg]) =>
h
}
assert(
nativeBitmapOrAggs.nonEmpty,
"Expected native HashAggregateExecBaseTransformer with bitmap_or_agg in plan"
)
}
Comment on lines +42 to +59

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid concern. The native Velox bitmap_or_agg function has since landed upstream (the test exclusion was removed in a follow-up commit). The validator entry and runtime capability are now consistent.

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ class ClickHouseTestSettings extends BackendTestSettings {
// Exception.
.exclude("column pruning - non-readable file")
enableSuite[GlutenBitmapExpressionsQuerySuite]
// bitmap_construct_agg is not supported natively in CH backend.
// bitmap_construct_agg and bitmap_or_agg are not supported natively in CH backend.
.excludeCH("bitmap_construct_agg routes to native")
.excludeCH("bitmap_or_agg routes to native")
Comment thread
minni31 marked this conversation as resolved.
enableSuite[GlutenBitwiseExpressionsSuite]
enableSuite[GlutenBloomFilterAggregateQuerySuite]
.excludeCH("Test bloom_filter_agg and might_contain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.apache.spark.sql

import org.apache.gluten.execution.HashAggregateExecBaseTransformer

import org.apache.spark.sql.catalyst.expressions.BitmapOrAgg
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper

class GlutenBitmapExpressionsQuerySuite
Expand All @@ -37,4 +38,23 @@ class GlutenBitmapExpressionsQuerySuite
"Expected native HashAggregateExecBaseTransformer in plan"
)
}

test("bitmap_or_agg routes to native") {
Comment thread
minni31 marked this conversation as resolved.
val df = spark.sql(
"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()
Comment thread
minni31 marked this conversation as resolved.
val nativeBitmapOrAggs = collectWithSubqueries(df.queryExecution.executedPlan) {
case h: HashAggregateExecBaseTransformer
if h.aggregateExpressions.exists(
_.aggregateFunction.isInstanceOf[BitmapOrAgg]) =>
h
}
assert(
nativeBitmapOrAggs.nonEmpty,
"Expected native HashAggregateExecBaseTransformer with bitmap_or_agg in plan"
)
}
Comment thread
minni31 marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ object ExpressionNames {
final val BLOOM_FILTER_AGG = "bloom_filter_agg"
final val BITMAP_CONSTRUCT_AGG = "bitmap_construct_agg"
final val BITMAP_AGGREGATOR = "bitmapaggregator"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}

Expand Down
Loading