Repository: spark
Updated Branches:
  refs/heads/master a01b6a92b -> cfcca732b


[MINOR][SQL] Fix substr/substring testcases.

## What changes were proposed in this pull request?

This PR fixes the following two testcases in order to test the correct usages.
```
checkSqlGeneration("SELECT substr('This is a test', 'is')")
checkSqlGeneration("SELECT substring('This is a test', 'is')")
```

Actually, the testcases works but tests on exceptional cases.
```
scala> sql("SELECT substr('This is a test', 'is')")
res0: org.apache.spark.sql.DataFrame = [substring(This is a test, CAST(is AS 
INT), 2147483647): string]

scala> sql("SELECT substr('This is a test', 'is')").collect()
res1: Array[org.apache.spark.sql.Row] = Array([null])
```

## How was this patch tested?

Pass the modified unit tests.

Author: Dongjoon Hyun <[email protected]>

Closes #11963 from dongjoon-hyun/fix_substr_testcase.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/cfcca732
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/cfcca732
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/cfcca732

Branch: refs/heads/master
Commit: cfcca732b403b1af406c2507f3efab928e8b9c6c
Parents: a01b6a9
Author: Dongjoon Hyun <[email protected]>
Authored: Sun Mar 27 20:06:02 2016 +0100
Committer: Sean Owen <[email protected]>
Committed: Sun Mar 27 20:06:02 2016 +0100

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/cfcca732/sql/hive/src/test/scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala
index 7593008..bf85d71 100644
--- 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala
+++ 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala
@@ -213,8 +213,8 @@ class ExpressionToSQLSuite extends SQLBuilderTest with 
SQLTestUtils {
     checkSqlGeneration("SELECT space(2)")
     checkSqlGeneration("SELECT split('aa2bb3cc', '[1-9]+')")
     checkSqlGeneration("SELECT space(2)")
-    checkSqlGeneration("SELECT substr('This is a test', 'is')")
-    checkSqlGeneration("SELECT substring('This is a test', 'is')")
+    checkSqlGeneration("SELECT substr('This is a test', 1)")
+    checkSqlGeneration("SELECT substring('This is a test', 1)")
     checkSqlGeneration("SELECT substring_index('www.apache.org','.',1)")
     checkSqlGeneration("SELECT translate('translate', 'rnlt', '123')")
     checkSqlGeneration("SELECT trim('  SparkSql ')")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to