cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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
Databricks Employee
Databricks Employee

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group