Update:
Response from the Databricks Team.
Symptoms
Internal Error During Spark SQL Phase Optimization.
Cause
DataBricks PG Engineering team confirmed that this is indeed a bug in CASE WHEN optimization & they are working on the fix for this issue.
Resolution
The fix has been merged and it will soon be available in runtime. Once merged, we await the deployment of version 16.1. The ETA for the fix for this issue with the new DBR 16.1 is mid-January.
Thanks,
Boitumelo