I'm opening a bunch of files (around 50) at HDFS like this:
val PATH = path_to_files
val FILE_PATH = "PATH+nt_uuid_2016-03-01.*1*.avro"
val df = sqlContext.read.avro(FILE_PATH)
I then do a bunch of operations with df
and at some point I get:
java.io.IOException: Not an Avro data file
at org.apache.avro.file.DataFileReader.openReader(DataFileReader.java:50)
at org.apache.avro.mapred.AvroRecordReader.(AvroRecordReader.java:41)
at org.apache.avro.mapred.AvroInputFormat.getRecordReader(AvroInputFormat.java:71)
at org.apache.spark.rdd.HadoopRDD$$anon$1.(HadoopRDD.scala:237)
at org.apache.spark.rdd.HadoopRDD.compute(HadoopRDD.scala:208)
at org.apache.spark.rdd.HadoopRDD.compute(HadoopRDD.scala:101)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
I suspect maybe there is an issue with one of the files, but I don't know which one. If I run with one of them, the job finishes correctly.
Is there a way to catch the exception and figure out which is the bad apple?