You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "uros-b (via GitHub)" <gi...@apache.org> on 2026/08/07 11:03:08 UTC
[PR] [SPARK-58640][SQL] Align getBool with the sibling option accessors in CSVOptions and XmlOptions [spark]
uros-b opened a new pull request, #57847:
URL: https://github.com/apache/spark/pull/57847
### What changes were proposed in this pull request?
Rewrites the private `getBool` in `CSVOptions` and `XmlOptions` to match the shape of the sibling option accessors:
```scala
private def getBool(paramName: String, default: Boolean = false): Boolean = {
val paramValue = parameters.get(paramName)
paramValue match {
case None => default
case Some(null) => default
case Some(value) => value.toLowerCase(Locale.ROOT) match {
case "true" => true
case "false" => false
case _ => throw QueryExecutionErrors.paramIsNotBooleanValueError(paramName)
}
}
}
```
### Why are the changes needed?
`getChar` and `getInt` in `CSVOptions` already match on `parameters.get(paramName)` and handle the missing and null cases as `case None` and `case Some(null)`, while `getBool` was an if/else-if chain over `parameters.getOrElse(paramName, default.toString)`. Besides being inconsistent, that form converts the default to a string only to parse it straight back, and calls `toLowerCase` twice on the `false` and error paths.
`XmlOptions` carried a byte-identical copy of the old method, so both are updated together to keep them in sync rather than leaving them divergent.
### Does this PR introduce _any_ user-facing change?
No. Behavior is unchanged for every input: an absent key yields the default, an explicit `null` value yields the default, `true`/`false` are accepted case-insensitively via `Locale.ROOT`, and any other value throws the same error with the same parameter as before.
### How was this patch tested?
Behavior-preserving change covered by the existing CSV and XML option tests. Equivalence with the previous implementation was checked case by case across absent keys, explicit nulls, mixed-case `true`/`false`, the empty string, and other invalid values, for both `default` values.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-58640][SQL] Align getBool with the sibling option accessors in CSVOptions and XmlOptions [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #57847:
URL: https://github.com/apache/spark/pull/57847#issuecomment-5219373272
Thank you @cloud-fan!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-58640][SQL] Align getBool with the sibling option accessors in CSVOptions and XmlOptions [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b closed pull request #57847: [SPARK-58640][SQL] Align getBool with the sibling option accessors in CSVOptions and XmlOptions
URL: https://github.com/apache/spark/pull/57847
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-58640][SQL] Align getBool with the sibling option accessors in CSVOptions and XmlOptions [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #57847:
URL: https://github.com/apache/spark/pull/57847#issuecomment-5219380507
**Merge Summary:**
- merged into master https://github.com/apache/spark/commit/551a78334de9fe2d5cd6aa6a3dc5d4596c79dadb
- merged into branch-4.x https://github.com/apache/spark/commit/425614387b3e1df2a03fcbce5a5aecec7c8a8c6c
- merged into branch-4.3 https://github.com/apache/spark/commit/17a82a6e96f7c9df41782a67828bda5dd4be71a0
*Posted by `merge_spark_pr.py`*
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org