You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ku...@apache.org on 2019/06/27 07:02:12 UTC

[carbondata] branch master updated: [TESTCASE] Test Case fix for Spark 2.1

This is an automated email from the ASF dual-hosted git repository.

kunalkapoor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git


The following commit(s) were added to refs/heads/master by this push:
     new 188e7e4  [TESTCASE] Test Case fix for Spark 2.1
188e7e4 is described below

commit 188e7e4d4cbac391090b678e43873780559c1fa7
Author: manishnalla1994 <ma...@gmail.com>
AuthorDate: Mon Jun 24 14:52:29 2019 +0530

    [TESTCASE] Test Case fix for Spark 2.1
    
    Problem: Testcase not handled for Spark 2.1/2.3 separately.
    
    This closes #3305
---
 .../SparkCarbonDataSourceBinaryTest.scala          | 73 +++++++++++++++-------
 1 file changed, 52 insertions(+), 21 deletions(-)

diff --git a/integration/spark-datasource/src/test/scala/org/apache/spark/sql/carbondata/datasource/SparkCarbonDataSourceBinaryTest.scala b/integration/spark-datasource/src/test/scala/org/apache/spark/sql/carbondata/datasource/SparkCarbonDataSourceBinaryTest.scala
index d234576..9ebf54f 100644
--- a/integration/spark-datasource/src/test/scala/org/apache/spark/sql/carbondata/datasource/SparkCarbonDataSourceBinaryTest.scala
+++ b/integration/spark-datasource/src/test/scala/org/apache/spark/sql/carbondata/datasource/SparkCarbonDataSourceBinaryTest.scala
@@ -121,34 +121,65 @@ class SparkCarbonDataSourceBinaryTest extends FunSuite with BeforeAndAfterAll {
         assert(exception.getCause.getMessage.contains("sort columns not supported for array, struct, map, double, float, decimal, varchar, binary"))
 
         sql("DROP TABLE IF EXISTS binaryTable")
-        exception = intercept[Exception] {
-            sql(
-                s"""
-                   | CREATE TABLE binaryTable
-                   | using carbon
-                   | options('SORT_COLUMNS'='image')
-                   | LOCATION '$writerPath'
+        if (SparkUtil.isSparkVersionEqualTo("2.1")) {
+            exception = intercept[Exception] {
+                sql(
+                    s"""
+                       | CREATE TABLE binaryTable
+                       | using carbon
+                       | options(PATH '$writerPath',
+                       |  'SORT_COLUMNS'='image')
                 """.stripMargin)
-            sql("SELECT COUNT(*) FROM binaryTable").show()
+                sql("SELECT COUNT(*) FROM binaryTable").show()
+            }
+        } else {
+            exception = intercept[Exception] {
+                sql(
+                    s"""
+                       | CREATE TABLE binaryTable
+                       | using carbon
+                       | options('SORT_COLUMNS'='image')
+                       | LOCATION '$writerPath'
+                """.stripMargin)
+                sql("SELECT COUNT(*) FROM binaryTable").show()
+            }
         }
         assert(exception.getMessage.contains("Cannot use sort columns during infer schema"))
 
 
         sql("DROP TABLE IF EXISTS binaryTable")
-        exception = intercept[Exception] {
-            sql(
-                s"""
-                   | CREATE TABLE binaryTable (
-                   |    id DOUBLE,
-                   |    label BOOLEAN,
-                   |    name STRING,
-                   |    image BINARY,
-                   |    autoLabel BOOLEAN)
-                   | using carbon
-                   | options('SORT_COLUMNS'='image')
-                   | LOCATION '$writerPath'
+        if (SparkUtil.isSparkVersionEqualTo("2.1")) {
+            exception = intercept[Exception] {
+                sql(
+                    s"""
+                       | CREATE TABLE binaryTable (
+                       |    id DOUBLE,
+                       |    label BOOLEAN,
+                       |    name STRING,
+                       |    image BINARY,
+                       |    autoLabel BOOLEAN)
+                       | using carbon
+                       | options(PATH '$writerPath',
+                       | 'SORT_COLUMNS'='image')
                  """.stripMargin)
-            sql("SELECT COUNT(*) FROM binaryTable").show()
+                sql("SELECT COUNT(*) FROM binaryTable").show()
+            }
+        } else {
+            exception = intercept[Exception] {
+                sql(
+                    s"""
+                       | CREATE TABLE binaryTable (
+                       |    id DOUBLE,
+                       |    label BOOLEAN,
+                       |    name STRING,
+                       |    image BINARY,
+                       |    autoLabel BOOLEAN)
+                       | using carbon
+                       | options('SORT_COLUMNS'='image')
+                       | LOCATION '$writerPath'
+                 """.stripMargin)
+                sql("SELECT COUNT(*) FROM binaryTable").show()
+            }
         }
         assert(exception.getCause.getMessage.contains("sort columns not supported for array, struct, map, double, float, decimal, varchar, binary"))
     }