panbingkun commented on code in PR #43751: URL: https://github.com/apache/spark/pull/43751#discussion_r1505586754
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala: ########## @@ -107,27 +107,82 @@ object StringUtils extends Logging { def isFalseString(s: UTF8String): Boolean = falseStrings.contains(s.trimAll().toLowerCase) // scalastyle:on caselocale + def getAllMatchWildcard: String = { + if (SQLConf.get.legacyUseStarAndVerticalBarAsWildcardsInLikePattern) { + "*" + } else { + "%" + } + } + + def filterPattern(names: Seq[String], pattern: String): Seq[String] = { + if (SQLConf.get.legacyUseStarAndVerticalBarAsWildcardsInLikePattern) { + filterPatternLegacy(names, pattern) + } else { + filterBySQLLikePattern(names, pattern) + } + } + /** - * This utility can be used for filtering pattern in the "Like" of "Show Tables / Functions" DDL + * This legacy utility can be used for filtering pattern in the "Like" of + * "Show Tables / Functions" DDL. * @param names the names list to be filtered * @param pattern the filter pattern, only '*' and '|' are allowed as wildcards, others will * follow regular expression convention, case insensitive match and white spaces * on both ends will be ignored * @return the filtered names list in order */ - def filterPattern(names: Seq[String], pattern: String): Seq[String] = { + def filterPatternLegacy(names: Seq[String], pattern: String): Seq[String] = { Review Comment: Only rename `XXX` to `legacyXXX`. -- 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