carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [34/50] [abbrv] carbondata git commit: add test case when record more than one pagesize
Date Wed, 05 Jul 2017 00:44:43 GMT
add test case when record more than one pagesize

delete unnecessary test case

add test case for IUD feature

add test case for IUD feature


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

Branch: refs/heads/streaming_ingest
Commit: 7e2e86e5c156fde3a0fa028a081e4caf2724513c
Parents: 28f8a0b
Author: chenerlu <chenerlu@huawei.com>
Authored: Thu Jun 29 11:36:10 2017 +0800
Committer: jackylk <jacky.likun@huawei.com>
Committed: Fri Jun 30 20:33:49 2017 +0800

----------------------------------------------------------------------
 .../iud/DeleteCarbonTableTestCase.scala         | 31 ++++++++++++++++++--
 .../iud/UpdateCarbonTableTestCase.scala         |  2 ++
 2 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/7e2e86e5/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
index 2e59c9c..d24f7b2 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
@@ -16,12 +16,10 @@
  */
 package org.apache.carbondata.spark.testsuite.iud
 
-import org.apache.spark.sql.Row
+import org.apache.spark.sql.{Row, SaveMode}
 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 DeleteCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
   override def beforeAll {
@@ -105,6 +103,33 @@ class DeleteCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
       Seq(Row(3))
     )
   }
+
+  test("Records more than one pagesize after delete operation ") {
+    sql("DROP TABLE IF EXISTS default.carbon2")
+    import sqlContext.implicits._
+    val df = sqlContext.sparkContext.parallelize(1 to 2000000)
+      .map(x => (x+"a", "b", x))
+      .toDF("c1", "c2", "c3")
+    df.write
+      .format("carbondata")
+      .option("tableName", "carbon2")
+      .option("tempCSV", "true")
+      .option("compress", "true")
+      .mode(SaveMode.Overwrite)
+      .save()
+
+    checkAnswer(sql("select count(*) from default.carbon2"), Seq(Row(2000000)))
+
+    sql("delete from default.carbon2 where c1 = '99999a'").show()
+
+    checkAnswer(sql("select count(*) from default.carbon2"), Seq(Row(1999999)))
+
+    checkAnswer(sql("select * from default.carbon2 where c1 = '99999a'"), Seq())
+
+    sql("DROP TABLE IF EXISTS default.carbon2")
+  }
+
+
   override def afterAll {
     sql("use default")
     sql("drop database  if exists iud_db cascade")

http://git-wip-us.apache.org/repos/asf/carbondata/blob/7e2e86e5/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
index 79fda30..c8a1c63 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
@@ -406,6 +406,8 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
 
     checkAnswer(sql("select count(*) from default.carbon1"), Seq(Row(36000)))
 
+    checkAnswer(sql("select * from default.carbon1 where c1 = 'test123'"), Row("test123","b",9999))
+
     sql("DROP TABLE IF EXISTS default.carbon1")
   }
 


Mime
View raw message