carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvram...@apache.org
Subject [02/22] incubator-carbondata git commit: Update Test Case Modification and Rectify TimeStamp retrieval from file
Date Fri, 06 Jan 2017 13:57:02 GMT
Update Test Case Modification and Rectify TimeStamp retrieval from file

(cherry picked from commit 0ae0d9f56023d672236a7ca8965df93a06404757)


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

Branch: refs/heads/master
Commit: c9c68a1c69a29401d95ce8fcdfb2fc57bcd9a638
Parents: 8dda2a8
Author: root <sounakr@gmail.com>
Authored: Thu Jan 5 14:44:13 2017 +0530
Committer: Venkata Ramana G <ramana.gollamudi@huawei.com>
Committed: Fri Jan 6 19:16:29 2017 +0530

----------------------------------------------------------------------
 .../cache/DeleteDeltaDataCache.java             | 29 --------
 .../core/carbon/path/CarbonTablePath.java       | 21 ++----
 .../core/update/CarbonUpdateUtil.java           |  2 +-
 .../CarbonFormatDirectoryStructureTest.java     |  4 +-
 .../sql/execution/command/IUDCommands.scala     |  2 +-
 .../testsuite/iud/IUDCompactionTestCases.scala  | 19 +++++
 .../iud/UpdateCarbonTableTestCase.scala         | 75 ++++++++++----------
 7 files changed, 65 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/core/src/main/java/org/apache/carbondata/common/iudprocessor/cache/DeleteDeltaDataCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/common/iudprocessor/cache/DeleteDeltaDataCache.java
