You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by kunal642 <gi...@git.apache.org> on 2018/03/15 09:14:34 UTC

[GitHub] carbondata pull request #1981: [Pre-Agg Test] Added SDV TestCase of preaggre...

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

    https://github.com/apache/carbondata/pull/1981#discussion_r174716702
  
    --- Diff: integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PreAggregateTestCase.scala ---
    @@ -0,0 +1,312 @@
    +
    +/*
    + * 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.cluster.sdv.generated
    +
    +import org.apache.spark.sql.Row
    +import org.apache.spark.sql.common.util.{Include, QueryTest}
    +import org.junit.Assert
    +import org.scalatest.BeforeAndAfterEach
    +import org.scalatest.Matchers._
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +
    +
    +class PreAggregateTestCase extends QueryTest with BeforeAndAfterEach {
    +  val csvPath = s"$resourcesPath/source.csv"
    +
    +  override def beforeEach: Unit = {
    +    sql("drop table if exists PreAggMain")
    +    sql("drop table if exists AggMain")
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_DATE_FORMAT, "yyyy/MM/dd")
    +    sql("CREATE TABLE PreAggMain (id Int, date date, country string, phonetype string, " +
    +        "serialname String,salary int ) STORED BY 'org.apache.carbondata.format' " +
    +        "tblproperties('dictionary_include'='country')")
    +    sql("CREATE TABLE AggMain (id Int, date date, country string, phonetype string, " +
    +        "serialname String,salary int ) STORED BY 'org.apache.carbondata.format'" +
    +        "tblproperties('dictionary_include'='country')")
    +    sql("create datamap PreAggSum on table PreAggMain using 'preaggregate' as " +
    +        "select country,sum(salary) as sum from PreAggMain group by country")
    +    sql("create datamap PreAggAvg on table PreAggMain using 'preaggregate' as " +
    +        "select country,avg(salary) as avg from PreAggMain group by country")
    +    sql("create datamap PreAggCount on table PreAggMain using 'preaggregate' as " +
    +        "select country,count(salary) as count from PreAggMain group by country")
    +    sql("create datamap PreAggMin on table PreAggMain using 'preaggregate' as " +
    +        "select country,min(salary) as min from PreAggMain group by country")
    +    sql("create datamap PreAggMax on table PreAggMain using 'preaggregate' as " +
    +        "select country,max(salary) as max from PreAggMain group by country")
    +  }
    +
    +  //test to check the table and datamap creation
    +  test("PreAggregateTestCase_TC001", Include) {
    +    checkExistence(sql("Describe formatted PreAggMain"), true)
    --- End diff --
    
    add some criteria to checkExistence on


---