SailajaB
Databricks Partner

Because I think THEN and ELSE expressions should have same type. I think yes

But we don't need to convert {"test":[]} to {"test":[{"nestedattr1":"","columnfield":""}]}

If we get test as an empty array we should avoid this conversion

If we get test as {"test":[{"nestedattr1":"df","columnfield":"er"}] then we have to proceed with conversion

Is there any way to achieve this? mostly at schema level instead of at each column level