apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.65k stars 3.26k forks source link

[Bug] count (distinct (xxx)) over is not support #11677

Open siriume opened 2 years ago

siriume commented 2 years ago

Search before asking

Version

dev-1.1.2-236f394

What's Wrong?

sql like this:

CREATE TABLE `test`
(
    `id`    bigint       NOT NULL,
    `date`  date REPLACE_IF_NOT_NULL NOT NULL
) ENGINE = OLAP AGGREGATE KEY(`id` )
DISTRIBUTED BY HASH(`id`) BUCKETS 3
PROPERTIES (
"replication_num" = "3",
"compression"="zstd"
);

SELECT count(distinct (date)) over (partition by id) count_days FROM test;

ERROR:

[HY000][1105] errCode = 2, detailMessage = DISTINCT not allowed in analytic function: count(DISTINCT (`date`))

What You Expected?

sql execute succeed.

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

Code of Conduct

morrySnow commented 2 years ago

sorry, Doris do not support use distinct aggregate function as analytic function now.

siriume commented 2 years ago

sorry, Doris do not support use distinct aggregate function as analytic function now.

documents says its support https://doris.apache.org/docs/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-COUNT/

morrySnow commented 2 years ago

i think document has a mistake on it. i has review the code. it is not support yet.

LemonLiTree commented 2 years ago

Thank you for your question,I find this is an error in the document. and I will modify the document.