Infosys Interview Question

Explode in SQL, optimisations in spark