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 @@ -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(),
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 @@ -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"};
Comment thread
minni31 marked this conversation as resolved.

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ class GlutenBitmapExpressionsQuerySuite
"Expected native HashAggregateExecBaseTransformer in plan"
)
}

test("bitmap_or_agg routes to native") {
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()
assert(
collectWithSubqueries(df.queryExecution.executedPlan) {
case h: HashAggregateExecBaseTransformer => h
}.nonEmpty,
"Expected native HashAggregateExecBaseTransformer in plan"
)
}
Comment on lines +41 to +54
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ class GlutenBitmapExpressionsQuerySuite
"Expected native HashAggregateExecBaseTransformer in plan"
)
}

test("bitmap_or_agg routes to native") {
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()
assert(
collectWithSubqueries(df.queryExecution.executedPlan) {
case h: HashAggregateExecBaseTransformer => h
}.nonEmpty,
"Expected native HashAggregateExecBaseTransformer in plan"
)
}
Comment on lines +41 to +54
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Comment on lines 91 to +94
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 @@ -37,4 +37,19 @@ class GlutenBitmapExpressionsQuerySuite
"Expected native HashAggregateExecBaseTransformer in plan"
)
}

test("bitmap_or_agg routes to native") {
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.
assert(
collectWithSubqueries(df.queryExecution.executedPlan) {
case h: HashAggregateExecBaseTransformer => h
}.nonEmpty,
"Expected native HashAggregateExecBaseTransformer in plan"
)
}
Comment on lines +41 to +54
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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