You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2014/12/02 01:39:58 UTC
spark git commit: [SPARK-4268][SQL] Use #::: to get benefit from
Stream in SqlLexical.allCaseVersions
Repository: spark
Updated Branches:
refs/heads/master 4df60a8cb -> d3e02dddf
[SPARK-4268][SQL] Use #::: to get benefit from Stream in SqlLexical.allCaseVersions
In addition, using `s.isEmpty` to eliminate the string comparison.
Author: zsxwing <zs...@gmail.com>
Closes #3132 from zsxwing/SPARK-4268 and squashes the following commits:
358e235 [zsxwing] Improvement of allCaseVersions
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d3e02ddd
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d3e02ddd
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d3e02ddd
Branch: refs/heads/master
Commit: d3e02dddf06c82e4baa8708050be291d87d4f367
Parents: 4df60a8
Author: zsxwing <zs...@gmail.com>
Authored: Mon Dec 1 16:39:54 2014 -0800
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Mon Dec 1 16:39:54 2014 -0800
----------------------------------------------------------------------
.../scala/org/apache/spark/sql/catalyst/SparkSQLParser.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/d3e02ddd/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SparkSQLParser.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SparkSQLParser.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SparkSQLParser.scala
index b198ed9..f1a1ca6 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SparkSQLParser.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SparkSQLParser.scala
@@ -97,10 +97,10 @@ class SqlLexical(val keywords: Seq[String]) extends StdLexical {
/** Generate all variations of upper and lower case of a given string */
def allCaseVersions(s: String, prefix: String = ""): Stream[String] = {
- if (s == "") {
+ if (s.isEmpty) {
Stream(prefix)
} else {
- allCaseVersions(s.tail, prefix + s.head.toLower) ++
+ allCaseVersions(s.tail, prefix + s.head.toLower) #:::
allCaseVersions(s.tail, prefix + s.head.toUpper)
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org