wjjc1017 commented on issue #69489:
URL: https://github.com/apache/doris/issues/69489#issuecomment-6357439351
Thanks — I reran this locally on **doris-4.1.3-rc02-7126cf65d96** with the
corrected
`UNIQUE KEY(k) NOT NULL` table:
```sql
CREATE TABLE u (k INT NOT NULL, x INT) UNIQUE KEY(k)
DISTRIBUTED BY HASH(k) BUCKETS 1 PROPERTIES ("replication_num"="1");
INSERT INTO u VALUES (1,5),(2,7),(3,NULL);
```
With `ELIMINATE_GROUP_BY` enabled and disabled, both return:
| k | STDDEV_SAMP | VAR_SAMP | STDDEV_POP | VAR_POP |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 0 |
| 2 | 0 | 0 | 0 | 0 |
| 3 (x NULL) | NULL | NULL | NULL | NULL |
The plan with the rule enabled shows `Project(k, if(x IS NULL, NULL, 0.0))`,
so the rule did fire;
the backend `SampData::insert_result_into` path also returns `0` for `count
<= 1`. There is no
optimized-vs-retained difference, so I am withdrawing the
optimizer-regression claim.
The only remaining question is the contract: should `STDDEV_SAMP`/`VAR_SAMP`
return `NULL` for fewer
than two non-null values (PostgreSQL does)? If `0.0` is intended, please
close this as not-a-bug; if
`NULL` is desired, it is an FE+BE semantics change, not an
`EliminateGroupBy` bug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]