diff options
author | chutium <teng.qiu@gmail.com> | 2014-07-19 11:04:41 -0500 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2014-07-19 11:04:41 -0500 |
commit | 2a732110d46712c535b75dd4f5a73761b6463aa8 (patch) | |
tree | 10bc3ea45164bb4e1ec0f5f31dd74919023fe56d /sql/core/src | |
parent | 805f329bb1535ef4b8441994705b94a3bf0d758a (diff) | |
download | spark-2a732110d46712c535b75dd4f5a73761b6463aa8.tar.gz spark-2a732110d46712c535b75dd4f5a73761b6463aa8.tar.bz2 spark-2a732110d46712c535b75dd4f5a73761b6463aa8.zip |
SPARK-2407: Added Parser of SQL SUBSTR()
follow-up of #1359
Author: chutium <teng.qiu@gmail.com>
Closes #1442 from chutium/master and squashes the following commits:
b49cc8a [chutium] SPARK-2407: Added Parser of SQL SUBSTRING() #1442
9a60ccf [chutium] SPARK-2407: Added Parser of SQL SUBSTR() #1442
06e933b [chutium] Merge https://github.com/apache/spark
c870172 [chutium] Merge https://github.com/apache/spark
094f773 [chutium] Merge https://github.com/apache/spark
88cb37d [chutium] Merge https://github.com/apache/spark
1de83a7 [chutium] SPARK-2407: Added Parse of SQL SUBSTR()
Diffstat (limited to 'sql/core/src')
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala index 0743cfe8cf..6736189c96 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala @@ -36,6 +36,21 @@ class SQLQuerySuite extends QueryTest { "test") } + test("SPARK-2407 Added Parser of SQL SUBSTR()") { + checkAnswer( + sql("SELECT substr(tableName, 1, 2) FROM tableName"), + "te") + checkAnswer( + sql("SELECT substr(tableName, 3) FROM tableName"), + "st") + checkAnswer( + sql("SELECT substring(tableName, 1, 2) FROM tableName"), + "te") + checkAnswer( + sql("SELECT substring(tableName, 3) FROM tableName"), + "st") + } + test("index into array") { checkAnswer( sql("SELECT data, data[0], data[0] + data[1], data[0 + 1] FROM arrayData"), |