I am implementing count distinct window functions in Databricks.
select *,count(distinct Marks) over(partition by Name) from data
It seems that count distinct is not supported in Databricks, how can I replicate the same query in databricks.
Using collect_set
+ size
functions:
select *, size(collect_set(Marks)) over(partition by Name) from data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.