Mahesh Raju Somalaraju created CARBONDATA-4285:
--------------------------------------------------
Summary: complex columns with global sort compaction is failed
Key: CARBONDATA-4285
URL: https://issues.apache.org/jira/browse/CARBONDATA-4285
Project: CarbonData
Issue Type: Bug
Reporter: Mahesh Raju Somalaraju
complex columns with global sort compaction is failed.
Steps to reproduce
-=-------------------------
1) create table with global sort
2) load the data multiple times
3) alter add columns
4) insert the data
5) repeat 3 and 4 for four times
6) execute the compaction.
test("test the complex columns with global sort compaction") {
sql("DROP TABLE IF EXISTS alter_global1")
sql("CREATE TABLE alter_global1(intField INT) STORED AS carbondata " +
"TBLPROPERTIES('sort_columns'='intField','sort_scope'='global_sort')")
sql("insert into alter_global1 values(1)")
sql("insert into alter_global1 values(2)")
sql("insert into alter_global1 values(3)")
sql( "ALTER TABLE alter_global1 ADD COLUMNS(str1 array<int>)")
sql("insert into alter_global1 values(4, array(1))")
checkAnswer(sql("select * from alter_global1"),
Seq(Row(1, null), Row(2, null), Row(3, null), Row(4, make(Array(1)))))
val addedColumns = addedColumnsInSchemaEvolutionEntry("alter_global1")
assert(addedColumns.size == 1)
sql("alter table alter_global1 compact 'minor'")
checkAnswer(sql("select * from alter_global1"),
Seq(Row(1, null), Row(2, null), Row(3, null), Row(4, make(Array(1)))))
sql("DROP TABLE IF EXISTS alter_global1")
}
test("test the multi-level complex columns with global sort compaction") {
sql("DROP TABLE IF EXISTS alter_global2")
sql("CREATE TABLE alter_global2(intField INT) STORED AS carbondata " +
"TBLPROPERTIES('sort_columns'='intField','sort_scope'='global_sort')")
sql("insert into alter_global2 values(1)")
// multi-level nested array
sql(
"ALTER TABLE alter_global2 ADD COLUMNS(arr1 array<array<int>>, arr2
array<struct<a1:string," +
"map1:Map<string, string>>>) ")
sql(
"insert into alter_global2 values(1, array(array(1,2)),
array(named_struct('a1','st'," +
"'map1', map('a','b'))))")
// multi-level nested struct
sql("ALTER TABLE alter_global2 ADD COLUMNS(struct1 struct<s1:string, arr:
array<int>>," +
" struct2 struct<num:double,contact:map<string,array<int>>>) ")
sql("insert into alter_global2 values(1, " +
"array(array(1,2)), array(named_struct('a1','st','map1', map('a','b'))), " +
"named_struct('s1','hi','arr',array(1,2)),
named_struct('num',2.3,'contact',map('ph'," +
"array(1,2))))")
// multi-level nested map
sql(
"ALTER TABLE alter_global2 ADD COLUMNS(map1 map<string,array<string>>, map2
map<string," +
"struct<d:int, s:struct<im:string>>>)")
sql("insert into alter_global2 values(1, " +
"array(array(1,2)), array(named_struct('a1','st','map1', map('a','b'))), " +
"named_struct('s1','hi','arr',array(1,2)),
named_struct('num',2.3,'contact',map('ph'," +
"array(1,2))),map('a',array('hi')),
map('a',named_struct('d',23,'s',named_struct('im'," +
"'sh'))))")
val addedColumns = addedColumnsInSchemaEvolutionEntry("alter_global2")
assert(addedColumns.size == 6)
sql("alter table alter_global2 compact 'minor'")
sql("DROP TABLE IF EXISTS alter_global2")
--
This message was sent by Atlassian Jira
(v8.3.4#803005)