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

    https://github.com/apache/carbondata/pull/1865#discussion_r164409707
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/preaggregate/TestPreAggCreateCommand.scala
 ---
    @@ -212,6 +215,60 @@ class TestPreAggCreateCommand extends QueryTest with 
BeforeAndAfterAll {
         sql("drop datamap agg0 on table maintable")
       }
     
    +  val timeSeries = TIMESERIES.getName
    +
    +  test("test PreAggregate table selection: create with preaggregate and 
hierarchy") {
    +    sql("drop table if exists maintabletime")
    +    sql(
    +      """
    +        | create table maintabletime(year int,month int,name string,salary 
int,dob string)
    +        | stored by 'carbondata'
    +        | tblproperties(
    +        |   'sort_scope'='Global_sort',
    +        |   'table_blocksize'='23',
    +        |   'sort_columns'='month,year,name')
    +      """.stripMargin)
    +    sql("insert into maintabletime select 10,11,'x',12,'2014-01-01 
00:00:00'")
    +    sql(
    +      s"""
    +         | create datamap agg0 on table maintabletime
    +         | using 'preaggregate'
    +         | as select dob,name from maintabletime
    +         | group by dob,name
    +       """.stripMargin)
    +    val e = intercept[MalformedCarbonCommandException] {
    +      sql(
    +        s"""
    +           | create datamap agg1 on table maintabletime
    +           | using 'preaggregate'
    +           | DMPROPERTIES (
    +           |  'event_time'='dob',
    +           |  'second_granularity'='1')
    +           | as select dob,name from maintabletime
    +           | group by dob,name
    +       """.stripMargin)
    +    }
    +    assert(e.getMessage.contains(s"$timeSeries keyword missing"))
    +    sql("drop table if exists maintabletime")
    +  }
    +
    +  test("test pre agg create table 21: using") {
    +    sql("drop datamap agg0 on table maintable")
    +
    +    val e: Exception = intercept[Exception] {
    +      sql(
    +        """
    +          | create datamap agg0 on table mainTable
    +          | using 'abc'
    +          | as select column3, sum(column3),column5, sum(column5)
    +          | from maintable
    +          | group by column3,column5,column2
    +        """.stripMargin)
    +    }
    +    assert(e.getMessage.contains(
    +      s"Unknown data map type abc, Please use one of $PREAGGREGATE or 
$TIMESERIES"))
    --- End diff --
    
    ok,done


---

Reply via email to