'count distinct window function Databricks

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source