jackylk commented on a change in pull request #3495: [CARBONDATA-3532] Support Query Rollup for MV TimeSeries Queries
URL: https://github.com/apache/carbondata/pull/3495#discussion_r372785035 ########## File path: datamap/mv/core/src/test/scala/org/apache/carbondata/mv/timeseries/TestMVTimeSeriesQueryRollUp.scala ########## @@ -0,0 +1,259 @@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.apache.carbondata.mv.timeseries + + import org.apache.spark.sql.test.util.QueryTest + import org.scalatest.BeforeAndAfterAll + + import org.apache.carbondata.mv.rewrite.TestUtil + + class TestMVTimeSeriesQueryRollUp extends QueryTest with BeforeAndAfterAll { + + override def beforeAll(): Unit = { + drop() + createTable() + loadData("maintable") + } + + override def afterAll(): Unit = { + drop() + } + + test("test timeseries query rollup with simple projection") { + val result = sql("select timeseries(projectjoindate,'day'),projectcode from maintable") + sql("drop datamap if exists datamap1") + sql("drop datamap if exists datamap2") + sql( + "create datamap datamap1 on table maintable using 'mv' as " + + "select timeseries(projectjoindate,'second'),projectcode from maintable") + sql( + "create datamap datamap2 on table maintable using 'mv' as " + + "select timeseries(projectjoindate,'hour'),projectcode from maintable") + val df = sql("select timeseries(projectjoindate,'day'),projectcode from maintable") + assert(TestUtil.verifyMVDataMap(df.queryExecution.optimizedPlan, "datamap2")) + checkAnswer(result,df) + sql("drop datamap if exists datamap1") + sql("drop datamap if exists datamap2") + } + + test("test timeseries query rollup with simple projection with group by - scenario-1") { + val result = sql("select timeseries(projectjoindate,'day'),projectcode from maintable group by timeseries(projectjoindate,'day'),projectcode") + sql("drop datamap if exists datamap1") + sql("drop datamap if exists datamap2") + sql( + "create datamap datamap1 on table maintable using 'mv' as " + + "select timeseries(projectjoindate,'second'),projectcode from maintable group by timeseries(projectjoindate,'second'),projectcode") + sql( + "create datamap datamap2 on table maintable using 'mv' as " + + "select timeseries(projectjoindate,'hour'),projectcode from maintable group by timeseries(projectjoindate,'hour'),projectcode") + val df = sql("select timeseries(projectjoindate,'day'),projectcode from maintable group by timeseries(projectjoindate,'day'),projectcode") + assert(TestUtil.verifyMVDataMap(df.queryExecution.optimizedPlan, "datamap2")) Review comment: please check `"select timeseries(projectjoindate,'second'),projectcode from maintable group by timeseries(projectjoindate,'second'),projectcode"` also ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [hidden email] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |