[GitHub] [spark] dcoliversun commented on a diff in pull request #36666: [SPARK-39289][CORE][SQL][SS] Replace `map(_.toBoolean).getOrElse(false/true)` with `exists/forall(_.toBoolean)`
dcoliversun commented on code in PR #3: URL: https://github.com/apache/spark/pull/3#discussion_r884194187 ## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JSONOptions.scala: ## @@ -54,31 +54,31 @@ private[sql] class JSONOptions( val samplingRatio = parameters.get("samplingRatio").map(_.toDouble).getOrElse(1.0) val primitivesAsString = -parameters.get("primitivesAsString").map(_.toBoolean).getOrElse(false) +parameters.get("primitivesAsString").exists(_.toBoolean) Review Comment: OK. I close this PR. Thanks! @srowen @HyukjinKwon -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] dcoliversun commented on a diff in pull request #36666: [SPARK-39289][CORE][SQL][SS] Replace `map(_.toBoolean).getOrElse(false/true)` with `exists/forall(_.toBoolean)`
dcoliversun commented on code in PR #3: URL: https://github.com/apache/spark/pull/3#discussion_r884052028 ## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JSONOptions.scala: ## @@ -54,31 +54,31 @@ private[sql] class JSONOptions( val samplingRatio = parameters.get("samplingRatio").map(_.toDouble).getOrElse(1.0) val primitivesAsString = -parameters.get("primitivesAsString").map(_.toBoolean).getOrElse(false) +parameters.get("primitivesAsString").exists(_.toBoolean) Review Comment: It's worth sacrificing performance for readability. If we agree that `exists/forall` is not easier to read, I will close this PR and keep it as it is. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org