Re: [PR] [SPARK-43815][SQL] Wrap NPE with AnalysisException in CSV options [spark]
HyukjinKwon commented on code in PR #46626: URL: https://github.com/apache/spark/pull/46626#discussion_r1604232424 ## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVOptions.scala: ## @@ -149,7 +149,12 @@ class CSVOptions( parameters.getOrElse(DateTimeUtils.TIMEZONE_OPTION, defaultTimeZoneId)) // A language tag in IETF BCP 47 format - val locale: Locale = parameters.get(LOCALE).map(Locale.forLanguageTag).getOrElse(Locale.US) + val locale: Locale = try { +parameters.get(LOCALE).map(Locale.forLanguageTag).getOrElse(Locale.US) + } catch { +case _: NullPointerException => Review Comment: and this issue should exist in almost all other options. Would probably be best to fix them together -- 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
Re: [PR] [SPARK-43815][SQL] Wrap NPE with AnalysisException in CSV options [spark]
HyukjinKwon commented on code in PR #46626: URL: https://github.com/apache/spark/pull/46626#discussion_r1604232182 ## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVOptions.scala: ## @@ -149,7 +149,12 @@ class CSVOptions( parameters.getOrElse(DateTimeUtils.TIMEZONE_OPTION, defaultTimeZoneId)) // A language tag in IETF BCP 47 format - val locale: Locale = parameters.get(LOCALE).map(Locale.forLanguageTag).getOrElse(Locale.US) + val locale: Locale = try { +parameters.get(LOCALE).map(Locale.forLanguageTag).getOrElse(Locale.US) + } catch { +case _: NullPointerException => Review Comment: Can we check if the value is `null`, and throw an exception instead? -- 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