b/core/src/main/java/org/apache/carbondata/common/iudprocessor/cache/DeleteDeltaDataCache.java
deleted file mode 100644
index 7fd4d04..0000000
--- a/core/src/main/java/org/apache/carbondata/common/iudprocessor/cache/DeleteDeltaDataCache.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.carbondata.common.iudprocessor.cache;
-
-import org.roaringbitmap.RoaringBitmap;
-
-/**
- * Created by S71955 on 06-10-2016.
- */
-public class DeleteDeltaDataCache {
-  private RoaringBitmap deleteDelataDataCache;
-  private String timeStamp;
-
-  public DeleteDeltaDataCache(int[] deleteDeltaFileData, String timeStamp) {
-    deleteDelataDataCache = RoaringBitmap.bitmapOf(deleteDeltaFileData);
-    this.timeStamp=timeStamp;
-  }
-
-  public boolean contains(int key) {
-    return deleteDelataDataCache.contains(key);
-  }
-
-  public int getSize() {
-    return deleteDelataDataCache.getCardinality();
-  }
-
-  public String getCacheTimeStamp() {
-    return timeStamp;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/core/src/main/java/org/apache/carbondata/core/carbon/path/CarbonTablePath.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/path/CarbonTablePath.java
b/core/src/main/java/org/apache/carbondata/core/carbon/path/CarbonTablePath.java
index bbece41..e57fae0 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/path/CarbonTablePath.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/path/CarbonTablePath.java
@@ -443,27 +443,14 @@ public class CarbonTablePath extends Path {
     /**
      * gets updated timestamp information from given carbon data file name
      */
-    public static String getUpdateTimeStamp(String carbonDataFileName) {
-      // Get the file name from path
+    public static String getTimeStampFromFileName(String carbonDataFileName) {
+      // Get the timestamp portion of the file.
       String fileName = getFileName(carbonDataFileName);
-      // + 1 for size of "-"
-      int firstDashPos = fileName.indexOf("-");
-      int secondDashPos = fileName.indexOf("-", firstDashPos + 1);
-      int startIndex = fileName.indexOf("-", secondDashPos + 1) + 1;
-      int endIndex = fileName.indexOf(".");
+      int startIndex = fileName.lastIndexOf(CarbonCommonConstants.HYPHEN) + 1;
+      int endIndex = fileName.indexOf(".", startIndex);
       return fileName.substring(startIndex, endIndex);
     }
 
-    /**
-     * gets updated timestamp information from given carbon index file name
-     */
-    public static String getUpdateTimeStampFromIndexFile(String carbonIndexFileName) {
-      // Get the file name from path
-      String fileName = getFileName(carbonIndexFileName);
-      int startIndex = fileName.indexOf("-") + 1;
-      int endIndex = fileName.indexOf(".");
-      return fileName.substring(startIndex, endIndex);
-    }
 
     /**
      * This will return the timestamp present in the delete delta file.

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/core/src/main/java/org/apache/carbondata/core/update/CarbonUpdateUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/update/CarbonUpdateUtil.java b/core/src/main/java/org/apache/carbondata/core/update/CarbonUpdateUtil.java
index 26418a6..89fc56c 100644
--- a/core/src/main/java/org/apache/carbondata/core/update/CarbonUpdateUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/update/CarbonUpdateUtil.java
@@ -650,7 +650,7 @@ public class CarbonUpdateUtil {
               .substring(invalidFile.getName().lastIndexOf(CarbonCommonConstants.HYPHEN)
+ 1));
     } else {
       fileTimestamp = CarbonUpdateUtil.getTimeStampAsLong(
-              CarbonTablePath.DataFileUtil.getUpdateTimeStamp(invalidFile.getName()));
+              CarbonTablePath.DataFileUtil.getTimeStampFromFileName(invalidFile.getName()));
     }
 
     // if the timestamp of the file is more than the current time by query execution timeout.

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/core/src/test/java/org/apache/carbondata/core/path/CarbonFormatDirectoryStructureTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/path/CarbonFormatDirectoryStructureTest.java
b/core/src/test/java/org/apache/carbondata/core/path/CarbonFormatDirectoryStructureTest.java
index 95dd5d7..a085b9a 100644
--- a/core/src/test/java/org/apache/carbondata/core/path/CarbonFormatDirectoryStructureTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/path/CarbonFormatDirectoryStructureTest.java
@@ -64,10 +64,10 @@ public class CarbonFormatDirectoryStructureTest {
     assertTrue(CarbonTablePath.DataFileUtil.getPartNo("part-3-4-999.carbondata").equals("3"));
     assertTrue(CarbonTablePath.DataFileUtil.getTaskNo("part-3-4-999.carbondata").equals("4"));
     assertTrue(
-        CarbonTablePath.DataFileUtil.getUpdateTimeStamp("part-3-4-999.carbondata").equals("999"));
+        CarbonTablePath.DataFileUtil.getTimeStampFromFileName("part-3-4-999.carbondata").equals("999"));
     assertTrue(CarbonTablePath.DataFileUtil.getPartNo("/opt/apache-carbon/part-3-4-999.carbondata").equals("3"));
     assertTrue(CarbonTablePath.DataFileUtil.getTaskNo("/opt/apache-carbon/part-3-4-999.carbondata").equals("4"));
     assertTrue(
-        CarbonTablePath.DataFileUtil.getUpdateTimeStamp("/opt/apache-carbon/part-3-4-999.carbondata").equals("999"));
+        CarbonTablePath.DataFileUtil.getTimeStampFromFileName("/opt/apache-carbon/part-3-4-999.carbondata").equals("999"));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/IUDCommands.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/IUDCommands.scala
b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/IUDCommands.scala
index e21f223..2730a84 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/IUDCommands.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/IUDCommands.scala
@@ -488,7 +488,7 @@ object IUDCommon {
 class HorizontalCompactionException(
     message: String,
     // required for cleanup
-    val compactionTimeStamp: Long) extends Exception(message) {
+    val compactionTimeStamp: Long) extends RuntimeException(message) {
 }
 
 object deleteExecution {

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/IUDCompactionTestCases.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/IUDCompactionTestCases.scala
b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/IUDCompactionTestCases.scala
index 8be97a8..57555dd 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/IUDCompactionTestCases.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/IUDCompactionTestCases.scala
@@ -1,3 +1,22 @@
+/*
+ * 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.iud
 
 import org.apache.spark.sql.Row

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c9c68a1c/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
index 1b4e795..3a408f3 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
@@ -46,11 +46,11 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
   }
 
 
-  /*test("test update operation with 0 rows updation.") {
+  test("test update operation with 0 rows updation.") {
     sql("""drop table iud.zerorows""").show
     sql("""create table iud.zerorows (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
     sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.zerorows""")
-    sql("""update zerorows d  set (d.c2) = (d.c2 + 1) where d.c1 = 'a' and exists( select
* from iud.other o where o.c2 > 1)""").show()
+    sql("""update zerorows d  set (d.c2) = (d.c2 + 1) where d.c1 = 'a'""").show()
     sql("""update zerorows d  set (d.c2) = (d.c2 + 1) where d.c1 = 'xxx'""").show()
      checkAnswer(
       sql("""select c1,c2,c3,c5 from iud.zerorows"""),
@@ -59,22 +59,22 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
     sql("""drop table iud.zerorows""").show
 
 
-  }*/
+  }
 
 
- /*   test("update carbon table[select from source table with where and exist]") {
+  test("update carbon table[select from source table with where and exist]") {
       sql("""drop table iud.dest11""").show
       sql("""create table iud.dest11 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
       sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest11""")
-      sql("""update iud.dest11 d set (d.c3, d.c5 ) = (select s.c33,s.c55 from iud.source2
s where d.c1 = s.c11) where  exists( select * from iud.other o where o.c2 > 1)""").show()
+      sql("""update iud.dest11 d set (d.c3, d.c5 ) = (select s.c33,s.c55 from iud.source2
s where d.c1 = s.c11) where 1 = 1""").show()
       checkAnswer(
         sql("""select c3,c5 from iud.dest11"""),
         Seq(Row("cc","ccc"), Row("dd","ddd"),Row("ee","eee"), Row("MGM","Disco"),Row("RGK","Music"))
       )
       sql("""drop table iud.dest11""").show
    }
-*/
- /* test("update carbon table[using destination table columns with where and exist]") {
+
+   test("update carbon table[using destination table columns with where and exist]") {
     sql("""drop table iud.dest22""").show
     sql("""create table iud.dest22 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
     sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest22""")
@@ -82,25 +82,25 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
       sql("""select c2 from iud.dest22 where c1='a'"""),
       Seq(Row(1))
     )
-    sql("""update dest22 d  set (d.c2) = (d.c2 + 1) where d.c1 = 'a' and exists( select *
from iud.other o where o.c2 > 1)""").show()
+    sql("""update dest22 d  set (d.c2) = (d.c2 + 1) where d.c1 = 'a'""").show()
     checkAnswer(
       sql("""select c2 from iud.dest22 where c1='a'"""),
       Seq(Row(2))
     )
     sql("""drop table iud.dest22""").show
-   }*/
+   }
 
-/*    test("update carbon table without alias in set columns") {
+   test("update carbon table without alias in set columns") {
       sql("""drop table iud.dest33""").show
       sql("""create table iud.dest33 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
       sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest33""")
-     sql("""update iud.dest33 d set (c3,c5 ) = (select s.c33 ,s.c55  from iud.source2 s where
d.c1 = s.c11) where d.c1 = 'a' and exists( select * from iud.other o where o.c2 > 1)""").show()
+      sql("""update iud.dest33 d set (c3,c5 ) = (select s.c33 ,s.c55  from iud.source2 s
where d.c1 = s.c11) where d.c1 = 'a'""").show()
       checkAnswer(
         sql("""select c3,c5 from iud.dest33 where c1='a'"""),
         Seq(Row("MGM","Disco"))
       )
       sql("""drop table iud.dest33""").show
-  }*/
+  }
 
    test("update carbon table without alias in set three columns") {
      sql("""drop table iud.dest44""").show
@@ -114,29 +114,29 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
      sql("""drop table iud.dest44""").show
    }
 
-  /*  test("update carbon table[single column select from source with where and exist]")
{
+   test("update carbon table[single column select from source with where and exist]") {
       sql("""drop table iud.dest55""").show
       sql("""create table iud.dest55 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
       sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest55""")
-     sql("""update iud.dest55 d set (c3)  = (select s.c33 from iud.source2 s where d.c1 =
s.c11) where exists( select * from iud.other o where o.c2 > 1)""").show()
+     sql("""update iud.dest55 d set (c3)  = (select s.c33 from iud.source2 s where d.c1 =
s.c11) where 1 = 1""").show()
       checkAnswer(
         sql("""select c1,c3 from iud.dest55 """),
         Seq(Row("a","MGM"),Row("b","RGK"),Row("c","cc"),Row("d","dd"),Row("e","ee"))
       )
       sql("""drop table iud.dest55""").show
-   }*/
+   }
 
