The problem is quite simple, you have a DataFrame with a schema different to the one of the table where you are writing. So the insertion fails. You have to insert the data into a table from a DataFrame with the same schema. Here you have two options: either you create the table according to the schema of your dataframe (ie. having "spec struct<color:string, type:string>" instead of "mapTest") or you transform your dataframe by adding a column "mapTest" which should be a "map<string, string>" and dropping the extra "spec" column.