Github user kunal642 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1856#discussion_r174064540
--- Diff:
integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/timeseries/TestTimeseriesDataLoad.scala
---
@@ -330,16 +366,232 @@ class TestTimeseriesDataLoad extends QueryTest with
BeforeAndAfterAll {
""".stripMargin)
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)))
+ Seq(Row(Timestamp.valueOf("2016-02-23 09:01:30.0"), 10),
+ Row(Timestamp.valueOf("2016-02-23 09:01:40.0"), 20),
+ Row(Timestamp.valueOf("2016-02-23 09:01:50.0"), 30),
+ Row(Timestamp.valueOf("2016-02-23 09:02:30.0"), 40),
+ Row(Timestamp.valueOf("2016-02-23 09:02:40.0"), 50),
+ Row(Timestamp.valueOf("2016-02-23 09:02:50.0"), 50)))
+ }
+
+ test("test timeseries table selection 14: load data into mainTable after
create timeseries datamap ON TABLE and SELECT sub table") {
+ sql("DROP TABLE IF EXISTS main_table")
+ sql(
+ """
+ | CREATE TABLE main_table(
+ | mytime timestamp,
+ | name string,
+ | age int)
+ | STORED BY 'org.apache.carbondata.format'
+ """.stripMargin)
+ sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' INTO
TABLE main_table")
+ sql(
+ s"""
+ | CREATE DATAMAP agg0_second ON TABLE main_table
+ | USING '$timeSeries'
+ | DMPROPERTIES (
+ | 'event_time'='mytime',
+ | 'SECOND_GRANULARITY'='1')
+ | AS SELECT mytime, SUM(age)
+ | FROM main_table
+ | GROUP BY mytime""".stripMargin)
+
+
+ sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/timeseriestest.csv' INTO
TABLE main_table")
+
+ checkAnswer(sql("SELECT * FROM main_table_agg0_second"),
+ Seq(Row(Timestamp.valueOf("2016-02-23 09:01:30.0"), 10),
+ Row(Timestamp.valueOf("2016-02-23 09:01:40.0"), 20),
+ Row(Timestamp.valueOf("2016-02-23 09:01:50.0"), 30),
+ Row(Timestamp.valueOf("2016-02-23 09:02:30.0"), 40),
+ Row(Timestamp.valueOf("2016-02-23 09:02:40.0"), 50),
+ Row(Timestamp.valueOf("2016-02-23 09:02:50.0"), 50),
+ Row(Timestamp.valueOf("2016-02-23 09:01:30.0"), 10),
+ Row(Timestamp.valueOf("2016-02-23 09:01:40.0"), 20),
+ Row(Timestamp.valueOf("2016-02-23 09:01:50.0"), 30),
+ Row(Timestamp.valueOf("2016-02-23 09:02:30.0"), 40),
+ Row(Timestamp.valueOf("2016-02-23 09:02:40.0"), 50),
+ Row(Timestamp.valueOf("2016-02-23 09:02:50.0"), 50)))
+ }
+
+ test("test timeseries table selection 15: load data into main_table
after create timeseries datamap ON TABLE 1") {
--- End diff --
this scenario is already covered in the previous tests
---