-/*  test("update carbon table[single column SELECT from source with where and exist]") {
+  test("update carbon table[single column SELECT from source with where and exist]") {
     sql("""drop table iud.dest55""").show
     sql("""create table iud.dest55 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
     sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest55""")
-    sql("""update iud.dest55 d set (c3)  = (SELECT s.c33 from iud.source2 s where d.c1 =
s.c11) where exists( select * from iud.other o where o.c2 > 1)""").show()
+    sql("""update iud.dest55 d set (c3)  = (SELECT s.c33 from iud.source2 s where d.c1 =
s.c11) where 1 = 1""").show()
     checkAnswer(
       sql("""select c1,c3 from iud.dest55 """),
       Seq(Row("a","MGM"),Row("b","RGK"),Row("c","cc"),Row("d","dd"),Row("e","ee"))
     )
     sql("""drop table iud.dest55""").show
-  }*/
+  }
 
    test("update carbon table[using destination table columns without where clause]") {
      sql("""drop table iud.dest66""").show
@@ -209,29 +209,30 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
      )
      sql("""drop table iud.dest120""").show
    }
-/*   test("update carbon table[using destination table where and exist]") {
+
+   test("update carbon table[using destination table where and exist]") {
      sql("""drop table iud.dest130""").show
      sql("""create table iud.dest130 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
      sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest130""")
-     sql("""update iud.dest130 dd  set (c2, c5 ) = (c2 + 1, "xyx")  where dd.c1 = 'a' and
exists( select * from iud.other o where o.c2 > 1)""").show()
+     sql("""update iud.dest130 dd  set (c2, c5 ) = (c2 + 1, "xyx")  where dd.c1 = 'a'""").show()
      checkAnswer(
        sql("""select c2,c5 from iud.dest130 where c1 = 'a' """),
        Seq(Row(2,"xyx"))
      )
      sql("""drop table iud.dest130""").show
-   }*/
+   }
 
