aviyehuda commented on code in PR #56787:
URL: https://github.com/apache/spark/pull/56787#discussion_r3490027549
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/UnivocityParser.scala:
##########
@@ -219,11 +225,11 @@ class UnivocityParser(
}
case _: BooleanType => (d: String) =>
- nullSafeDatum(d, name, nullable, options)(_.toBoolean)
+ nullSafeDatum(d, name, nullable,
options)(retryWithTrim[Boolean](_.toBoolean))
case dt: DecimalType => (d: String) =>
nullSafeDatum(d, name, nullable, options) { datum =>
- Decimal(decimalParser(datum), dt.precision, dt.scale)
+ retryWithTrim(d => Decimal(decimalParser(d), dt.precision,
dt.scale))(datum)
Review Comment:
Also addressed by trimming before decimalParser instead of relying on
exception retry. Non-US locales throw SparkRuntimeException from DecimalFormat,
which retryWithTrim did not catch; trimming first works for both US and non-US
paths. Added UnivocityParserSuite coverage for spaced decimals under de-DE and
other locales.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]