Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df.show()
- +--------------------+--------------------+----+--------+---------+--------------------+--------+--------------------+
- | address| coordinates| id|latitude|longitude| name|position| json|
- +--------------------+--------------------+----+--------+---------+--------------------+--------+--------------------+
- |Balfour St / Brun...|[-27.463431, 153....|79.0| null| null|79 - BALFOUR ST /...| null|[-27.463431, 153....|
- +--------------------+--------------------+----+--------+---------+--------------------+--------+--------------------+
- val jsonSchema = StructType(Seq(
- StructField("latitude", DoubleType, nullable = true),
- StructField("longitude", DoubleType, nullable = true)))
- val a = df.select(from_json(col("json"), jsonSchema) as "content")
- a.show() gives me :
- +-------+
- |content|
- +-------+
- | null|
- +-------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement