carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [11/38] incubator-carbondata git commit: reuse test case for integration module
Date Sat, 07 Jan 2017 16:36:45 GMT
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexTypeQuery.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexTypeQuery.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexTypeQuery.scala
index 3630b61..5dab2d8 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexTypeQuery.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexTypeQuery.scala
@@ -19,13 +19,8 @@
 
 package org.apache.carbondata.integration.spark.testsuite.complexType
 
-import java.io.File
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
 import org.apache.spark.sql.Row
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier
-import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension
+import org.apache.spark.sql.common.util.QueryTest
 import org.scalatest.BeforeAndAfterAll
 
 /**
@@ -43,29 +38,29 @@ class TestComplexTypeQuery extends QueryTest with BeforeAndAfterAll {
      sql("drop table if exists structusingarraycarbon").show
      sql("drop table if exists structusingarrayhive").show
      sql("create table complexcarbontable(deviceInformationId int, channelsId string, ROMSize string, ROMName String, purchasedate string, mobile struct<imei:string, imsi:string>, MAC array<string>, locationinfo array<struct<ActiveAreaId:int, ActiveCountry:string, ActiveProvince:string, Activecity:string, ActiveDistrict:string, ActiveStreet:string>>, proddate struct<productionDate:string,activeDeactivedate:array<string>>, gamePointId double,contractNumber double)  STORED BY 'org.apache.carbondata.format'  TBLPROPERTIES ('DICTIONARY_INCLUDE'='deviceInformationId', 'DICTIONARY_EXCLUDE'='channelsId','COLUMN_GROUP'='(ROMSize,ROMName)')");
-     sql("LOAD DATA local inpath './src/test/resources/complextypesample.csv' INTO table complexcarbontable  OPTIONS('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='deviceInformationId,channelsId,ROMSize,ROMName,purchasedate,mobile,MAC,locationinfo,proddate,gamePointId,contractNumber', 'COMPLEX_DELIMITER_LEVEL_1'='$', 'COMPLEX_DELIMITER_LEVEL_2'=':')");
+     sql("LOAD DATA local inpath '" + resourcesPath + "/complextypesample.csv' INTO table complexcarbontable  OPTIONS('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='deviceInformationId,channelsId,ROMSize,ROMName,purchasedate,mobile,MAC,locationinfo,proddate,gamePointId,contractNumber', 'COMPLEX_DELIMITER_LEVEL_1'='$', 'COMPLEX_DELIMITER_LEVEL_2'=':')");
      sql("create table complexhivetable(deviceInformationId int, channelsId string, ROMSize string, ROMName String, purchasedate string, mobile struct<imei:string, imsi:string>, MAC array<string>, locationinfo array<struct<ActiveAreaId:int, ActiveCountry:string, ActiveProvince:string, Activecity:string, ActiveDistrict:string, ActiveStreet:string>>, proddate struct<productionDate:string,activeDeactivedate:array<string>>, gamePointId double,contractNumber double)row format delimited fields terminated by ',' collection items terminated by '$' map keys terminated by ':'")
-     sql("LOAD DATA local inpath './src/test/resources/complextypesample.csv' INTO table complexhivetable");
+     sql(s"LOAD DATA local inpath '$resourcesPath/complextypesample.csv' INTO table complexhivetable");
      sql("create table complex_filter(test1 int, test2 array<String>,test3 array<bigint>,test4 array<int>,test5 array<decimal>,test6 array<timestamp>,test7 array<double>) STORED BY 'org.apache.carbondata.format'")
-     sql("LOAD DATA INPATH './src/test/resources/array1.csv'  INTO TABLE complex_filter options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'COMPLEX_DELIMITER_LEVEL_1'='$', 'FILEHEADER'= 'test1,test2,test3,test4,test5,test6,test7')").show()
+     sql("LOAD DATA INPATH '" + resourcesPath + "/array1.csv'  INTO TABLE complex_filter options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'COMPLEX_DELIMITER_LEVEL_1'='$', 'FILEHEADER'= 'test1,test2,test3,test4,test5,test6,test7')").show()
      
      sql("create table structusingarraycarbon (MAC struct<MAC1:array<string>,ActiveCountry:array<string>>) STORED BY 'org.apache.carbondata.format'");
-     sql("LOAD DATA local INPATH './src/test/resources/struct_all.csv' INTO table structusingarraycarbon options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='MAC','COMPLEX_DELIMITER_LEVEL_1'='$','COMPLEX_DELIMITER_LEVEL_2'='&')")
+     sql("LOAD DATA local INPATH '" + resourcesPath + "/struct_all.csv' INTO table structusingarraycarbon options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='MAC','COMPLEX_DELIMITER_LEVEL_1'='$','COMPLEX_DELIMITER_LEVEL_2'='&')")
      sql("create table structusingarrayhive (MAC struct<MAC1:array<string>,ActiveCountry:array<string>>)row format delimited fields terminated by ',' collection items terminated by '$' map keys terminated by '&'");
-     sql("LOAD DATA local INPATH './src/test/resources/struct_all.csv' INTO table structusingarrayhive") 
+     sql("LOAD DATA local INPATH '" + resourcesPath + "/struct_all.csv' INTO table structusingarrayhive")
      
      sql("create table structusingstructCarbon(name struct<middlename:string, othernames:struct<firstname:string,lastname:string>,age:int> ) STORED BY 'org.apache.carbondata.format'")
-     sql("LOAD DATA local INPATH './src/test/resources/structusingstruct.csv' INTO table structusingstructCarbon options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='name','COMPLEX_DELIMITER_LEVEL_1'='$','COMPLEX_DELIMITER_LEVEL_2'='&')")
+     sql("LOAD DATA local INPATH '" + resourcesPath + "/structusingstruct.csv' INTO table structusingstructCarbon options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='name','COMPLEX_DELIMITER_LEVEL_1'='$','COMPLEX_DELIMITER_LEVEL_2'='&')")
       sql("create table structusingstructhive(name struct<middlename:string, othernames:struct<firstname:string,lastname:string>,age:int> )row format delimited fields terminated by ',' collection items terminated by '$' map keys terminated by '&'")
-     sql("LOAD DATA local INPATH './src/test/resources/structusingstruct.csv' INTO table structusingstructhive")
+     sql("LOAD DATA local INPATH '" + resourcesPath + "/structusingstruct.csv' INTO table structusingstructhive")
      
   }
   
   test("Test ^ * special character data loading for complex types") {
     sql("create table complexcarbonwithspecialchardelimeter(deviceInformationId int, channelsId string, ROMSize string, ROMName String, purchasedate string, mobile struct<imei:string, imsi:string>, MAC array<string>, locationinfo array<struct<ActiveAreaId:int, ActiveCountry:string, ActiveProvince:string, Activecity:string, ActiveDistrict:string, ActiveStreet:string>>, proddate struct<productionDate:string,activeDeactivedate:array<string>>, gamePointId double,contractNumber double)  STORED BY 'org.apache.carbondata.format'  TBLPROPERTIES ('DICTIONARY_INCLUDE'='deviceInformationId', 'DICTIONARY_EXCLUDE'='channelsId','COLUMN_GROUP'='(ROMSize,ROMName)')");
-    sql("LOAD DATA local inpath './src/test/resources/complextypespecialchardelimiter.csv' INTO table complexcarbonwithspecialchardelimeter  OPTIONS('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='deviceInformationId,channelsId,ROMSize,ROMName,purchasedate,mobile,MAC,locationinfo,proddate,gamePointId,contractNumber', 'COMPLEX_DELIMITER_LEVEL_1'='^', 'COMPLEX_DELIMITER_LEVEL_2'='*')");
+    sql("LOAD DATA local inpath '" + resourcesPath + "/complextypespecialchardelimiter.csv' INTO table complexcarbonwithspecialchardelimeter  OPTIONS('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='deviceInformationId,channelsId,ROMSize,ROMName,purchasedate,mobile,MAC,locationinfo,proddate,gamePointId,contractNumber', 'COMPLEX_DELIMITER_LEVEL_1'='^', 'COMPLEX_DELIMITER_LEVEL_2'='*')");
     sql("create table complexhivewithspecialchardelimeter(deviceInformationId int, channelsId string, ROMSize string, ROMName String, purchasedate string, mobile struct<imei:string, imsi:string>, MAC array<string>, locationinfo array<struct<ActiveAreaId:int, ActiveCountry:string, ActiveProvince:string, Activecity:string, ActiveDistrict:string, ActiveStreet:string>>, proddate struct<productionDate:string,activeDeactivedate:array<string>>, gamePointId double,contractNumber double)row format delimited fields terminated by ',' collection items terminated by '^' map keys terminated by '*'")
-    sql("LOAD DATA local inpath './src/test/resources/complextypespecialchardelimiter.csv' INTO table complexhivewithspecialchardelimeter");
+    sql("LOAD DATA local inpath '" + resourcesPath + "/complextypespecialchardelimiter.csv' INTO table complexhivewithspecialchardelimeter");
     checkAnswer(sql("select * from complexcarbonwithspecialchardelimeter"), sql("select * from complexhivewithspecialchardelimeter"))
     sql("drop table if exists complexcarbonwithspecialchardelimeter")
     sql("drop table if exists complexhivewithspecialchardelimeter")

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestCreateTableWithDouble.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestCreateTableWithDouble.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestCreateTableWithDouble.scala
deleted file mode 100644
index b9c8a68..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestCreateTableWithDouble.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.complexType
-
-import java.io.File
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.apache.spark.sql.Row
-import org.apache.carbondata.core.carbon.CarbonTableIdentifier
-import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * Test class of creating and loading for carbon table with double
- *
- */
-class TestCreateTableWithDouble extends QueryTest with BeforeAndAfterAll {
-
-  var dataPath: String = _
-  var countNum: Array[Row] = _
-  var doubleField: Array[Row] = _
-
-  override def beforeAll: Unit = {
-    dataPath = new File(this.getClass.getResource("/").getPath + "/../../")
-      .getCanonicalPath + "/src/test/resources/sampleComplex.csv"
-    countNum = Array(Row(0))
-    doubleField = Array(Row(0))
-    sql("drop table if exists doubleComplex")
-    sql("drop table if exists doubleComplex2")
-  }
-
-  test("test creating carbon table with double in complex type") {
-    try {
-      sql("CREATE TABLE doubleComplex (Id int, number double, name string, " +
-        "gamePoint array<double>, mac struct<num:double>) " +
-        "STORED BY 'org.apache.carbondata.format'")
-      sql(s"LOAD DATA LOCAL INPATH '$dataPath' INTO TABLE doubleComplex")
-      countNum = sql(s"SELECT COUNT(*) FROM doubleComplex").collect
-      doubleField = sql("SELECT number FROM doubleComplex SORT BY Id").collect
-    } catch {
-      case e : Throwable => fail(e)
-    }
-    // assert that load and query is successful
-    assertResult(countNum)(Array(Row(3)))
-    assertResult(doubleField)(Array(Row(1.5), Row(2.0), Row(3.0)))
-  }
-
-  test("test creating carbon table with double as dimension") {
-    countNum = Array(Row(0))
-    doubleField = Array(Row(0))
-    try {
-      sql("CREATE TABLE doubleComplex2 (Id int, number double, name string, " +
-        "gamePoint array<double>, mac struct<num:double>) " +
-        "STORED BY 'org.apache.carbondata.format' " +
-        "TBLPROPERTIES('DICTIONARY_INCLUDE'='number')")
-      sql(s"LOAD DATA LOCAL INPATH '$dataPath' INTO TABLE doubleComplex2")
-      countNum = sql(s"SELECT COUNT(*) FROM doubleComplex2").collect
-      doubleField = sql(s"SELECT number FROM doubleComplex2 SORT BY Id").collect
-    } catch {
-      case e : Throwable => fail(e)
-    }
-    // assert that field 'number' is a dimension
-    val tableIdentifier = new CarbonTableIdentifier(
-      CarbonCommonConstants.DATABASE_DEFAULT_NAME, "doubleComplex2".toLowerCase(), "uniqueid")
-    val carbonTable = org.apache.carbondata.core.carbon.metadata.CarbonMetadata.getInstance()
-      .getCarbonTable(tableIdentifier.getTableUniqueName)
-    val dimExist = carbonTable.getDimensionByTableName("doubleComplex2".toLowerCase()).toArray.
-      exists(_.asInstanceOf[CarbonDimension].getColName.equalsIgnoreCase("number"))
-    assertResult(dimExist)(true)
-    // assert that load and query is successful
-    assertResult(countNum)(Array(Row(3)))
-    assertResult(doubleField)(Array(Row(1.5), Row(2.0), Row(3.0)))
-  }
-
-  override def afterAll {
-    sql("drop table doubleComplex")
-    sql("drop table doubleComplex2")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/MultiFilesDataLoagdingTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/MultiFilesDataLoagdingTestCase.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/MultiFilesDataLoagdingTestCase.scala
deleted file mode 100644
index d44c73d..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/MultiFilesDataLoagdingTestCase.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.spark.testsuite.dataload
-
-import java.io.File
-
-import org.apache.spark.sql.Row
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * Test Class for data loading with hive syntax and old syntax
- *
- */
-class MultiFilesDataLoagdingTestCase extends QueryTest with BeforeAndAfterAll {
-
-  var currentDirectory: String = _
-
-  override def beforeAll {
-    sql("create table multifile(empno int, empname String, designation string, doj String," +
-      "workgroupcategory int, workgroupcategoryname String,deptno int, deptname String," +
-      "projectcode int, projectjoindate String,projectenddate String, attendance double," +
-      "utilization double,salary double) STORED BY 'org.apache.carbondata.format'")
-    
-    currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-      .getCanonicalPath
-  }
-
-  test("test data loading for multi files and nested folder") {
-    val testData = currentDirectory + "/src/test/resources/loadMultiFiles"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table multifile")
-    checkAnswer(
-      sql("select count(empno) from multifile"),
-      Seq(Row(10))
-    )
-  }
-
-  override def afterAll {
-    sql("drop table multifile")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/SparkDatasourceSuite.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/SparkDatasourceSuite.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/SparkDatasourceSuite.scala
index 2d5d3d5..e9205e3 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/SparkDatasourceSuite.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/SparkDatasourceSuite.scala
@@ -21,23 +21,19 @@ package org.apache.carbondata.integration.spark.testsuite.dataload
 
 import java.io.File
 
-import org.apache.spark.sql.common.util.CarbonHiveContext._
 import org.apache.spark.sql.common.util.QueryTest
 import org.apache.spark.sql.{DataFrame, Row, SQLContext, SaveMode}
 import org.scalatest.BeforeAndAfterAll
 
 class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
 
-  var currentDirectory: String = _
   var df: DataFrame = _
 
   override def beforeAll {
     sql("DROP TABLE IF EXISTS carbon1")
 
-    currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-        .getCanonicalPath
-    import implicits._
-    df = sc.parallelize(1 to 1000)
+    import sqlContext.implicits._
+    df = sqlContext.sparkContext.parallelize(1 to 1000)
         .map(x => ("a", "b", x))
         .toDF("c1", "c2", "c3")
 
@@ -50,7 +46,7 @@ class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
   }
 
   test("read and write using CarbonContext") {
-    val in = read
+    val in = sqlContext.read
         .format("carbondata")
         .option("tableName", "carbon1")
         .load()
@@ -59,7 +55,7 @@ class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
   }
 
   test("read and write using CarbonContext with compression") {
-    val in = read
+    val in = sqlContext.read
         .format("carbondata")
         .option("tableName", "carbon1")
         .option("compress", "true")
@@ -80,7 +76,7 @@ class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
         .option("tableName", "carbon4")
         .mode(SaveMode.Overwrite)
         .save()
-    val in = read
+    val in = sqlContext.read
         .format("carbondata")
         .option("tableName", "carbon4")
         .load()
@@ -100,7 +96,7 @@ class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
         .option("tableName", "carbon4")
         .mode(SaveMode.Append)
         .save()
-    val in = read
+    val in = sqlContext.read
         .format("carbondata")
         .option("tableName", "carbon4")
         .load()
@@ -109,40 +105,40 @@ class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
   }
   
   test("query using SQLContext") {
-    val sqlContext = new SQLContext(sparkContext)
-    sqlContext.sql(
+    val newSQLContext = new SQLContext(sqlContext.sparkContext)
+    newSQLContext.sql(
       s"""
          | CREATE TEMPORARY TABLE temp
          | (c1 string, c2 string, c3 long)
          | USING org.apache.spark.sql.CarbonSource
-         | OPTIONS (path '$storePath/default/carbon1')
+         | OPTIONS (path '$storeLocation/default/carbon1')
       """.stripMargin)
-    checkAnswer(sqlContext.sql(
+    checkAnswer(newSQLContext.sql(
       """
         | SELECT c1, c2, count(*)
         | FROM temp
         | WHERE c3 > 100
         | GROUP BY c1, c2
       """.stripMargin), Seq(Row("a", "b", 900)))
-    sqlContext.dropTempTable("temp")
+    newSQLContext.dropTempTable("temp")
   }
 
   test("query using SQLContext without providing schema") {
-    val sqlContext = new SQLContext(sparkContext)
-    sqlContext.sql(
+    val newSQLContext = new SQLContext(sqlContext.sparkContext)
+    newSQLContext.sql(
       s"""
          | CREATE TEMPORARY TABLE temp
          | USING org.apache.spark.sql.CarbonSource
-         | OPTIONS (path '$storePath/default/carbon1')
+         | OPTIONS (path '$storeLocation/default/carbon1')
       """.stripMargin)
-    checkAnswer(sqlContext.sql(
+    checkAnswer(newSQLContext.sql(
       """
         | SELECT c1, c2, count(*)
         | FROM temp
         | WHERE c3 > 100
         | GROUP BY c1, c2
       """.stripMargin), Seq(Row("a", "b", 900)))
-    sqlContext.dropTempTable("temp")
+    newSQLContext.dropTempTable("temp")
   }
 
   test("query using SQLContext, multiple load") {
@@ -152,38 +148,37 @@ class SparkDatasourceSuite extends QueryTest with BeforeAndAfterAll {
         | CREATE TABLE test(id int, name string, city string, age int)
         | STORED BY 'org.apache.carbondata.format'
       """.stripMargin)
-    val testData = currentDirectory + "/src/test/resources/sample.csv"
+    val testData = s"${resourcesPath}/sample.csv"
     sql(s"LOAD DATA LOCAL INPATH '$testData' into table test")
     sql(s"LOAD DATA LOCAL INPATH '$testData' into table test")
 
-    val sqlContext = new SQLContext(sparkContext)
-    sqlContext.sql(
+    val newSQLContext = new SQLContext(sqlContext.sparkContext)
+    newSQLContext.sql(
       s"""
          | CREATE TEMPORARY TABLE temp
          | (id long, name string, city string, age long)
          | USING org.apache.spark.sql.CarbonSource
-         | OPTIONS (path '$storePath/default/test')
+         | OPTIONS (path '$storeLocation/default/test')
       """.stripMargin)
-    checkAnswer(sqlContext.sql(
+    checkAnswer(newSQLContext.sql(
       """
         | SELECT count(id)
         | FROM temp
       """.stripMargin), Seq(Row(8)))
-    sqlContext.dropTempTable("temp")
+    newSQLContext.dropTempTable("temp")
     sql("DROP TABLE test")
   }
 
   test("json data with long datatype issue CARBONDATA-405") {
-    val currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-      .getCanonicalPath
-    val jsonDF = read.format("json").load("./src/test/resources/test.json")
+    val jsonDF = sqlContext.read.format("json").load(s"$resourcesPath/test.json")
     jsonDF.write
       .format("carbondata")
       .option("tableName", "dftesttable")
       .option("compress", "true")
       .mode(SaveMode.Overwrite)
       .save()
-    val carbonDF = read
+    val carbonDF = sqlContext
+      .read
       .format("carbondata")
       .option("tableName", "dftesttable")
       .load()

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala
deleted file mode 100644
index 6a274b6..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import java.io.File
-import java.math.BigDecimal
-
-import org.apache.carbondata.core.carbon.path.{CarbonStorePath, CarbonTablePath}
-import org.apache.carbondata.core.datastorage.store.filesystem.CarbonFile
-import org.apache.carbondata.core.datastorage.store.impl.FileFactory
-import org.apache.spark.sql.Row
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.{CarbonHiveContext, QueryTest}
-import org.scalatest.BeforeAndAfterAll
-
-import scala.collection.mutable.ArrayBuffer
-
-class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll {
-
-  var currentDirectory: String = _
-
-  override def beforeAll {
-    sql("DROP TABLE IF EXISTS loadtest")
-    sql(
-      """
-        | CREATE TABLE loadtest(id int, name string, city string, age int)
-        | STORED BY 'org.apache.carbondata.format'
-      """.stripMargin)
-
-    currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-        .getCanonicalPath
-  }
-
-  private def checkSegmentExists(
-      segmentId: String,
-      datbaseName: String,
-      tableName: String): Boolean = {
-    val carbonTable = org.apache.carbondata.core.carbon.metadata.CarbonMetadata.getInstance()
-      .getCarbonTable(datbaseName + "_" + tableName)
-    val partitionPath = CarbonStorePath.getCarbonTablePath(
-      CarbonHiveContext.hdfsCarbonBasePath,
-      carbonTable.getCarbonTableIdentifier).getPartitionDir("0")
-    val fileType: FileFactory.FileType = FileFactory.getFileType(partitionPath)
-    val carbonFile = FileFactory.getCarbonFile(partitionPath, fileType)
-    val segments: ArrayBuffer[String] = ArrayBuffer()
-    carbonFile.listFiles.foreach { file =>
-      segments += CarbonTablePath.DataPathUtil.getSegmentId(file.getAbsolutePath + "/dummy")
-    }
-    segments.contains(segmentId)
-  }
-
-  test("test data loading CSV file") {
-    val testData = currentDirectory + "/src/test/resources/sample.csv"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest")
-    checkAnswer(
-      sql("SELECT COUNT(*) FROM loadtest"),
-      Seq(Row(4))
-    )
-  }
-
-  test("test data loading CSV file without extension name") {
-    val testData = currentDirectory + "/src/test/resources/sample"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest")
-    checkAnswer(
-      sql("SELECT COUNT(*) FROM loadtest"),
-      Seq(Row(8))
-    )
-  }
-
-  test("test data loading GZIP compressed CSV file") {
-    val testData = currentDirectory + "/src/test/resources/sample.csv.gz"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest")
-    checkAnswer(
-      sql("SELECT COUNT(*) FROM loadtest"),
-      Seq(Row(12))
-    )
-  }
-
-  test("test data loading BZIP2 compressed CSV file") {
-    val testData = currentDirectory + "/src/test/resources/sample.csv.bz2"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest")
-    checkAnswer(
-      sql("SELECT COUNT(*) FROM loadtest"),
-      Seq(Row(16))
-    )
-  }
-
-  test("test data loading CSV file with delimiter char \\017") {
-    val testData = currentDirectory + "/src/test/resources/sample_withDelimiter017.csv"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest options ('delimiter'='\\017')")
-    checkAnswer(
-      sql("SELECT COUNT(*) FROM loadtest"),
-      Seq(Row(20))
-    )
-  }
-
-  test("test data loading with invalid values for mesasures") {
-    val testData = currentDirectory + "/src/test/resources/invalidMeasures.csv"
-    sql("drop table if exists invalidMeasures")
-    sql("CREATE TABLE invalidMeasures (country String, salary double, age decimal(10,2)) STORED BY 'carbondata'")
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table invalidMeasures options('Fileheader'='country,salary,age')")
-    checkAnswer(
-      sql("SELECT * FROM invalidMeasures"),
-      Seq(Row("India",null,new BigDecimal("22.44")), Row("Russia",null,null), Row("USA",234.43,null))
-    )
-  }
-
-  test("test data loading into table whose name has '_'") {
-    sql("DROP TABLE IF EXISTS load_test")
-    sql(""" CREATE TABLE load_test(id int, name string, city string, age int)
-        STORED BY 'org.apache.carbondata.format' """)
-    val testData = currentDirectory + "/src/test/resources/sample.csv"
-    try {
-      sql(s"LOAD DATA LOCAL INPATH '$testData' into table load_test")
-      sql(s"LOAD DATA LOCAL INPATH '$testData' into table load_test")
-    } catch {
-      case ex: Exception =>
-        assert(false)
-    }
-    assert(checkSegmentExists("0", "default", "load_test"))
-    assert(checkSegmentExists("1", "default", "load_test"))
-    sql("DROP TABLE load_test")
-  }
-
-  override def afterAll {
-    sql("DROP TABLE loadtest")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithAutoLoadMerge.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithAutoLoadMerge.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithAutoLoadMerge.scala
deleted file mode 100644
index 52b96f5..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithAutoLoadMerge.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import java.io.File
-
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
-import org.apache.spark.sql.Row
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-/**
-  * Test class of creating and loading for carbon table with auto load merge
-  */
-class TestLoadDataWithAutoLoadMerge extends QueryTest with BeforeAndAfterAll {
-
-  var currentDirectory: String = _
-
-  override def beforeAll: Unit = {
-    sql("DROP TABLE IF EXISTS automerge")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.ENABLE_AUTO_LOAD_MERGE, "true")
-    sql(
-      """
-         CREATE TABLE automerge(id int, name string, city string, age int)
-         STORED BY 'org.apache.carbondata.format'
-      """)
-    currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-      .getCanonicalPath
-  }
-
-  test("test data loading with auto load merge") {
-    val testData = currentDirectory + "/src/test/resources/sample.csv"
-    sql(s"LOAD DATA LOCAL INPATH '$testData' into table automerge")
-    checkAnswer(
-      sql("SELECT COUNT(*) FROM automerge"),
-      Seq(Row(4))
-    )
-  }
-
-  override def afterAll: Unit = {
-    sql("DROP TABLE IF EXISTS automerge")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.ENABLE_AUTO_LOAD_MERGE, "false")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithBlankLine.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithBlankLine.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithBlankLine.scala
deleted file mode 100644
index 163c11d..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithBlankLine.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-import org.apache.spark.sql.Row
-
-/**
-  * Test Class for data loading when there are blank lines in data
-  *
-  */
-class TestLoadDataWithBlankLine extends QueryTest with BeforeAndAfterAll {
-  override def beforeAll {
-    sql("drop table if exists carbontable")
-    sql("CREATE TABLE carbontable (empno int, empname String, designation String, " +
-      "doj String, workgroupcategory int, workgroupcategoryname String, deptno int, " +
-      "deptname String, projectcode int, projectjoindate String, projectenddate String, " +
-      "attendance int,utilization int,salary int) " +
-        "STORED BY 'org.apache.carbondata.format'")
-    sql("LOAD DATA LOCAL INPATH './src/test/resources/datawithblanklines.csv' INTO TABLE" +
-        " carbontable OPTIONS('DELIMITER'= ',')")
-
-    sql("drop table if exists carbontable2")
-    sql("CREATE TABLE carbontable2 (empno int, empname String, designation String, " +
-      "doj String, workgroupcategory int, workgroupcategoryname String, deptno int, " +
-      "deptname String, projectcode int, projectjoindate String, projectenddate String, " +
-      "attendance int,utilization int,salary int) " +
-      "STORED BY 'org.apache.carbondata.format'")
-  }
-  test("test carbon table data loading when there are  blank lines in data") {
-    checkAnswer(sql("select count(*) from carbontable"),
-      Seq(Row(18)))
-  }
-
-  test("test carbon table data loading when the first line is blank") {
-    sql("LOAD DATA LOCAL INPATH './src/test/resources/dataWithNullFirstLine.csv' INTO TABLE " +
-      "carbontable2 OPTIONS('DELIMITER'= ',','FILEHEADER'='empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary')")
-
-    checkAnswer(sql("select count(*) from carbontable2"),
-      Seq(Row(11)))
-  }
-
-  override def afterAll {
-    sql("drop table if exists carbontable")
-    sql("drop table if exists carbontable2")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithEmptyArrayColumns.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithEmptyArrayColumns.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithEmptyArrayColumns.scala
deleted file mode 100644
index 40f2ce0..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithEmptyArrayColumns.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import org.apache.spark.sql.Row
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * Test Class for data loading when there are null measures in data
- *
- */
-class TestLoadDataWithEmptyArrayColumns extends QueryTest with BeforeAndAfterAll {
-  override def beforeAll {
-    sql("drop table if exists nest13")
-    sql("""
-           CREATE TABLE nest13 (imei string,age int,
-           productdate timestamp,gamePointId double,
-           reserved6 array<string>,mobile struct<poc:string, imsi:int>)
-           STORED BY 'org.apache.carbondata.format'
-        """)
-  }
-
-  test("test carbon table data loading when there are empty array columns in data") {
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
-        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT
-      )
-    sql(
-      s"""
-            LOAD DATA inpath './src/test/resources/arrayColumnEmpty.csv'
-            into table nest13 options ('DELIMITER'=',', 'complex_delimiter_level_1'='/')
-         """
-    )
-    checkAnswer(
-      sql("""
-             SELECT count(*) from nest13
-          """),
-      Seq(Row(20)))
-  }
-
-  override def afterAll {
-    sql("drop table nest13")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithJunkChars.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithJunkChars.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithJunkChars.scala
deleted file mode 100644
index e534445..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithJunkChars.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-
-import org.scalatest.BeforeAndAfterAll
-import java.io.File
-import java.io.BufferedWriter
-import java.io.FileWriter
-import java.util.Random
-import org.apache.spark.sql.Row
-
-class TestLoadDataWithJunkChars extends QueryTest with BeforeAndAfterAll {
-  var filePath = ""
-  val junkchars = "ǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰ"
-
-  def buildTestData() = {
-    val pwd = new File(this.getClass.getResource("/").getPath + "/../../").getCanonicalPath
-    filePath = pwd + "/target/junkcharsdata.csv"
-    val file = new File(filePath)
-    val writer = new BufferedWriter(new FileWriter(file))
-    writer.write("c1,c2\n")
-    val random = new Random
-    for (i <- 1 until 1000000) {
-      writer.write("a" + i + "," + junkchars + "\n")
-    }
-    writer.write("a1000000," + junkchars)
-    writer.close
-  }
-
-  test("[bug]fix bug of duplicate rows in UnivocityCsvParser #877") {
-    buildTestData()
-    sql("drop table if exists junkcharsdata")
-    sql("""create table if not exists junkcharsdata
-             (c1 string, c2 string)
-             STORED BY 'org.apache.carbondata.format'""")
-    sql(s"LOAD DATA LOCAL INPATH '$filePath' into table junkcharsdata").show
-    sql("select * from junkcharsdata").show(20,false)
-    checkAnswer(sql("select count(*) from junkcharsdata"), Seq(Row(1000000)))
-    sql("drop table if exists junkcharsdata")
-    new File(filePath).delete()
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithMaxMinInteger.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithMaxMinInteger.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithMaxMinInteger.scala
deleted file mode 100644
index 6b4758b..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithMaxMinInteger.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import org.apache.spark.sql.Row
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * Test Class for data loading when there are min integer value in int column
- *
- */
-class TestLoadDataWithMaxMinInteger extends QueryTest with BeforeAndAfterAll {
-  override def beforeAll {
-    sql("drop table if exists integer_table_01")
-    sql("drop table if exists integer_table_02")
-    sql("drop table if exists integer_table_03")
-  }
-  test("test carbon table data loading when the int column " +
-    "contains min integer value") {
-    sql(
-      """
-        CREATE TABLE integer_table_01(imei string,age int)
-        STORED BY 'org.apache.carbondata.format'
-      """)
-    sql(
-      """
-        LOAD DATA INPATH './src/test/resources/datawithmininteger.csv'
-        INTO table integer_table_01 options ('DELIMITER'=',',
-        'QUOTECHAR'='"')
-      """)
-    checkAnswer(sql("select age from integer_table_01"),
-      Seq(Row(10), Row(26), Row(10), Row(10), Row(20),
-        Row(10), Row(10), Row(10), Row(10), Row(10),
-        Row(-2147483648)))
-  }
-
-  test("test carbon table data loading when the int column " +
-    "contains max integer value") {
-    sql(
-      """
-        CREATE TABLE integer_table_02(imei string,age int)
-        STORED BY 'org.apache.carbondata.format'
-      """)
-    sql(
-      """
-        LOAD DATA INPATH './src/test/resources/datawithmaxinteger.csv'
-        INTO table integer_table_02 options ('DELIMITER'=',',
-        'QUOTECHAR'='"')
-      """)
-    checkAnswer(sql("select age from integer_table_02"),
-      Seq(Row(10), Row(26), Row(10), Row(10), Row(20),
-        Row(10), Row(10), Row(10), Row(10), Row(10),
-        Row(2147483647)))
-  }
-
-  test("test carbon table data loading when the int column " +
-    "contains min and max integer value") {
-    sql(
-      """
-        CREATE TABLE integer_table_03(imei string,age int)
-        STORED BY 'org.apache.carbondata.format'
-      """)
-    sql(
-      """
-        LOAD DATA INPATH './src/test/resources/datawithmaxmininteger.csv'
-        INTO table integer_table_03 options ('DELIMITER'=',',
-        'QUOTECHAR'='"')
-      """)
-    checkAnswer(sql("select age from integer_table_03"),
-      Seq(Row(10), Row(26), Row(10), Row(10), Row(20),
-        Row(10), Row(10), Row(10), Row(10), Row(10),
-        Row(-2147483648), Row(2147483647)))
-  }
-  override def afterAll {
-    sql("drop table if exists integer_table_01")
-    sql("drop table if exists integer_table_02")
-    sql("drop table if exists integer_table_03")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithNullMeasures.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithNullMeasures.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithNullMeasures.scala
deleted file mode 100644
index f3d5ea2..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithNullMeasures.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.dataload
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * Test Class for data loading when there are null measures in data
- *
- */
-class TestLoadDataWithNullMeasures extends QueryTest with BeforeAndAfterAll {
-  override def beforeAll {
-    sql("DROP TABLE IF EXISTS carbontable")
-    sql(
-      "CREATE TABLE carbontable (empno int, empname String, designation String, doj String, " +
-      "workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, " +
-      "projectcode int, projectjoindate String, projectenddate String,attendance int,utilization " +
-      "int,salary int) STORED BY 'org.apache.carbondata.format'")
-  }
-
-  test("test carbon table data loading when there are null measures in data") {
-    try {
-      sql(
-        "LOAD DATA LOCAL INPATH './src/test/resources/datawithnullmsrs.csv' INTO TABLE " +
-        "carbontable OPTIONS('DELIMITER'= ',')");
-    } catch {
-      case e: Throwable => e.printStackTrace()
-    }
-  }
-
-  override def afterAll {
-    sql("drop table carbontable")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithSingleQuotechar.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithSingleQuotechar.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithSingleQuotechar.scala
index 1d8eea5..d899fdc 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithSingleQuotechar.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithSingleQuotechar.scala
@@ -19,11 +19,9 @@
 
 package org.apache.carbondata.integration.spark.testsuite.dataload
 
-import org.apache.spark.sql.{DataFrame, Row}
-import org.apache.spark.sql.common.util.CarbonHiveContext._
+import org.apache.spark.sql.Row
 import org.apache.spark.sql.common.util.QueryTest
 import org.scalatest.BeforeAndAfterAll
-
 /**
  * Test Class for data loading when there is single quote in fact data
  *
@@ -38,8 +36,9 @@ class TestLoadDataWithSingleQuotechar extends QueryTest with BeforeAndAfterAll {
   test("test data loading with single quote char") {
     try {
       sql(
-        "LOAD DATA LOCAL INPATH './src/test/resources/dataWithSingleQuote.csv' INTO TABLE " +
+        s"LOAD DATA LOCAL INPATH '$resourcesPath/dataWithSingleQuote.csv' INTO TABLE " +
           "carbontable OPTIONS('DELIMITER'= ',')")
+      sql("SELECT * from carbontable").show(100, false)
       checkAnswer(
         sql("SELECT * from carbontable"),
         Seq(Row(1,"Tom"),

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestCSVHavingOnlySpaceChar.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestCSVHavingOnlySpaceChar.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestCSVHavingOnlySpaceChar.scala
deleted file mode 100644
index 06cfadf..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestCSVHavingOnlySpaceChar.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.integration.spark.testsuite.emptyrow
-
-import java.io.File
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
-
-class TestCSVHavingOnlySpaceChar extends QueryTest with BeforeAndAfterAll {
-
-  var csvFilePath : String = null
-
-  override def beforeAll {
-    sql("drop table if exists emptyRowCarbonTable")
-    //eid,ename,sal,presal,comm,deptno,Desc
-    sql(
-      "create table if not exists emptyRowCarbonTable (eid int,ename String,sal decimal,presal " +
-        "decimal,comm decimal" +
-        "(37,37),deptno decimal(18,2),Desc String) STORED BY 'org.apache.carbondata.format'"
-    )
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/mm/dd")
-    val currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-      .getCanonicalPath
-     csvFilePath = currentDirectory + "/src/test/resources/emptyrow/csvwithonlyspacechar.csv"
-      }
-
-
-  test("dataload") {
-    try {
-      sql(
-        s"""LOAD DATA INPATH '$csvFilePath' INTO table emptyRowCarbonTable OPTIONS('DELIMITER'=',','QUOTECHAR'='"')""")
-    } catch {
-      case e: Throwable =>
-        System.out.println(e.getMessage)
-        assert(e.getMessage.contains("First line of the csv is not valid."))
-    }
-  }
-
-  override def afterAll {
-    sql("drop table emptyRowCarbonTable")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestEmptyRows.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestEmptyRows.scala b/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestEmptyRows.scala
deleted file mode 100644
index de2c541..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/emptyrow/TestEmptyRows.scala
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.spark.testsuite.singlevaluerow
-
-import java.io.File
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
-import org.scalatest.BeforeAndAfterAll
-
-class TestEmptyRows extends QueryTest with BeforeAndAfterAll {
-
-  override def beforeAll {
-    sql("drop table if exists emptyRowCarbonTable")
-    sql("drop table if exists emptyRowHiveTable")
-    //eid,ename,sal,presal,comm,deptno,Desc
-    sql(
-      "create table if not exists emptyRowCarbonTable (eid int,ename String,sal decimal,presal " +
-        "decimal,comm decimal" +
-        "(37,37),deptno decimal(18,2),Desc String) STORED BY 'org.apache.carbondata.format'"
-    )
-    sql(
-      "create table if not exists emptyRowHiveTable(eid int,ename String,sal decimal,presal " +
-        "decimal,comm " +
-        "decimal(37,37),deptno decimal(18,2),Desc String)row format delimited fields " +
-        "terminated by ','"
-    )
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
-    val currentDirectory = new File(this.getClass.getResource("/").getPath + "/../../")
-      .getCanonicalPath
-    val csvFilePath = currentDirectory + "/src/test/resources/emptyrow/emptyRows.csv"
-
-    sql(
-      s"""LOAD DATA INPATH '$csvFilePath' INTO table emptyRowCarbonTable OPTIONS('DELIMITER'=',','QUOTECHAR'='"','FILEHEADER'='eid,ename,sal,presal,comm,deptno,Desc')""")
-
-    sql(
-      "LOAD DATA LOCAL INPATH '" + csvFilePath + "' into table " +
-        "emptyRowHiveTable"
-    )
-  }
-
-  test("select eid from table") {
-    checkAnswer(
-      sql("select eid from emptyRowCarbonTable"),
-      sql("select eid from emptyRowHiveTable")
-    )
-  }
-
-  test("select Desc from emptyRowTable") {
-    checkAnswer(
-      sql("select Desc from emptyRowCarbonTable"),
-      sql("select Desc from emptyRowHiveTable")
-    )
-  }
-
-  override def afterAll {
-    sql("drop table emptyRowCarbonTable")
-    sql("drop table emptyRowHiveTable")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AggregateQueryTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AggregateQueryTestCase.scala b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AggregateQueryTestCase.scala
deleted file mode 100644
index 2234d82..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AggregateQueryTestCase.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.spark.testsuite.aggquery
-
-import org.apache.spark.sql.Row
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * test cases for aggregate query
- */
-class AggregateQueryTestCase extends QueryTest with BeforeAndAfterAll {
-  override def beforeAll {
-    sql("create table normal (column1 string,column2 string,column3 string,column4 string,column5 string,column6 string,column7 string,column8 string,column9 string,column10 string,measure1 int,measure2 int,measure3 int,measure4 int) STORED BY 'org.apache.carbondata.format'")
-    sql("LOAD DATA LOCAL INPATH './src/test/resources/10dim_4msr.csv' INTO table normal options('FILEHEADER'='column1,column2,column3,column4,column5,column6,column7,column8,column9,column10,measure1,measure2,measure3,measure4')");
-  }
-
-  test("group by with having") {
-    checkAnswer(
-      sql("select column1,count(*) from normal group by column1 having count(*)>5"),
-      Seq(Row("column1119", 6)))
-  }
-
-  override def afterAll {
-    sql("drop table normal")
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AllDataTypesTestCaseAggregate.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AllDataTypesTestCaseAggregate.scala b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AllDataTypesTestCaseAggregate.scala
deleted file mode 100644
index f8b126e..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AllDataTypesTestCaseAggregate.scala
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.carbondata.spark.testsuite.aggquery
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.scalatest.BeforeAndAfterAll
-
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
-
-/**
- * Test Class for aggregate query on multiple datatypes
- *
- */
-class AllDataTypesTestCaseAggregate extends QueryTest with BeforeAndAfterAll {
-
-  override def beforeAll {
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
-    sql("DROP TABLE IF EXISTS alldatatypestableAGG")
-    sql("DROP TABLE IF EXISTS alldatatypescubeAGG_hive")
-    sql(
-      "CREATE TABLE alldatatypestableAGG (empno int, empname String, designation String, doj " +
-      "Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, deptname " +
-      "String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance " +
-      "int,utilization int,salary int) STORED BY 'org.apache.carbondata.format'")
-    sql(
-      "LOAD DATA LOCAL INPATH './src/test/resources/data.csv' INTO TABLE alldatatypestableAGG " +
-      "OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '\"')")
-    sql("DROP TABLE IF EXISTS alldatatypescubeAGG_hive")
-    sql(
-      "CREATE TABLE alldatatypescubeAGG_hive (empno int, empname String, designation String, doj " +
-      "Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, deptname " +
-      "String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance " +
-      "int,utilization int,salary int)row format delimited fields terminated by ','")
-    sql(
-      "LOAD DATA LOCAL INPATH './src/test/resources/datawithoutheader.csv' INTO TABLE alldatatypescubeAGG_hive")
-  }
-
-  test(
-    "select empno,empname,utilization,count(salary),sum(empno) from alldatatypestableAGG where " +
-    "empname in ('arvind','ayushi') group by empno,empname,utilization")
-  {
-    checkAnswer(
-      sql(
-        "select empno,empname,utilization,count(salary),sum(empno) from alldatatypestableAGG where" +
-        " empname in ('arvind','ayushi') group by empno,empname,utilization"),
-      sql(
-        "select empno,empname,utilization,count(salary),sum(empno) from alldatatypescubeAGG_hive where" +
-        " empname in ('arvind','ayushi') group by empno,empname,utilization"))
-  }
-
-  test(
-    "select empname,trim(designation),avg(salary),avg(empno) from alldatatypestableAGG where " +
-    "empname in ('arvind','ayushi') group by empname,trim(designation)")
-  {
-    checkAnswer(
-      sql(
-        "select empname,trim(designation),avg(salary),avg(empno) from alldatatypestableAGG where " +
-        "empname in ('arvind','ayushi') group by empname,trim(designation)"),
-      sql(
-        "select empname,trim(designation),avg(salary),avg(empno) from alldatatypescubeAGG_hive where " +
-        "empname in ('arvind','ayushi') group by empname,trim(designation)"))
-  }
-
-  test(
-    "select empname,length(designation),max(empno),min(empno), avg(empno) from " +
-    "alldatatypestableAGG where empname in ('arvind','ayushi') group by empname,length" +
-    "(designation) order by empname")
-  {
-    checkAnswer(
-      sql(
-        "select empname,length(designation),max(empno),min(empno), avg(empno) from " +
-        "alldatatypestableAGG where empname in ('arvind','ayushi') group by empname,length" +
-        "(designation) order by empname"),
-      sql(
-        "select empname,length(designation),max(empno),min(empno), avg(empno) from " +
-        "alldatatypescubeAGG_hive where empname in ('arvind','ayushi') group by empname,length" +
-        "(designation) order by empname"))
-  }
-
-  test("select count(empno), count(distinct(empno)) from alldatatypestableAGG")
-  {
-    checkAnswer(
-      sql("select count(empno), count(distinct(empno)) from alldatatypestableAGG"),
-      sql("select count(empno), count(distinct(empno)) from alldatatypescubeAGG_hive"))
-  }
-
-  override def afterAll {
-    sql("DROP TABLE IF EXISTS alldatatypescubeAGG")
-    sql("DROP TABLE IF EXISTS alldatatypescubeAGG_hive")
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/af2f204e/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AverageQueryTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AverageQueryTestCase.scala b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AverageQueryTestCase.scala
deleted file mode 100644
index 0ed40d6..0000000
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/aggquery/AverageQueryTestCase.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.carbondata.spark.testsuite.aggquery
-
-import org.apache.spark.sql.common.util.CarbonHiveContext._
-import org.apache.spark.sql.common.util.QueryTest
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
-import org.scalatest.BeforeAndAfterAll
-
-/**
- * test cases for aggregate query
- */
-class AverageQueryTestCase extends QueryTest with BeforeAndAfterAll {
-  override def beforeAll {
-    sql("drop table if exists carbonTable")
-    sql("drop table if exists hiveTable")
-    sql("""
-       CREATE TABLE carbonTable (ID int, date timeStamp, country string, count int,
-       phonetype string, serialname string, salary double)
-       STORED BY 'org.apache.carbondata.format'
-        TBLPROPERTIES('DICTIONARY_INCLUDE'='ID')""")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
-    sql("""LOAD DATA LOCAL INPATH './src/test/resources/avgTest.csv' INTO table carbonTable""")
-
-    // create a hive table for compatible check
-    sql("""
-       CREATE TABLE hiveTable (ID int, date timeStamp, country string, count int,
-       phonetype string, serialname string, salary double)
-       row format delimited fields terminated by ','""")
-    sql("LOAD DATA LOCAL INPATH './src/test/resources/avgTest.csv' INTO table hiveTable")
-  }
-
-  test("select avg(Measure_IntType)+IntType from carbonTable") {
-    checkAnswer(
-      sql("SELECT avg(count)+10 FROM carbonTable"),
-      sql("SELECT avg(count)+10 FROM hiveTable"))
-  }
-
-  test("select avg(Dimension_IntType)+IntType from table") {
-    checkAnswer(
-      sql("SELECT avg(ID)+10 FROM carbonTable"),
-      sql("SELECT avg(ID)+10 FROM hiveTable"))
-  }
-
-  test("select avg(TimeStamp)+IntType from table") {
-    checkAnswer(
-      sql("SELECT avg(date)+10 FROM carbonTable"),
-      sql("SELECT avg(date)+10 FROM hiveTable"))
-  }
-
-  test("select avg(TimeStamp) from table") {
-    checkAnswer(
-      sql("SELECT avg(date) FROM carbonTable"),
-      sql("SELECT avg(date) FROM hiveTable"))
-  }
-
-  test("select avg(StringType)+IntType from table") {
-    checkAnswer(
-      sql("SELECT avg(country)+10 FROM carbonTable"),
-      sql("SELECT avg(country)+10 FROM hiveTable"))
-  }
-
-  test("select max(StringType)+IntType from table") {
-    checkAnswer(
-      sql("SELECT max(country)+10 FROM carbonTable"),
-      sql("SELECT max(country)+10 FROM hiveTable"))
-  }
-
-  test("select min(StringType)+IntType from table") {
-    checkAnswer(
-      sql("SELECT min(country)+10 FROM carbonTable"),
-      sql("SELECT min(country)+10 FROM hiveTable"))
-  }
-
-  test("select sum(StringType)+IntType from table") {
-    checkAnswer(
-      sql("SELECT sum(country)+10 FROM carbonTable"),
-      sql("SELECT sum(country)+10 FROM hiveTable"))
-  }
-
-  test("select sum(distinct StringType)+IntType from table") {
-    checkAnswer(
-      sql("SELECT sum(distinct country)+10 FROM carbonTable"),
-      sql("SELECT sum(distinct country)+10 FROM hiveTable"))
-  }
-
-  override def afterAll {
-    sql("drop table carbonTable")
-    sql("drop table hiveTable")
-    CarbonProperties.getInstance()
-      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
-  }
-
-}


Mime
View raw message