Я сохранил данные json из url в json-файл с именем urljson.json в искровой папке. и выполнил сильфон кода для создания кадра данных на нем этимПоврежденная запись в pyspark После создания фрейма данных из сохраненного файла json
path="urljson.json/"
testdf1=spark.read.json(path)
testdf1.show()
я получил это
после выполнения
tesdf1.printSchema()
сильфона формата показывает корня | --_corrupt_record: string (nullable = true)
Как я мог решить эту проблему каких-либо указаний будет высоко оценен я использую искру 2.0
мои данные JSON выглядит так, что очень большой я отправил часть его
result:[{"BldgID":"1006AVE ","BldgName":"100-6th Avenue SW (Oddfellows) ","BldgCity":"Calgary ","BldgState":"AB ","BldgZip":"T2G 2C4 ","BldgAddress1":"100-6th Avenue Southwest ","BldgAddress2":"ZZZ None","BldgPhone":"4035439600 ","BldgLandlord":"1006AV","BldgLandlordName":"100-6 TH Avenue SW Inc. ","BldgManager":"AVANDE","BldgManagerName":"Alyssa Van de Vorst ","BldgManagerType":"Internal","BldgGLA":"34242","BldgEntityID":"1006AVE ","BldgInactive":"N","BldgPropType":"ZZZ None","BldgPropTypeDesc":"ZZZ None","BldgPropSubType":"ZZZ None","BldgPropSubTypeDesc":"ZZZ None","BldgRetailFlag":"N","BldgEntityType":"REIT ","BldgCityName":"Calgary ","BldgDistrictName":"Downtown ","BldgRegionName":"Western Canada ","BldgAccountantID":"KKAUN ","BldgAccountantName":"Kendra Kaun ","BldgAccountantMgrID":"LVALIANT ","BldgAccountantMgrName":"Lorretta Valiant ","BldgFASBStartDate":"2012-10-24","BldgFASBStartDateStr":"2012-10-24"},{"BldgID":"1007AVE ","BldgName":"100-7th Avenue Southwest-Art Central ","BldgCity":"Calgary ","BldgState":"AB ","BldgZip":"T2P 0W4 ","BldgAddress1":"100-7th Avenue Southwest ","BldgAddress2":"ZZZ None","BldgPhone":"4035439600 ","BldgLandlord":"1007AV","BldgLandlordName":"100-7th Avenue SW (Art Central) Inc. ","BldgManager":"LPATER","BldgManagerName":"Lyndsey Paterson ","BldgManagerType":"Internal","BldgGLA":"27127","BldgEntityID":"1007AVE ","BldgInactive":"N","BldgPropType":"ZZZ None","BldgPropTypeDesc":"ZZZ None","BldgPropSubType":"ZZZ None","BldgPropSubTypeDesc":"ZZZ None","BldgRetailFlag":"N","BldgEntityType":"Property Under Dev't ","BldgCityName":"Calgary ","BldgDistrictName":"Downtown ","BldgRegionName":"Western Canada ","BldgAccountantID":"ABRITTON ","BldgAccountantName":"Angie Britton ","BldgAccountantMgrID":"ZZZ None","BldgAccountantMgrName":"ZZZ None","BldgFASBStartDate":"2011-09-01","BldgFASBStartDateStr":"2011-09-01"},{"BldgID":"100LOMB ","BldgName":"100 Lombard Street ","BldgCity":"Toronto ","BldgState":"ON ","BldgZip":"M5C 1M3 ","BldgAddress1":"100 Lombard Street ","BldgAddress2":"ZZZ None","BldgPhone":"4169779002 ","BldgLandlord":"100LOM","BldgLandlordName":"100 Lombard Street Inc. ","BldgManager":"TCHALM","BldgManagerName":"Tiffany Chalmers ","BldgManagerType":"Internal","BldgGLA":"43697.64","BldgEntityID":"100LOMB ","BldgInactive":"N","BldgPropType":"ZZZ None","BldgPropTypeDesc":"ZZZ None","BldgPropSubType":"ZZZ None","BldgPropSubTypeDesc":"ZZZ None","BldgRetailFlag":"N","BldgEntityType":"REIT ","BldgCityName":"Toronto ","BldgDistrictName":"Queen - Richmond ","BldgRegionName":"Central Canada ","BldgAccountantID":"MALLORDE ","BldgAccountantName":"May Ann Allorde ","BldgAccountantMgrID":"TTSANG ","BldgAccountantMgrName":"Tony Tsang ","BldgFASBStartDate":"2005-11-01","BldgFASBStartDateStr":"2005-11-01"},{"BldgID":"10190104","BldgName":"10190-104th Street NW-The Metals Buildi ","BldgCity":"Edmonton ","BldgState":"AB ","BldgZip":"T5J 1A7 ","BldgAddress1":"10190-104st Street SW ","BldgAddress2":"ZZZ None","BldgPhone":"7804234400 ","BldgLandlord":"10190 ","BldgLandlordName":"10190-104 Street Inc. ","BldgManager":"NEWWES","BldgManagerName":"New West Enterprise Property ","BldgManagerType":"Third ","BldgGLA":"20447.75","BldgEntityID":"10190104","BldgInactive":"N","BldgPropType":"ZZZ None","BldgPropTypeDesc":"ZZZ None","BldgPropSubType":"ZZZ None","BldgPropSubTypeDesc":"ZZZ None","BldgRetailFlag":"N","BldgEntityType":"REIT ","BldgCityName":"Edmonton ","BldgDistrictName":"Edmonton ","BldgRegionName":"Western Canada ","BldgAccountantID":"RYANG ","BldgAccountantName":"Raymond Yang ","BldgAccountantMgrID":"LVALIANT ","BldgAccountantMgrName":"Lorretta Valiant ","BldgFASBStartDate":"2011-08-08","BldgFASBStartDateStr":"2011-08-08"}]
сложно сказать, не зная, как выглядит ваш json-файл. – mtoto
проблема заключается в том, что json-документ не находится в одной строке, и в ваших json-документах есть новые строковые символы. –
Пожалуйста, разместите свой Json File для получения более подробной информации, в большинстве случаев проблема точно такая, как описывается @RajatMishra! –