File tree Expand file tree Collapse file tree 2 files changed +15
-27
lines changed
catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml
core/src/main/scala/org/apache/spark/sql/execution/datasources/xml Expand file tree Collapse file tree 2 files changed +15
-27
lines changed Original file line number Diff line number Diff line change @@ -1007,7 +1007,7 @@ class XmlTokenizer(
1007
1007
}
1008
1008
}
1009
1009
1010
- object StaxXmlParser {
1010
+ object StaxXmlParser extends Logging {
1011
1011
/**
1012
1012
* Parses a stream that contains CSV strings and turns it into an iterator of tokens.
1013
1013
*/
@@ -1050,14 +1050,16 @@ object StaxXmlParser {
1050
1050
}
1051
1051
}
1052
1052
} catch {
1053
- case e : Throwable =>
1053
+ case e : FileNotFoundException if options.ignoreMissingFiles =>
1054
+ logWarning(" Skipped missing file" , e)
1055
+ Iterator .empty
1056
+ case NonFatal (e) =>
1054
1057
SparkErrorUtils .getRootCause(e) match {
1055
- case _ : IOException | _ : RuntimeException | _ : InternalError
1056
- if options.ignoreCorruptFiles =>
1057
- Iterator .empty
1058
- case _ : FileNotFoundException if options.ignoreMissingFiles =>
1058
+ case _ : RuntimeException | _ : IOException | _ : InternalError
1059
+ if options.ignoreCorruptFiles =>
1060
+ logWarning(" Skipped the rest of the content in the corrupted file" , e)
1059
1061
Iterator .empty
1060
- case _ => throw e
1062
+ case o => throw o
1061
1063
}
1062
1064
}
1063
1065
Original file line number Diff line number Diff line change @@ -235,26 +235,12 @@ object MultiLineXmlDataSource extends XmlDataSource {
235
235
236
236
val xmlParserRdd : RDD [StaxXMLRecordReader ] =
237
237
xml.flatMap { portableDataStream =>
238
- try {
239
- val inputStream = () =>
240
- CodecStreams .createInputStreamWithCloseResource(
241
- portableDataStream.getConfiguration,
242
- new Path (portableDataStream.getPath())
243
- )
244
- StaxXmlParser .convertStream(inputStream, parsedOptions)(identity)
245
- } catch {
246
- case e : FileNotFoundException if parsedOptions.ignoreMissingFiles =>
247
- logWarning(" Skipped missing file" , e)
248
- None
249
- case NonFatal (e) =>
250
- Utils .getRootCause(e) match {
251
- case _ : RuntimeException | _ : IOException | _ : InternalError
252
- if parsedOptions.ignoreCorruptFiles =>
253
- logWarning(" Skipped the rest of the content in the corrupted file" , e)
254
- None
255
- case o => throw o
256
- }
257
- }
238
+ val inputStream = () =>
239
+ CodecStreams .createInputStreamWithCloseResource(
240
+ portableDataStream.getConfiguration,
241
+ new Path (portableDataStream.getPath())
242
+ )
243
+ StaxXmlParser .convertStream(inputStream, parsedOptions)(identity)
258
244
}
259
245
260
246
SQLExecution .withSQLConfPropagated(sparkSession) {
You can’t perform that action at this time.
0 commit comments