SWATI RAO created CARBONDATA-1360:
-------------------------------------

             Summary: Update is not working properly for complex datatype
                 Key: CARBONDATA-1360
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-1360
             Project: CarbonData
          Issue Type: Bug
          Components: sql
    Affects Versions: 1.1.1
         Environment: Spark 2.1
            Reporter: SWATI RAO
            Priority: Minor
         Attachments: structofarray.csv

Steps to reproduce :

create table STRUCT_OF_ARRAY_update1 (CUST_ID string, YEAR int, MONTH int, AGE 
int, GENDER string, EDUCATED string, IS_MARRIED string, STRUCT_OF_ARRAY 
struct<ID: int,CHECK_DATE: timestamp,SNo: array<int>,sal1: array<double>,state: 
array<string>,date1: array<timestamp>>,CARD_COUNT int,DEBIT_COUNT int, 
CREDIT_COUNT int, DEPOSIT double, HQ_DEPOSIT double) STORED BY 
'org.apache.carbondata.format' 
TBLPROPERTIES('NO_INVERTED_INDEX'='STRUCT_OF_ARRAY');
+---------+--+
| Result  |
+---------+--+
+---------+--+
No rows selected (1.137 seconds)


LOAD DATA INPATH 
'hdfs://localhost:54311/BabuStore/TestData/Data/complex/structofarray.csv' INTO 
table STRUCT_OF_ARRAY_update1 options ('DELIMITER'=',', 'QUOTECHAR'='"', 
'FILEHEADER'='CUST_ID,YEAR,MONTH,AGE,GENDER,EDUCATED,IS_MARRIED,STRUCT_OF_ARRAY,CARD_COUNT,DEBIT_COUNT,CREDIT_COUNT,DEPOSIT,HQ_DEPOSIT','COMPLEX_DELIMITER_LEVEL_1'='$','COMPLEX_DELIMITER_LEVEL_2'='&');
+---------+--+
| Result  |
+---------+--+
+---------+--+
No rows selected (3.82 seconds)


update STRUCT_OF_ARRAY_update1 
set(struct_of_array)=('{"ID":123457790,"CHECK_DATE":null,"SNo":[1099,3000],"sal1":[1099.123,3999.234],"state":["United
 States","HI"],"date1":[null,null]},77,112,145,4.123030672E8,7.028563114E8') 
where cust_id in ('Cust00000000000000000999') ;
+---------+--+
| Result  |
+---------+--+
+---------+--+
No rows selected (3.329 seconds)

select struct_of_array from STRUCT_OF_ARRAY_update1 where cust_id in 
('Cust00000000000000000999') ;
+-----------------------------------------------------------------------------------------+--+
|                                     struct_of_array                           
          |
+-----------------------------------------------------------------------------------------+--+
| 
{"ID":null,"CHECK_DATE":null,"SNo":[null],"sal1":[null],"state":[null],"date1":[null]}
  |
+-----------------------------------------------------------------------------------------+--+
1 row selected (0.433 seconds)
 
*No column of Structure gets updated*

When we update query using this query :

0: jdbc:hive2://localhost:10000> update STRUCT_OF_ARRAY_update1 
set(struct_of_array)=(8) ;
+---------+--+
| Result  |
+---------+--+
+---------+--+
No rows selected (2.82 seconds)
0: jdbc:hive2://localhost:10000> select struct_of_array from 
STRUCT_OF_ARRAY_update1 where cust_id in ('Cust00000000000000000999') ;
+--------------------------------------------------------------------------------------+--+
|                                   struct_of_array                             
       |
+--------------------------------------------------------------------------------------+--+
| 
{"ID":8,"CHECK_DATE":null,"SNo":[null],"sal1":[null],"state":[null],"date1":[null]}
  |
+--------------------------------------------------------------------------------------+--+
1 row selected (0.191 seconds)

*1st column of Structure gets updated*






--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to