Github user kunal642 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2175#discussion_r186616874
--- Diff:
integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PartitionWithPreAggregateTestCase.scala
---
@@ -0,0 +1,129 @@
+/*
+ * 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.carbondata.core.constants.CarbonCommonConstants
+import org.apache.carbondata.core.util.CarbonProperties
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.common.util._
+import org.scalatest.BeforeAndAfterAll
+/**
+ * Test Class for Support of Partition with PreAggregate table
+ */
+class PartitionWithPreAggregateTestCase extends QueryTest with
BeforeAndAfterAll {
+ override def beforeAll = {
+CarbonProperties.getInstance()
+ .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
"/MM/dd HH:mm:ss")
+ .addProperty(CarbonCommonConstants.CARBON_DATE_FORMAT, "/MM/dd")
+ }
+ //Loading data into partitioned table with SORT_SCOPE=LOCAL_SORT
+ test("Partition-With-PreAggregate_TC001", Include) {
+sql(s"""drop table if exists partition_table""")
+sql(s"""CREATE TABLE partition_table(shortField SHORT, intField INT,
bigintField LONG, doubleField DOUBLE, timestamp TIMESTAMP, decimalField
DECIMAL(18,2),dateField DATE, charField CHAR(5), floatField FLOAT ) PARTITIONED
BY (stringField STRING) STORED BY 'carbondata'
TBLPROPERTIES('SORT_SCOPE'='LOCAL_SORT')""")
+sql(s"""load data inpath
'$resourcesPath/Data/partition/list_partition_table.csv' into table
partition_table""")
+sql("create datamap ag1 on table partition_table using 'preaggregate'
as select shortField, sum(intField) from partition_table group by shortField")
+checkAnswer(sql(s"""select count(*) from partition_table"""),
Seq(Row(10)))
+ }
+ //Loading data into partitioned table with SORT_SCOPE=GLOBAL_SORT
+ test("Partition-With-PreAggregate_TC002", Include) {
+sql(s"""drop table if exists partition_table""")
+sql(s"""CREATE TABLE partition_table(shortField SHORT, intField INT,
bigintField LONG, doubleField DOUBLE, timestamp TIMESTAMP, decimalField
DECIMAL(18,2),dateField DATE, charField CHAR(5), floatField FLOAT ) PARTITIONED
BY (stringField STRING) STORED BY 'carbondata'
TBLPROPERTIES('SORT_SCOPE'='GLOBAL_SORT')""")
+sql(s"""load data inpath
'$resourcesPath/Data/partition/list_partition_table.csv' into table
partition_table""")
+sql("create datamap ag1 on table partition_table using 'preaggregate'
as select shortField, sum(intField) from partition_table group by shortField")
+checkAnswer(sql(s"""select count(*) from partition_table"""),
Seq(Row(10)))
+ }
+ //Loading data into partitioned table with SORT_SCOPE=BATCH_SORT
+ test("Partition-With-PreAggregate_TC003", Include) {
+sql(s"""drop table if exists partition_table""")
+sql(s"""CREATE TABLE partition_table(shortField SHORT, intField INT,
bigintField LONG, doubleField DOUBLE, timestamp TIMESTAMP, decimalField
DECIMAL(18,2),dateField DATE, charField CHAR(5), floatField FLOAT ) PARTITIONED
BY (stringField STRING) STORED BY 'carbondata'
TBLPROPERTIES('SORT_SCOPE'='BATCH_SORT')""")
+sql(s"""load data inpath
'$resourcesPath/Data/partition/list_partition_table.csv' into table
partition_table""")
+sql("create datamap ag1 on table partition_table using 'preaggregate'
as select shortField, sum(intField) from partition_table group by shortField")
+checkAnswer(sql(s"""select count(*) from partition_table"""),
Seq(Row(10)))
+ }
+ //Loading data into partitioned table with SORT_SCOPE=NO_SORT
+ test("Partition-With-PreAggregate_TC004", Include) {
+sql(s"""drop table if exists partition_table""")
+sql(s"""CREATE TABLE partition_table(shortField SHORT, intField INT,
bigintField LONG, doubleField DOUBLE, timestamp TIMESTAMP, decimalField
DECIMAL(18,2),dateField