carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xubo245 <...@git.apache.org>
Subject [GitHub] carbondata pull request #1856: [CARBONDATA-2073][CARBONDATA-1516][Tests] Add...
Date Fri, 09 Feb 2018 06:14:13 GMT
Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1856#discussion_r167147440
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/timeseries/TestTimeSeriesDropSuite.scala
---
    @@ -36,16 +48,168 @@ class TestTimeSeriesDropSuite extends QueryTest with BeforeAndAfterAll
with Befo
           """.stripMargin)
       }
     
    -  test("test timeseries drop datamap 1: drop datamap should throw exception if no datamap")
{
    +  override def afterEach(): Unit = {
    +    dropDataMaps("mainTable", "agg1_second", "agg1_minute",
    +      "agg1_hour", "agg1_day", "agg1_month", "agg1_year")
    +  }
    +
    +  test("test timeseries drop datamap 1: drop datamap should throw exception") {
         // DROP DATAMAP DataMapName if the DataMapName not exists
         checkExistence(sql("SHOW DATAMAP ON TABLE mainTable"), false, "agg1_month")
         val e: Exception = intercept[Exception] {
           sql(s"DROP DATAMAP agg1_month ON TABLE mainTable")
         }
    -    assert(e.getMessage.equals("Datamap with name agg1_month does not exist under table
mainTable"))
    +    assert(e.getMessage.contains(
    +      "Datamap with name agg1_month does not exist under table mainTable"))
    +  }
    +
    +  test("test timeseries drop datamap 2: should support drop datamap IF EXISTS") {
    +    // DROP DATAMAP IF EXISTS DataMapName
    +    checkExistence(sql("SHOW DATAMAP ON TABLE mainTable"), false, "agg1_month")
    +    sql(s"DROP DATAMAP IF EXISTS agg1_month ON TABLE mainTable")
    +    assert(true)
    +  }
    +
    +  test("test timeseries drop datamap 3: should support drop datamap") {
    +    sql(
    +      s"""
    +         | CREATE DATAMAP agg1_month ON TABLE mainTable
    +         | USING '$timeSeries'
    +         | DMPROPERTIES (
    +         |   'event_time'='dataTime',
    +         |   'MONTH_GRANULARITY'='1')
    +         | AS SELECT dataTime, SUM(age) from mainTable
    +         | GROUP BY dataTime
    +       """.stripMargin)
    +
    +    // Before DROP DATAMAP
    +    checkExistence(sql("SHOW DATAMAP ON TABLE mainTable"), true, "agg1_month")
    +
    +    // DROP DATAMAP DataMapName
    +    sql(s"DROP DATAMAP agg1_month ON TABLE mainTable")
    +    checkExistence(sql("SHOW DATAMAP ON TABLE mainTable"), false, "agg1_month")
    +    val e: Exception = intercept[Exception] {
    +      sql(s"DROP DATAMAP agg1_month ON TABLE mainTable")
    +    }
    +    assert(e.getMessage.contains(
    +      "Datamap with name agg1_month does not exist under table mainTable"))
    +  }
    +
    +  test("test timeseries drop datamap 4: should support drop datamap with IF EXISTS")
{
    +    sql(
    +      s"""
    +         | CREATE DATAMAP agg1_month ON TABLE mainTable
    +         | USING '$timeSeries'
    +         | DMPROPERTIES (
    +         |   'event_time'='dataTime',
    +         |   'MONTH_GRANULARITY'='1')
    +         | AS SELECT dataTime, SUM(age) from mainTable
    +         | GROUP BY dataTime
    +       """.stripMargin)
    +    // DROP DATAMAP IF EXISTS DataMapName
    +    sql(s"DROP DATAMAP IF EXISTS agg1_year ON TABLE mainTable")
    +    checkExistence(sql("SHOW DATAMAP ON TABLE maintable"), false, "agg1_year")
    +    checkExistence(sql("SHOW DATAMAP ON TABLE mainTable"), true, "agg1_month")
    +
    +    // DROP DATAMAP DataMapName
    +    sql(s"DROP DATAMAP agg1_month ON TABLE mainTable")
    +    checkExistence(sql("SHOW DATAMAP ON TABLE mainTable"), false, "agg1_month")
    +    val e: Exception = intercept[Exception] {
    +      sql(s"DROP DATAMAP agg1_month ON TABLE mainTable")
    +    }
    +    assert(e.getMessage.contains(
    +      "Datamap with name agg1_month does not exist under table mainTable"))
    +  }
    +
    +  test("test timeseries drop datamap 5: drop datamap when table not exists") {
    --- End diff --
    
    ok,done


---

Mime
View raw message