apache / apache/auron

Aggregate FILTER may include rows with NULL predicates

Open
#2,521 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.8k
Forks
241
Avg merge
2d 14h
Merged PRs (30d)
22

Description

**Describe the bug**

Native aggregation may include rows whose FILTER predicate evaluates to NULL, producing incorrect SUM and COUNT results.

**To Reproduce**

```sql
CREATE TABLE t_filter_null(amount INT, flag BOOLEAN) USING parquet;

INSERT INTO t_filter_null VALUES
(10, true), (100, NULL), (1, false), (200, NULL);

SELECT
SUM(amount) FILTER (WHERE NOT flag),
COUNT(*) FILTER (WHERE NOT flag)
FROM t_filter_null;
```

Auron returns `(301, 3)`, while Spark returns `(1, 1)`.

**Expected behavior**

Only rows whose FILTER predicate is non-null and true should contribute to the aggregate.

**Screenshots**

**Additional context**

Contributor guide

Open the contributing guide

Research direction

Start by running the SQL reproduction in the issue and compare Auron's results with Spark's. Trace native aggregate FILTER handling for NULL predicates; done when SUM and COUNT include only rows where the predicate is non-null and true, matching the expected (1, 1) result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.