Hubert-Dudek
Databricks MVP

Probably it could be achieved also in pure SPARK SQL using

if(expr1, expr2, expr3)

so expr1 we check is there rows, expr2 we return union, expr3 we return . Not sure it will work, I can check it later.


My blog: https://databrickster.medium.com/