Below spark code to load json file is failing sometimes. Json files always have utf-8 encoding only. Our spark jar is invoked thru AbInitio Graph which is scheduled to run in TWS. Backend execution runs fine but running thru TWS gives this error sometimes.
code:
val fs = filePath.getFileSystem(spark.sparkContext.hadoopConfiguration)
val inputFromFile = fs.open(filePath)
def readLines = scala.io.Source.fromInputStream(inputFromFile)
Error:
Exception in thread "main" java.nio.charset.MalformedInputException: Input length = 1