Dataset<Row> SourcePropertSet = sqlContext.read()
.format("com.crealytics.spark.excel")
.option("location", "E:\\XLS\\NEWFILE.xlsx")
.option("useHeader", "false")
.option("treatEmptyValuesAsNulls", "true")
.option("inferSchema", "true")
.option("addColorColumns", "false")
.load();
SourcePropertSet = SourcePropertSet.repartition(1).select("*")
.write().option("treatEmptyValuesAsNulls", "true")
.format("org.zuinnote.spark.office.excel")
.mode(SaveMode.Overwrite)
.save("E:\\XLS\\NEWFILE1.xlsx");
For the above code is there any other options to consider null values while writing to the xslx format.
I'm getting scala.MatchError: null exception raised, if the particular column contains any null values.
The Possible solution to resolve is either by putting right logic code or look for .options or is there any other package to do so in .xslx format?
对于上面的代码,在编写到xslx格式时是否还有其他可以考虑空值的选项。我得到scala。如果特定列包含任何空值,则会引发null异常。可以通过放置正确的逻辑代码或查找.options来解决这个问题,或者是否有其他的包可以使用.xslx格式来解决这个问题?
2 个解决方案
#1
1
Please check the version of HadoopOffice (currently 1.0.4), in particular for the DS (https://github.com/ZuInnoTe/spark-hadoopoffice-ds). Also, some of the parameters do not exist, so please check the documentation. It is also faster to create an issue directly with the project on Github to get these things sorted out.
请查看HadoopOffice版本(目前为1.0.4),特别是DS (https://github.com/zuinnote/spark -hadoop - DS)。另外,有些参数不存在,请检查文档。直接与Github上的项目创建一个问题来解决这些问题也会更快。
#2
0
.na().fill(" "); .show(false);
This code resolves null values issues. In the previous version of “org.zuinnote.spark.office.excel” package
此代码解决空值问题。在前一个版本的“org. zuinnote.sparkoffice”中。excel”包
#1
1
Please check the version of HadoopOffice (currently 1.0.4), in particular for the DS (https://github.com/ZuInnoTe/spark-hadoopoffice-ds). Also, some of the parameters do not exist, so please check the documentation. It is also faster to create an issue directly with the project on Github to get these things sorted out.
请查看HadoopOffice版本(目前为1.0.4),特别是DS (https://github.com/zuinnote/spark -hadoop - DS)。另外,有些参数不存在,请检查文档。直接与Github上的项目创建一个问题来解决这些问题也会更快。
#2
0
.na().fill(" "); .show(false);
This code resolves null values issues. In the previous version of “org.zuinnote.spark.office.excel” package
此代码解决空值问题。在前一个版本的“org. zuinnote.sparkoffice”中。excel”包