You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by GitBox <gi...@apache.org> on 2021/06/18 20:53:14 UTC

[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #4154: [CARBONDATA-4214] inserting NULL value when timestamp value received from FROM_UNIXTIME(0)

Indhumathi27 commented on a change in pull request #4154:
URL: https://github.com/apache/carbondata/pull/4154#discussion_r654193200



##########
File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase.scala
##########
@@ -73,6 +75,21 @@ class AllDataTypesTestCase extends QueryTest with BeforeAndAfterAll {
     }
   }
 
+  test("insert data with from_unixtime(0) and query") {
+    sql("drop table if exists time_carbon1")
+    sql("create table if not exists time_carbon1(time1 timestamp) stored as carbondata")
+    sql("insert into time_carbon1 select from_unixtime(0)")

Review comment:
       insert into table select '', results should be NULL. After this change, it is inserting default time. Please check

##########
File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/management/CommonLoadUtils.scala
##########
@@ -781,9 +781,8 @@ object CommonLoadUtils {
         internalRowOriginal
       }
       for (index <- timeStampIndex) {
-        if (internalRow.getLong(index) == 0) {
-          internalRow.setNullAt(index)
-        } else {
+        // if value zero case spark will fill the timestamp. no need to fill null

Review comment:
       Should Check, internalRow.isNullAt(index) , for actual null or empty data. then insert null for that row

##########
File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/allqueries/AllDataTypesTestCase.scala
##########
@@ -73,6 +75,21 @@ class AllDataTypesTestCase extends QueryTest with BeforeAndAfterAll {
     }
   }
 
+  test("insert data with from_unixtime(0) and query") {
+    sql("drop table if exists time_carbon1")
+    sql("create table if not exists time_carbon1(time1 timestamp) stored as carbondata")
+    sql("insert into time_carbon1 select from_unixtime(0)")

Review comment:
       insert into table select '', results should be NULL. After this change, it is inserting default time. Please check and add a insert sql in this testcase




-- 
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:
users@infra.apache.org