cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle Blank values in Array of struct elements in pyspark

Anbazhagananbut
New Contributor II

Hello All,

We have a data in a column in pyspark dataframe having array of struct type

having multiple nested fields present.if the value is not blank it will save

the data in the same array of struct type in spark delta table.

please advise on the below case:

if the same column coming as blank ,it is treated as array<string> in the

dataframe.

f the same column coming as array of struct elements it is fine.

Could you please advise how do we handle this scenario in pyspark to avoid

the error "Failed to merge incompatible data types StructType(StructField(ac

...................... and StringType

how do we handle array of struct type and array<string> in the same column

Thanks

1 REPLY 1

shyam_9
Valued Contributor
Valued Contributor