-/*   test("update carbon table[using destination table (concat) where and exist]") {
+   test("update carbon table[using destination table (concat) where and exist]") {
      sql("""drop table iud.dest140""").show
      sql("""create table iud.dest140 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
      sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest140""")
-     sql("""update iud.dest140 d set (c2, c5 ) = (c2 + 1, concat(c5 , "z"))  where d.c1 =
'a' and exists( select * from iud.other o where o.c2 > 1)""").show()
+     sql("""update iud.dest140 d set (c2, c5 ) = (c2 + 1, concat(c5 , "z"))  where d.c1 =
'a'""").show()
      checkAnswer(
        sql("""select c2,c5 from iud.dest140 where c1 = 'a'"""),
        Seq(Row(2,"aaaz"))
      )
      sql("""drop table iud.dest140""").show
-   }*/
+   }
 
    test("update carbon table[using destination table (concat) with  where") {
      sql("""drop table iud.dest150""").show
@@ -290,7 +291,7 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
      }
    }
 
- /* test("""update carbon [special characters  in value- test parsing logic ]""") {
+ test("""update carbon [special characters  in value- test parsing logic ]""") {
     sql("""drop table iud.dest160""").show
     sql("""create table iud.dest160 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
     sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest160""")
@@ -298,26 +299,26 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll
{
     sql("""update iud.dest160 set(c1) =  ('abd$asjdh$adasj$l;sdf$*)$*)(&^')""").show()
     sql("""update iud.dest160 set(c1) =("\\")""").show()
     sql("""update iud.dest160 set(c1) = ("ab\')$*)(&^)")""").show()
-    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'a\\a' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from iud.other
o where o.c1 = d.c1)""").show()
-    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'\\' from iud.source2 s where d.c1
= s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from iud.other
o where o.c1 = d.c1)""").show()
-    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'\\a' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from iud.other
o where o.c1 = d.c1)""").show()
-    sql("""update iud.dest160 d set (c3,c5)      =     (select s.c33,'a\\a\\' from iud.source2
s where d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from
iud.other o where o.c1 = d.c1)""").show()
-    sql("""update iud.dest160 d set (c3,c5) =(select s.c33,'a\'a\\' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from iud.other
o where o.c1 = d.c1)""").show()
-    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'\\a\'a\"' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from iud.other
o where o.c1 = d.c1)""").show()
+    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'a\\a' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
+    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'\\' from iud.source2 s where d.c1
= s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
+    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'\\a' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
+    sql("""update iud.dest160 d set (c3,c5)      =     (select s.c33,'a\\a\\' from iud.source2
s where d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
+    sql("""update iud.dest160 d set (c3,c5) =(select s.c33,'a\'a\\' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
+    sql("""update iud.dest160 d set (c3,c5)=(select s.c33,'\\a\'a\"' from iud.source2 s where
d.c1 = s.c11 and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
     sql("""drop table iud.dest160""").show
   }
-*/
-  /*test("""update carbon [sub query, between and existing in outer condition.(Customer query
) ]""") {
+
+  test("""update carbon [sub query, between and existing in outer condition.(Customer query
) ]""") {
     sql("""drop table iud.dest170""").show
     sql("""create table iud.dest170 (c1 string,c2 int,c3 string,c5 string) STORED BY 'org.apache.carbondata.format'""").show()
     sql("""LOAD DATA LOCAL INPATH './src/test/resources/IUD/dest.csv' INTO table iud.dest170""")
-    sql("""update iud.dest170 d set (c3)=(select s.c33 from iud.source2 s where d.c1 = s.c11
and d.c2 = s.c22) where  d.c2 between 1 and 3 and exists( select * from iud.other o where
o.c1 = d.c1)""").show
+    sql("""update iud.dest170 d set (c3)=(select s.c33 from iud.source2 s where d.c1 = s.c11
and d.c2 = s.c22) where  d.c2 between 1 and 3""").show()
     checkAnswer(
-      sql("""select c3 from  iud.dest170 as d where  d.c2 between 1 and 3 and exists( select
* from iud.other o where o.c1 = d.c1)"""),
-      Seq(Row("MGM"), Row("RGK"))
+      sql("""select c3 from  iud.dest170 as d where d.c2 between 1 and 3"""),
+      Seq(Row("MGM"), Row("RGK"), Row("cc"))
     )
     sql("""drop table iud.dest170""").show
-  }*/
+  }
 
   test("""update carbon [self join select query ]""") {
     sql("""drop table iud.dest171""").show


Mime
View raw message