carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [07/20] incubator-carbondata git commit: Deleted load/loads support from DDL commands (#899)
Date Sat, 06 Aug 2016 10:00:24 GMT
Deleted load/loads support from DDL commands (#899)

 Deleted load/loads support from DDL commands for the ddl compatibility

* Added test cases


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

Branch: refs/heads/master
Commit: 627590e13b68891b3e25ed77ad398490a9358b36
Parents: a7a5eb2
Author: Manu <manohar.crazy09@gmail.com>
Authored: Tue Aug 2 20:59:33 2016 +0530
Committer: sujith71955 <sujithchacko.2010@gmail.com>
Committed: Tue Aug 2 20:59:33 2016 +0530

----------------------------------------------------------------------
 .../allqueries/AllDataTypesTestCase4.scala      |  4 +--
 .../allqueries/AllDataTypesTestCase6.scala      | 16 +++++-----
 .../org/apache/spark/sql/CarbonSqlParser.scala  |  7 ++---
 .../dataretention/DataRetentionTestCase.scala   | 33 +++++++++++++++++++-
 4 files changed, 45 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/627590e1/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase4.scala
----------------------------------------------------------------------
diff --git a/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase4.scala
b/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase4.scala
index 7b29afd..262474c 100644
--- a/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase4.scala
+++ b/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase4.scala
@@ -1447,7 +1447,7 @@ class AllDataTypesTestCase4 extends QueryTest with BeforeAndAfterAll
{
         "stored by 'org.apache.carbondata.format'"
       )
       checkAnswer(
-        sql("show loads for table tabledoesnotexist"),
+        sql("show segments for table tabledoesnotexist"),
         Seq()
       )
       fail("Unexpected behavior")
@@ -1467,7 +1467,7 @@ class AllDataTypesTestCase4 extends QueryTest with BeforeAndAfterAll
{
         "stored by 'org.apache.carbondata.format'"
       )
       checkAnswer(
-        sql("show loads for table"),
+        sql("show segments for table"),
         Seq()
       )
       fail("Unexpected behavior")

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/627590e1/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase6.scala
----------------------------------------------------------------------
diff --git a/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase6.scala
b/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase6.scala
index 393b907..de89a34 100644
--- a/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase6.scala
+++ b/integration-testcases/src/test/scala/org/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase6.scala
@@ -1785,7 +1785,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
   test("TC_1252") {
     sql("create table table7 (imei string,AMSize string,channelsId string,ActiveCountry string,
Activecity string,gamePointId decimal,deviceInformationId INT) stored by 'org.apache.carbondata.format'")
     checkAnswer(
-      sql("show loads for table table7"),
+      sql("show segments for table table7"),
       Seq())
     sql("drop table table7")
   }
@@ -1794,7 +1794,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
   test("TC_1253") {
     sql("create table table123 (imei string,deviceInformationId INT,MAC string,deviceColor
string, device_backColor string,modelId string, marketName string, AMSize string, ROMSize
string, CUPAudit string, CPIClocked string, series string, productionDate string, bomCode
string, internalModels string, deliveryTime string, channelsId string, channelsName string
, deliveryAreaId string, deliveryCountry string, deliveryProvince  string, deliveryCity string,deliveryDistrict
string, deliveryStreet string, oxSingleNumber string, ActiveCheckTime string, ActiveAreaId
string, ActiveCountry string, ActiveProvince string, Activecity string, ActiveDistrict  string,
ActiveStreet string, ActiveOperatorId string, Active_releaseId string, Active_EMUIVersion
string, Active_operaSysVersion string, Active_BacVerNumber string, Active_BacFlashVer string,
Active_webUIVersion string, Active_webUITypeCarrVer string,Active_webTypeDataVerNumber string,
Active_operatorsVersion string, Active_phonePADPartitione
 dVersions string, Latest_YEAR  INT, Latest_MONTH INT, Latest_DAY INT, Latest_HOUR string,
Latest_areaId string, Latest_country string, Latest_province string, Latest_city string, Latest_district
string, Latest_street string, Latest_releaseId string, Latest_EMUIVersion string, Latest_operaSysVersion
string, Latest_BacVerNumber string, Latest_BacFlashVer string, Latest_webUIVersion string,
Latest_webUITypeCarrVer string, Latest_webTypeDataVerNumber string, Latest_operatorsVersion
string, Latest_phonePADPartitionedVersions string, Latest_operatorId string, gamePointDescription
string,gamePointId decimal,contractNumber decimal) stored by 'org.apache.carbondata.format'")
     checkAnswer(
-      sql("show loads for table table123"),
+      sql("show segments for table table123"),
       Seq())
     sql("drop table table123")
   }
@@ -1805,7 +1805,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
     sql("LOAD DATA LOCAL INPATH  './src/test/resources/TestData1.csv' INTO table table9 OPTIONS('DELIMITER'=
',' ,'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId')")
     sql("LOAD DATA LOCAL INPATH  './src/test/resources/TestData1.csv' INTO table table9 OPTIONS('DELIMITER'=
',' ,'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId')")
     checkAnswer(
-      sql("show loads for table table9"),
+      sql("show segments for table table9"),
       Seq(Row("0","Success","2015-11-05 17:43:21.0"," 2015-11-05 17:43:22.0"),Row("1","Success","2015-11-05
17:43:43.0"," 2015-11-05 17:43:44.0")))
     sql("drop table table9")
   }
@@ -1814,7 +1814,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
   test("TC_1257") {
     sql("create table table12 (imei string,AMSize string,channelsId string,ActiveCountry
string, Activecity string,gamePointId decimal,deviceInformationId INT) stored by 'org.apache.carbondata.format'")
     checkAnswer(
-      sql("show loads for table table12"),
+      sql("show segments for table table12"),
       Seq())
     sql("drop table table12")
   }
@@ -1824,7 +1824,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
     sql("create table table13 (imei string,AMSize string,channelsId string,ActiveCountry
string, Activecity string,gamePointId decimal,deviceInformationId INT) stored by 'org.apache.carbondata.format'")
     sql("LOAD DATA LOCAL INPATH  './src/test/resources/TestData1.csv' INTO table table13
OPTIONS('DELIMITER'= ',' ,'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId')")
     checkAnswer(
-      sql("sHOw LoaDs for table table13"),
+      sql("sHOw segMents for table table13"),
       Seq(Row("0","Success","2015-11-05 18:09:40.0"," 2015-11-05 18:09:41.0")))
     sql("drop table table13")
   }
@@ -1837,7 +1837,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
     sql("LOAD DATA LOCAL INPATH  './src/test/resources/TestData1.csv' INTO table table14
OPTIONS('DELIMITER'= ',' ,'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId')")
     sql("select * from table14")
     checkAnswer(
-      sql("show loads for table table14"),
+      sql("show segments for table table14"),
       Seq(Row("1","Success","2015-11-05 17:43:21.0"," 2015-11-05 17:43:22.0"),Row("0","Success","2015-11-05
17:43:43.0"," 2015-11-05 17:43:44.0")))
     sql("drop table table14")
   }
@@ -1850,7 +1850,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
     sql("LOAD DATA LOCAL INPATH  './src/test/resources/TestData1.csv' INTO table table15
OPTIONS('DELIMITER'= ',' ,'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId')")
     sql("LOAD DATA LOCAL INPATH  './src/test/resources/TestData1.csv' INTO table table15
OPTIONS('DELIMITER'= ',' ,'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId')")
     checkAnswer(
-      sql("show loads for table table15"),
+      sql("show segments for table table15"),
       Seq(Row("3","Success","2015-11-05 17:43:21.0"," 2015-11-05 17:43:22.0"),Row("2","Success","2015-11-05
17:43:21.0"," 2015-11-05 17:43:22.0"),Row("1","Success","2015-11-05 17:43:21.0"," 2015-11-05
17:43:22.0"),Row("0","Success","2015-11-05 17:43:43.0"," 2015-11-05 17:43:44.0")))
     sql("drop table table15")
   }
@@ -1860,7 +1860,7 @@ class AllDataTypesTestCase6 extends QueryTest with BeforeAndAfterAll
{
     sql("create table t202 (imei string,deviceInformationId INT,mac string,productdate timestamp,updatetime
timestamp,gamePointId decimal,contractNumber decimal) stored by 'org.apache.carbondata.format'")
     sql("LOAD DATA LOCAL INPATH './src/test/resources/test1t.csv' INTO table t202 OPTIONS
('DELIMITER'= ',', 'QUOTECHAR'= '\"\"', 'FILEHEADER'= 'imei,deviceInformationId,mac,productdate,updatetime,gamePointId,contractNumber')")
     checkAnswer(
-      sql("show loads for table t202"),
+      sql("show segments for table t202"),
       Seq())
     sql("drop table t202")
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/627590e1/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
index 5c25406..e0ccd2b 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
@@ -96,7 +96,6 @@ class CarbonSqlParser()
   protected val LEVELS = carbonKeyWord("LEVELS")
   protected val LIKE = carbonKeyWord("LIKE")
   protected val LOAD = carbonKeyWord("LOAD")
-  protected val LOADS = carbonKeyWord("LOADS")
   protected val LOCAL = carbonKeyWord("LOCAL")
   protected val MAPPED = carbonKeyWord("MAPPED")
   protected val MEASURES = carbonKeyWord("MEASURES")
@@ -1309,7 +1308,7 @@ class CarbonSqlParser()
   }
 
   protected lazy val showLoads: Parser[LogicalPlan] =
-    SHOW ~> (LOADS|SEGMENTS) ~> FOR ~> TABLE ~> (ident <~ ".").? ~ ident ~
+    SHOW ~> SEGMENTS ~> FOR ~> TABLE ~> (ident <~ ".").? ~ ident ~
       (LIMIT ~> numericLit).? <~
       opt(";") ^^ {
       case schemaName ~ cubeName ~ limit =>
@@ -1322,7 +1321,7 @@ class CarbonSqlParser()
       )
 
   protected lazy val deleteLoadsByID: Parser[LogicalPlan] =
-    DELETE ~> (LOAD|SEGMENT) ~> repsep(segmentId, ",") ~ (FROM ~> TABLE ~>
+    DELETE ~> SEGMENT ~> repsep(segmentId, ",") ~ (FROM ~> TABLE ~>
       (ident <~ ".").? ~ ident) <~
       opt(";") ^^ {
       case loadids ~ cube => cube match {
@@ -1331,7 +1330,7 @@ class CarbonSqlParser()
     }
 
   protected lazy val deleteLoadsByLoadDate: Parser[LogicalPlan] =
-    DELETE ~> (LOADS|SEGMENTS) ~> FROM ~> TABLE ~> (ident <~ ".").? ~ ident
~
+    DELETE ~> SEGMENTS ~> FROM ~> TABLE ~> (ident <~ ".").? ~ ident ~
       (WHERE ~> (STARTTIME <~ BEFORE) ~ stringLit) <~
       opt(";") ^^ {
       case schema ~ cube ~ condition =>

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/627590e1/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataretention/DataRetentionTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataretention/DataRetentionTestCase.scala
b/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataretention/DataRetentionTestCase.scala
index 683dcf8..2c359f9 100644
--- a/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataretention/DataRetentionTestCase.scala
+++ b/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataretention/DataRetentionTestCase.scala
@@ -133,7 +133,7 @@ class DataRetentionTestCase extends QueryTest with BeforeAndAfterAll {
 
   test("RetentionTest3_DeleteByLoadId") {
     // delete segment 2 and load ind segment
-    sql("DELETE LOAD 2 FROM TABLE dataretentionTable")
+    sql("DELETE SEGMENT 2 FROM TABLE dataretentionTable")
     sql(
       "LOAD DATA LOCAL INPATH '" + resource + "dataretention1.csv' INTO TABLE dataretentionTable
" +
       "OPTIONS('DELIMITER' = ',')")
@@ -223,4 +223,35 @@ class DataRetentionTestCase extends QueryTest with BeforeAndAfterAll
{
 
   }
 
+  test("RetentionTest_InvalidDeleteCommands") {
+
+    // All these queries should fail.
+    try {
+      sql("DELETE LOADS FROM TABLE dataretentionTable where STARTTIME before '2099-01-01'")
+      throw new MalformedCarbonCommandException("Invalid query")
+    } catch {
+      case e: MalformedCarbonCommandException =>
+        assert(!e.getMessage.equalsIgnoreCase("Invalid query"))
+      case _ => assert(true)
+    }
+
+    try {
+      sql("DELETE LOAD 2 FROM TABLE dataretentionTable")
+      throw new MalformedCarbonCommandException("Invalid query")
+    } catch {
+      case e: MalformedCarbonCommandException =>
+        assert(!e.getMessage.equalsIgnoreCase("Invalid query"))
+      case _ => assert(true)
+    }
+
+    try {
+      sql("show loads for table dataretentionTable")
+      throw new MalformedCarbonCommandException("Invalid query")
+    } catch {
+      case e: MalformedCarbonCommandException =>
+        assert(!e.getMessage.equalsIgnoreCase("Invalid query"))
+      case _ => assert(true)
+    }
+
+  }
 }


Mime
View raw message