[jira] [Created] (CARBONDATA-2085) It's different between load twice and create datamap with load again after load data and create datamap

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (CARBONDATA-2085) It's different between load twice and create datamap with load again after load data and create datamap

Akash R Nilugal (Jira)
xubo245 created CARBONDATA-2085:
-----------------------------------

             Summary: It's different between load twice and create datamap with load again after load data and create datamap
                 Key: CARBONDATA-2085
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-2085
             Project: CarbonData
          Issue Type: Bug
          Components: core, spark-integration
    Affects Versions: 1.3.0
            Reporter: xubo245
             Fix For: 1.3.0


It's different between load twice and create datamap with load again after load data and create datamap


{code:java}
 test("test if timeseries load twice is successful on table creation") {
    sql("drop table if exists mainTable")
    sql(
      """
        | CREATE TABLE mainTable(
        |   mytime timestamp,
        |   name string,
        |   age int)
        | STORED BY 'org.apache.carbondata.format'
      """.stripMargin)
    sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' into table mainTable")
    sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' into table mainTable")
    sql(
      """
        | create datamap agg0 on table mainTable
        | using 'preaggregate'
        | DMPROPERTIES (
        |   'timeseries.eventTime'='mytime',
        |   'timeseries.hierarchy'='second=1,minute=1,hour=1,day=1,month=1,year=1')
        | as select mytime, sum(age)
        | from mainTable
        | group by mytime
      """.stripMargin)
    checkAnswer(sql("select * from maintable_agg0_second"),
      Seq(Row(Timestamp.valueOf("2016-02-23 01:01:30.0"), 20),
        Row(Timestamp.valueOf("2016-02-23 01:01:40.0"), 40),
        Row(Timestamp.valueOf("2016-02-23 01:01:50.0"), 60),
        Row(Timestamp.valueOf("2016-02-23 01:02:30.0"), 80),
        Row(Timestamp.valueOf("2016-02-23 01:02:40.0"), 100),
        Row(Timestamp.valueOf("2016-02-23 01:02:50.0"), 100)))
  }

  // TODO: to be fixed
  ignore("load data into mainTable after create timeseries datamap on table") {
    sql("drop table if exists mainTable")
    sql(
      """
        | CREATE TABLE mainTable(
        |   mytime timestamp,
        |   name string,
        |   age int)
        | STORED BY 'org.apache.carbondata.format'
      """.stripMargin)
    sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' into table mainTable")
    sql(
      """
        | create datamap agg0 on table mainTable
        | using 'preaggregate'
        | DMPROPERTIES (
        |   'timeseries.eventTime'='mytime',
        |   'timeseries.hierarchy'='second=1,minute=1,hour=1,day=1,month=1,year=1')
        | as select mytime, sum(age)
        | from mainTable
        | group by mytime""".stripMargin)


    sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' into table mainTable")

    // Discussed
    checkAnswer(sql("select * from maintable_agg0_second"),
      Seq(Row(Timestamp.valueOf("2016-02-23 01:01:30.0"), 20),
        Row(Timestamp.valueOf("2016-02-23 01:01:40.0"), 40),
        Row(Timestamp.valueOf("2016-02-23 01:01:50.0"), 60),
        Row(Timestamp.valueOf("2016-02-23 01:02:30.0"), 80),
        Row(Timestamp.valueOf("2016-02-23 01:02:40.0"), 100),
        Row(Timestamp.valueOf("2016-02-23 01:02:50.0"), 100)))

    //TODO: to be discussed, why is success?
    //    checkAnswer(sql("select * from maintable_agg0_second"),
    //      Seq(Row(Timestamp.valueOf("2016-02-23 01:01:30.0"), 10),
    //        Row(Timestamp.valueOf("2016-02-23 01:01:40.0"), 20),
    //        Row(Timestamp.valueOf("2016-02-23 01:01:50.0"), 30),
    //        Row(Timestamp.valueOf("2016-02-23 01:02:30.0"), 40),
    //        Row(Timestamp.valueOf("2016-02-23 01:02:40.0"), 50),
    //        Row(Timestamp.valueOf("2016-02-23 01:02:50.0"), 50),
    //        Row(Timestamp.valueOf("2016-02-23 01:01:30.0"), 10),
    //        Row(Timestamp.valueOf("2016-02-23 01:01:40.0"), 20),
    //        Row(Timestamp.valueOf("2016-02-23 01:01:50.0"), 30),
    //        Row(Timestamp.valueOf("2016-02-23 01:02:30.0"), 40),
    //        Row(Timestamp.valueOf("2016-02-23 01:02:40.0"), 50),
    //        Row(Timestamp.valueOf("2016-02-23 01:02:50.0"), 50)))
  }

{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)