Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1839#discussion_r164339675
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/HorizontalCompactionTestCase.scala
 ---
    @@ -350,8 +350,41 @@ class HorizontalCompactionTestCase extends QueryTest 
with BeforeAndAfterAll {
         )
         sql("""drop table dest2""")
       }
    +  test("test the compaction after alter command") // As per bug 
Carbondata-2016
    +  {
    +    try {
    +      sql(
    +        "CREATE TABLE CUSTOMER1 ( C_CUSTKEY INT , C_NAME STRING , 
C_ADDRESS STRING , C_NATIONKEY INT , C_PHONE STRING , C_ACCTBAL DECIMAL(15,2) , 
C_MKTSEGMENT STRING , C_COMMENT STRING) stored by 'carbondata'")
     
    +      sql(
    +        "insert into customer1 
values(1,'vandana','noida',1,'123456789',45987.78,'hello','comment')")
     
    +      sql(
    +        "insert into customer1 
values(2,'vandana','noida',2,'123456789',487.78,'hello','comment')")
    +
    +      sql(
    +        " insert into customer1 
values(3,'geetika','delhi',3,'123456789',487897.78,'hello','comment')")
    +
    +      sql(
    +        "insert into customer1 
values(4,'sangeeta','delhi',3,'123456789',48789.78,'hello','comment')")
    +
    +      sql(
    +        "alter table customer1 add columns (shortfield short) 
TBLPROPERTIES ('DEFAULT.VALUE.shortfield'='10')")
    +
    +      sql(
    +        "alter table customer1 add columns (intfield int) TBLPROPERTIES 
('DEFAULT.VALUE.intfield'='10')")
    +
    +      sql(
    +        "alter table customer1 add columns (longfield bigint) 
TBLPROPERTIES ('DEFAULT.VALUE.longfield'='10')")
    +
    +      sql("alter table customer1 compact 'minor' ").show()
    +      assert(true)
    --- End diff --
    
    1. Remove try catch block..its not required..in case of any exception 
anyways the test case will fail.
    2. In the add column DDL's. give the default value as MAX value of the 
corresponding datatype so that the same is validated after compaction in the 
select query validation.
    3. After compaction match the newly added column values as select query 
using checkAnswer.


---

Reply via email to