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

    https://github.com/apache/carbondata/pull/2102#discussion_r177395075
  
    --- Diff: 
integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
 ---
    @@ -584,6 +589,98 @@ test("test alter command for boolean data type with 
correct default measure valu
           "alter table testalterwithbooleanwithoutdefaultvalue add 
columns(booleanfield boolean)")
         checkAnswer(sql("select * from 
testalterwithbooleanwithoutdefaultvalue"),Seq(Row(1,"anubhav",null)))
       }
    +  test("test alter command for filter on default values on date datatype") 
{
    +    sql("drop table if exists test")
    +    sql(
    +      "create table test(id int,vin string,phonenumber long,area 
string,salary int,country " +
    +      "string,longdate date) stored by 'carbondata'")
    +    sql("insert into test select 
1,'String1',12345,'area',20,'country','2017-02-12'")
    +    sql("alter table test add columns (c3 date) 
TBLPROPERTIES('DEFAULT.VALUE.c3' = '1993-01-01')")
    +    sql("insert into test select 
2,'String1',12345,'area',20,'country','2017-02-12','1994-01-01'")
    +    sql("insert into test select 
3,'String1',12345,'area',20,'country','2017-02-12','1995-01-01'")
    +    sql("insert into test select 
4,'String1',12345,'area',20,'country','2017-02-12','1996-01-01'")
    +    checkAnswer(sql("select id from test where c3='1993-01-01'"), 
Seq(Row(1)))
    +    checkAnswer(sql("select id from test where c3<'1995-01-01'"), 
Seq(Row(1), Row(2)))
    +    checkAnswer(sql("select id from test where c3>'1994-01-01'"), 
Seq(Row(3), Row(4)))
    +    checkAnswer(sql("select id from test where c3>='1995-01-01'"), 
Seq(Row(3), Row(4)))
    +    checkAnswer(sql("select id from test where c3<='1994-01-01'"), 
Seq(Row(1), Row(2)))
    +  }
    +
    +  test("test alter command for filter on default values on timestamp 
datatype") {
    +    def testFilterWithDefaultValue(flag: Boolean) = {
    +      CarbonProperties.getInstance()
    +        .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
    +          "yyyy/MM/dd HH:mm:ss")
    +      sql("drop table if exists test")
    +      sql(
    +        "create table test(id int,vin string,phonenumber long,area 
string,salary int,country " +
    +        "string,longdate date) stored by 'carbondata'")
    +      sql("insert into test select 
1,'String1',12345,'area',20,'country','2017-02-12'")
    +      if (flag) {
    +        sql(
    +          "alter table test add columns (c3 timestamp) 
TBLPROPERTIES('DEFAULT.VALUE.c3' = " +
    +          "'1996/01/01 11:11:11', 'DICTIONARY_INCLUDE' = 'c3')")
    +      } else {
    +        sql(
    +          "alter table test add columns (c3 timestamp) 
TBLPROPERTIES('DEFAULT.VALUE.c3' = " +
    +          "'1996/01/01 11:11:11')")
    +      }
    +      println("Timestamp Format: " + 
CarbonProperties.getInstance().getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT))
    +      println("flag : "+ flag)
    --- End diff --
    
    Remove all println statements


---

Reply via email to