Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-3779][CH] Fix core dump when executing sql with runtime filter #3781

Merged
merged 1 commit into from
Nov 20, 2023
Merged
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 @@ -16,13 +16,59 @@
*/
package io.glutenproject.execution

import org.apache.spark.SparkConf
import org.apache.spark.{SPARK_VERSION_SHORT, SparkConf}

class GlutenClickHouseTPCHParquetRFSuite extends GlutenClickHouseTPCHParquetSuite {

protected lazy val sparkVersion: String = {
val version = SPARK_VERSION_SHORT.split("\\.")
version(0) + "." + version(1)
}

override protected def sparkConf: SparkConf = {
super.sparkConf
// radically small threshold to force runtime bloom filter
.set("spark.sql.optimizer.runtime.bloomFilter.applicationSideScanSizeThreshold", "1KB")
.set("spark.sql.optimizer.runtime.bloomFilter.enabled", "true")
}

test("GLUTEN-3779: Fix core dump when executing sql with runtime filter") {
withSQLConf(
("spark.sql.autoBroadcastJoinThreshold", "-1"),
("spark.sql.files.maxPartitionBytes", "204800"),
("spark.sql.files.openCostInBytes", "102400")
) {
compareResultsAgainstVanillaSpark(
"""
|SELECT
| sum(l_extendedprice) / 7.0 AS avg_yearly
|FROM
| lineitem,
| part
|WHERE
| p_partkey = l_partkey
| AND p_size > 5
| AND l_quantity < (
| SELECT
| 0.2 * avg(l_quantity)
| FROM
| lineitem
| WHERE
| l_partkey = p_partkey);
|
|""".stripMargin,
compareResult = true,
df => {
if (sparkVersion.equals("3.3")) {
val filterExecs = df.queryExecution.executedPlan.collect {
case filter: FilterExecTransformerBase => filter
}
assert(filterExecs.size == 4)
assert(
filterExecs(0).asInstanceOf[FilterExecTransformer].toString.contains("might_contain"))
}
}
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class AggregateFunctionGroupBloomFilter final : public IAggregateFunctionDataHel

void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena *) const override
{
// Skip un-initted values
if (!this->data(rhs).initted)
{
return;
}
const auto & bloom_other = this->data(rhs).bloom_filter;
const auto & filter_other = bloom_other.getFilter();
if (!this->data(place).initted)
Expand Down
Loading