我JSON數據,如圖如何在spark sql中以map的形式加載json數據?
"vScore": {
"300x600": {
"v1": "0.50",
"v2": "0.67",
"v3": "ATF",
"v4": "H2",
"v5": "0.11"
},
"728x90": {
"v1": "0.48",
"v2": "0.57",
"v3": "Unknown",
"v4": "H2",
"v5": "0.51"
},
"300x250": {
"v1": "0.64",
"v2": "0.77",
"v3": "ATF",
"v4": "H2",
"v5": "0.70"
},
我想,這樣的300x250成爲關鍵和嵌套V1在我想要加載vScores在地圖MAP IE的形式加載該JSON數據... V5成爲地圖的價值。 如何在斯卡拉spark sql中做到這一點?
我嘗試使用read.json()來加載JSON文件,然後試圖用日電子火花SQL查詢(「選擇地圖(vscores)從DF」) – satyambansal117