File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ class JacksonParser(
367367 if (badRecordException.isEmpty) {
368368 row
369369 } else {
370- throw BadRecordException (() => UTF8String . EMPTY_UTF8 , () => Some ( row) , badRecordException.get)
370+ throw PartialResultException ( row, badRecordException.get)
371371 }
372372 }
373373
@@ -439,8 +439,11 @@ class JacksonParser(
439439 val wrappedCharException = new CharConversionException (msg)
440440 wrappedCharException.initCause(e)
441441 throw BadRecordException (() => recordLiteral(record), () => None , wrappedCharException)
442- case e : BadRecordException =>
443- throw e.copy(record = () => recordLiteral(record))
442+ case PartialResultException (row, cause) =>
443+ throw BadRecordException (
444+ record = () => recordLiteral(record),
445+ partialResult = () => Some (row),
446+ cause)
444447 }
445448 }
446449}
Original file line number Diff line number Diff line change @@ -20,6 +20,16 @@ package org.apache.spark.sql.catalyst.util
2020import org .apache .spark .sql .catalyst .InternalRow
2121import org .apache .spark .unsafe .types .UTF8String
2222
23+ /**
24+ * Exception thrown when the underlying parser returns a partial result of parsing.
25+ * @param partialResult the partial result of parsing a bad record.
26+ * @param cause the actual exception about why the parser cannot return full result.
27+ */
28+ case class PartialResultException (
29+ partialResult : InternalRow ,
30+ cause : Throwable )
31+ extends Exception (cause)
32+
2333/**
2434 * Exception thrown when the underlying parser meet a bad record and can't parse it.
2535 * @param record a function to return the record that cause the parser to fail
You can’t perform that action at this time.
0 commit comments