-werners-
Esteemed Contributor III

try with the percentile function, as median = percentile 50:

https://spark.apache.org/docs/latest/api/sql/#percentile