I am trying to build a schema to load the contents of a file which contains the following things-
- movie_id, String
- movie_name, String
- plot, String
- genre, an array of strings
Here is my schema definition-
customSchema = types.StructType(types.ArrayType(
types.StructField("movie_id", types.StringType(), True),
types.StructField("movie_name", types.StringType(), True),
types.StructField("plot", types.StringType(), True),
types.StructField('genre',
types.ArrayType(types.StringType()), True),
))
Here is the error that I am getting
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-290-10452c69a6ff> in <module>()
3 types.StructField("movie_name", types.StringType(), True),
4 types.StructField("plot", types.StringType(), True),
----> 5 types.StructField('genre', types.ArrayType(types.StringType()), True),
6 ))
TypeError: __init__() takes from 2 to 3 positional arguments but 5 were given
