[GitHub] [carbondata] kunal642 commented on a change in pull request #3970: [CARBONDATA-4007] Fix multiple issues in SDK

Posted by GitBox on
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-Karan980-opened-a-new-pull-request-3970-CARBONDATA-4007-Fix-multiple-issues-in-SDKD-tp101429p102264.html


kunal642 commented on a change in pull request #3970:
URL: https://github.com/apache/carbondata/pull/3970#discussion_r508307792



##########
File path: sdk/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonIUDTest.java
##########
@@ -72,6 +74,48 @@ public void testDelete() throws Exception {
     FileUtils.deleteDirectory(new File(path));
   }
 
+  @Test
+  public void testUpdateOnDateType() throws Exception {
+    String path = "./testWriteFiles";
+    CarbonProperties.getInstance()
+            .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
+                    CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
+            .addProperty(CarbonCommonConstants.CARBON_DATE_FORMAT,
+                    CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT);
+    FileUtils.deleteDirectory(new File(path));
+    Field[] fields = new Field[3];
+    fields[0] = new Field("intField", DataTypes.INT);
+    fields[1] = new Field("dateField", DataTypes.DATE);
+    fields[2] = new Field("timeField", DataTypes.TIMESTAMP);
+    CarbonWriter writer = CarbonWriter.builder()
+            .outputPath(path)
+            .withCsvInput(new Schema(fields))
+            .writtenBy("IUDTest")
+            .build();
+    for (int i = 0; i < 10; i++) {
+      String[] row2 = new String[]{
+              String.valueOf(i % 10000),
+              "2019-03-02",
+              "2019-02-12 03:03:34",
+      };
+      writer.write(row2);
+    }
+    writer.close();
+    CarbonIUD.getInstance().update(path, "intField", "0", "intField", "20").commit();
+    CarbonReader reader =
+            CarbonReader.builder(path).projection(new String[] { "intField", "dateField", "timeField" })
+                    .build();
+    int i = 0;
+    while (reader.hasNext()) {
+      Object[] row = (Object[]) reader.readNextRow();
+      assert ((int) row[0] != 0);

Review comment:
       please assert the complete row instead of first value




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]