MaxGekk commented on code in PR #44900:
URL: https://github.com/apache/spark/pull/44900#discussion_r1467480671
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ParseMode.scala:
##########
@@ -47,12 +47,17 @@ object ParseMode extends Logging {
/**
* Returns the parse mode from the given string.
*/
- def fromString(mode: String): ParseMode = mode.toUpperCase(Locale.ROOT)
match {
- case PermissiveMode.name => PermissiveMode
- case DropMalformedMode.name => DropMalformedMode
- case FailFastMode.name => FailFastMode
- case _ =>
- logWarning(s"$mode is not a valid parse mode. Using
${PermissiveMode.name}.")
- PermissiveMode
+ def fromString(mode: String): ParseMode = Option(mode).map {
+ v => v.toUpperCase(Locale.ROOT) match {
+ case PermissiveMode.name => PermissiveMode
+ case DropMalformedMode.name => DropMalformedMode
+ case FailFastMode.name => FailFastMode
+ case _ =>
+ logWarning(s"$v is not a valid parse mode. Using
${PermissiveMode.name}.")
+ PermissiveMode
+ }
+ }.getOrElse {
+ logWarning(s"mode is null and not a valid parse mode. Using
${PermissiveMode.name}.")
+ PermissiveMode
Review Comment:
Shouldn't we show an error on the wrong error instead of silently fallback
to the `PERMISSIVE` mode? cc @HyukjinKwon
I mean both case - null and a wrong mode.
--
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]