Files
greptimedb/tests/cases/standalone/common/function/count_hash.sql
Ruihang Xia e728cb33fb feat: implement count_hash aggr function (#6342)
* feat: implement count_hash aggr function

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* sqlness case

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* change copyright year

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* review changes

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2025-06-25 12:14:03 +00:00

37 lines
428 B
SQL

create table
t (
ts timestamp time index,
`id` int,
`name` string,
PRIMARY KEY (`id`),
);
insert into
t (ts, `id`, `name`)
values
(1, 1, 'a'),
(2, 2, 'b'),
(3, 3, 'c'),
(4, 4, 'd');
select
count_hash (`id`)
from
t;
select
count_hash (`id`)
from
t
group by
`name`;
select
count_hash (`id`, `name`)
from
t
group by
ts;
drop table t;