apache / apache/gluten

[CH] sum diff with empty lines

Open
#9,193 0 comments 0 reactions 0 assignees View on GitHub
bug triage
Dominant language
Scala
Stars
1.6k
Forks
657
Avg merge
2d 21h
Merged PRs (30d)
85

Description

### Backend

CH (ClickHouse)

### Bug description

``` sql
CREATE TEMPORARY VIEW lineitem
USING org.apache.spark.sql.parquet
OPTIONS (
path "/data1/liyang/tpch/tpch-data-sf1/lineitem"
) ;

```

vanilla
``` sql
0: jdbc:hive2://localhost:10000/> select sum(if(l_tax > 0.5, 1, 0)) from lineitem;
+---------------------------------+
| sum((IF((l_tax > 0.5), 1, 0))) |
+---------------------------------+
| 0 |
+---------------------------------+
1 row selected (0.323 seconds)
```

gluten
```
0: jdbc:hive2://localhost:10000/> select sum(if(l_tax > 0.5, 1, 0)) from lineitem;
+---------------------------------+
| sum((IF((l_tax > 0.5), 1, 0))) |
+---------------------------------+
| NULL |
+---------------------------------+
1 row selected (0.294 seconds)
```

### Spark version

None

### Spark configurations

_No response_

### System information

_No response_

### Relevant logs

```bash

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided lineitem query through Gluten with the ClickHouse backend and compare its result with vanilla Spark. Trace the aggregation behavior for sum(if(l_tax > 0.5, 1, 0)) over the shown data, then verify that the result matches the expected zero rather than NULL.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, scala, spark, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.