[英]_corrupt_record error when reading a JSON file into Spark
[英]Unable to load Complex JSON Spark HQL - _corrupt_record error
我試圖在Spark HQL中加載以下JSON文件,但無法成功加載。 給出_corrupt_record錯誤。
任何人都可以闡明這個錯誤嗎? 我可以閱讀該文件並將其與其他應用程序一起使用,例如Notepad ++(JSTool插件),我相信它是正確的並且沒有損壞。
{"markers": [ { "point":new GLatLng(40.266044,-74.718479), "homeTeam":"Lawrence Library", "awayTeam":"LUGip", "markerImage":"images/red.png", "information": "Linux users group meets second Wednesday of each month.", "fixture":"Wednesday 7pm", "capacity":"", "previousScore":"" }, { "point":new GLatLng(40.211600,-74.695702), "homeTeam":"Hamilton Library", "awayTeam":"LUGip HW SIG", "markerImage":"images/white.png", "information": "Linux users can meet the first Tuesday of the month to work out harward and configuration issues.", "fixture":"Tuesday 7pm", "capacity":"", "tv":"" }, { "point":new GLatLng(40.294535,-74.682012), "homeTeam":"Applebees", "awayTeam":"After LUPip Mtg Spot", "markerImage":"images/newcastle.png", "information": "Some of us go there after the main LUGip meeting, drink brews, and talk.", "fixture":"Wednesday whenever", "capacity":"2 to 4 pints", "tv":"" }, ] }
您的JSON應該在每個對象的一行中
{ object1 }
{ object2 }
默認情況下,僅支持此結構read.json
。 如果您想讀取多行JSON,則可以通過sparkContext.wholeTextFiles
和手動解析來實現
在文檔中是text :
請注意,以json文件形式提供的文件不是典型的JSON文件。 每行必須包含一個單獨的,自包含的有效JSON對象。 因此,常規的多行JSON文件通常會失敗。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.