aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorDongjoon Hyun <dongjoon@apache.org>2016-03-27 20:06:02 +0100
committerSean Owen <sowen@cloudera.com>2016-03-27 20:06:02 +0100
commitcfcca732b403b1af406c2507f3efab928e8b9c6c (patch)
treede221cf5f17912c13097d50ce565906543d27372 /sql/hive
parenta01b6a92b5f0287a5236bddb1b817d13f320d489 (diff)
downloadspark-cfcca732b403b1af406c2507f3efab928e8b9c6c.tar.gz
spark-cfcca732b403b1af406c2507f3efab928e8b9c6c.tar.bz2
spark-cfcca732b403b1af406c2507f3efab928e8b9c6c.zip
[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 <dongjoon@apache.org> Closes #11963 from dongjoon-hyun/fix_substr_testcase.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/ExpressionToSQLSuite.scala4
1 files changed, 2 insertions, 2 deletions
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 75930086ff..bf85d71c66 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 ')")