[
https://issues.apache.org/jira/browse/SPARK-58640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Uroš Bojanić reassigned SPARK-58640:
------------------------------------
Assignee: Uroš Bojanić
> Align getBool with the sibling option accessors in CSVOptions and XmlOptions
> ----------------------------------------------------------------------------
>
> Key: SPARK-58640
> URL: https://issues.apache.org/jira/browse/SPARK-58640
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 4.3.0
> Reporter: Uroš Bojanić
> Assignee: Uroš Bojanić
> Priority: Major
> Labels: pull-request-available
>
> getBool in CSVOptions and XmlOptions is an if/else-if chain over a string
> obtained with parameters.getOrElse(paramName, default.toString), while the
> sibling accessors in CSVOptions (getChar and getInt) match on
> parameters.get(paramName) and handle the missing and null cases as case None
> and case Some(null).
> This rewrites getBool in both files to the sibling shape. Besides being
> consistent, it avoids converting the default to a string only to parse it
> back, and evaluates toLowerCase once instead of twice.
> Behavior is unchanged for every input: an absent key yields the default, an
> explicit null value yields the default, true and false are accepted case
> insensitively via Locale.ROOT, and any other value throws the same error as
> before. The two files carried identical copies of this method, so both are
> updated to keep them in sync.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]