Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:44 AM
I was having a similar issue in using .rdd.map()
Solved it by adding two key value pairs in the spark config for the cluster
spark.databricks.pyspark.enablePy4JSecurity false
spark.databricks.pyspark.trustedFilesystems org.apache.spark.api.java.JavaRDD
After this I was able to read the schema of the json from the column that was read as string
json_schema = spark.read.json(df.rdd.map(lambda row: row.preferences)).schema
print(json_schema)