cloud-fan commented on a change in pull request #25697: [SPARK-28997][SQL] Add
`spark.sql.dialect`
URL: https://github.com/apache/spark/pull/25697#discussion_r327683551
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
##########
@@ -65,16 +65,27 @@ object StringUtils extends Logging {
"(?s)" + out.result() // (?s) enables dotall mode, causing "." to match
new lines
}
- // "true", "yes", "1", "false", "no", "0", and unique prefixes of these
strings are accepted.
private[this] val trueStrings =
- Set("true", "tru", "tr", "t", "yes", "ye", "y", "on",
"1").map(UTF8String.fromString)
+ Set("t", "true", "y", "yes", "1").map(UTF8String.fromString)
+ // "true", "yes", "1", "false", "no", "0", and unique prefixes of these
strings are accepted.
+ private[this] val trueStringsOfPostgreSQL =
+ Set("true", "tru", "tr", "t", "yes", "ye", "y", "on", "1").map
(UTF8String.fromString)
private[this] val falseStrings =
+ Set("f", "false", "n", "no", "0").map(UTF8String.fromString)
+ private[this] val falseStringsOfPostgreSQL =
Set("false", "fals", "fal", "fa", "f", "no", "n", "off", "of",
"0").map(UTF8String.fromString)
// scalastyle:off caselocale
- def isTrueString(s: UTF8String): Boolean =
trueStrings.contains(s.toLowerCase.trim())
- def isFalseString(s: UTF8String): Boolean =
falseStrings.contains(s.toLowerCase.trim())
+ def isTrueString(s: UTF8String): Boolean =
trueStrings.contains(s.toLowerCase)
+
+ def isFalseString(s: UTF8String): Boolean =
falseStrings.contains(s.toLowerCase)
+
+ def postgreIsTrueString(s: UTF8String): Boolean =
Review comment:
shall we move it to a `PostgreStringUtils`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]