How to replace map with null if key is null in spark dataframe.
DF.printSchema
-- sku_id: string (nullable = true)
-- sku_images: map (nullable = true)
-- key: string
-- value: struct (valueContainsNull = true)
-- image_id: string (nullable = true)
-- image_name: string (nullable = true)
-- image_path: string (nullable = true)
11111111|Map(null -> [null,null,null])
22222222|Map(null -> [null,null,null])
33333333|Map(largeImage_1 -> [111,222,test data])
expected output :-
11111111|null
22222222|null
33333333|Map(largeImage_1 -> [111,222,loading test data])
Thanks,
nullkeys forMapTypeobjects so it just not possible to get there. If anything, you can have literal string"null"there. Please post a minimal reproducible example!