http://git-wip-us.apache.org/repos/asf/carbondata/blob/14624953/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesRangeFilterTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesRangeFilterTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesRangeFilterTestCase.scala new file mode 100644 index 0000000..4b99dbf --- /dev/null +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesRangeFilterTestCase.scala @@ -0,0 +1,691 @@ + +/* + * 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.common.util._ +import org.scalatest.BeforeAndAfterAll + +/** + * Test Class for QueriesRangeFilterTestCase to verify all scenerios + */ + +class QueriesRangeFilterTestCase extends QueryTest with BeforeAndAfterAll { + + +//Range_Filter_01_1 +test("Range_Filter_01_1", Include) { + sql("drop table if exists NO_DICTIONARY_CARBON_8") + sql("drop table if exists NO_DICTIONARY_CARBON_8_hive") + sql("drop table if exists NO_DICTIONARY_CARBON_6") + sql("drop table if exists NO_DICTIONARY_CARBON_6_hive") + sql("drop table if exists NO_DICTIONARY_CARBON_7") + sql("drop table if exists NO_DICTIONARY_CARBON_7_hive") + sql("drop table if exists DICTIONARY_CARBON_6") + sql("drop table if exists DICTIONARY_CARBON_6_hive") + sql("drop table if exists directDictionaryTable") + sql("drop table if exists directDictionaryTable_hive") + sql("drop table if exists NO_DICTIONARY_CARBON") + sql("drop table if exists NO_DICTIONARY_CARBON_hive") + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON(empno string, doj Timestamp, workgroupcategory Int, empname String,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp, designation String,attendance Int,utilization Int,salary Int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_EXCLUDE'='empno, empname,designation')""").collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_hive(empno string, empname String, designation String,doj Timestamp, workgroupcategory Int,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp,attendance Int,utilization Int,salary Int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON OPTIONS('DELIMITER'= ',', 'QUOTECHAR'='"', 'FILEHEADER'='empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary')""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_hive """).collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_6 (empno string, doj Timestamp, workgroupcategory Int, empname String,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp, designation String,attendance Int,utilization Int,salary Int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_EXCLUDE'='empno, empname,designation')""").collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_6_hive (empno string, empname String, designation String,doj Timestamp, workgroupcategory Int,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp,attendance Int,utilization Int,salary Int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_6 OPTIONS('DELIMITER'= ',', 'QUOTECHAR'='"', 'FILEHEADER'='empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary')""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_6_hive """).collect + + sql(s"""CREATE TABLE DICTIONARY_CARBON_6 (empno string, doj Timestamp, workgroupcategory Int, empname String,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate timestamp,projectenddate Timestamp, designation String,attendance Int,utilization Int,salary Int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_EXCLUDE'='empname,designation')""").collect + + sql(s"""CREATE TABLE DICTIONARY_CARBON_6_hive (empno string, empname String, designation String,doj Timestamp, workgroupcategory Int,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp,attendance Int,utilization Int,salary Int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE DICTIONARY_CARBON_6 OPTIONS('DELIMITER'= ',', 'QUOTECHAR'='"', 'FILEHEADER'='empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary')""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE DICTIONARY_CARBON_6_hive """).collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_7 (empno string, doj Timestamp, workgroupcategory Int, empname String,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp, designation String,attendance Int,utilization Int,salary Int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_EXCLUDE'='empno,empname,designation')""").collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_7_hive (empno string, empname String, designation String,doj Timestamp, workgroupcategory Int,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp,attendance Int,utilization Int,salary Int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_7 OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"' , 'FILEHEADER'='empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary')""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_7_hive """).collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_8 (empno string, doj Timestamp, workgroupcategory Int, empname String,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp, designation String,attendance Int,utilization Int,salary Int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_EXCLUDE'='empno,empname,designation')""").collect + + sql(s"""CREATE TABLE NO_DICTIONARY_CARBON_8_hive (empno string, empname String, designation String,doj Timestamp, workgroupcategory Int,workgroupcategoryname String, deptno Int, deptname String, projectcode Int, projectjoindate Timestamp, projectenddate Timestamp,attendance Int,utilization Int,salary Int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_8 OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"' , 'FILEHEADER'='empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary')""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangefilterdata.csv' INTO TABLE NO_DICTIONARY_CARBON_8_hive """).collect + + sql(s"""CREATE TABLE if not exists directDictionaryTable (empno int,doj Timestamp, salary int) STORED BY 'org.apache.carbondata.format'""").collect + + sql(s"""CREATE TABLE if not exists directDictionaryTable_hive (empno int,doj Timestamp, salary int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangedatasample.csv' INTO TABLE directDictionaryTable OPTIONS ('DELIMITER'= ',', 'QUOTECHAR'= '"','FILEHEADER'='empno,doj,salary')""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/RangeFilter/rangedatasample.csv' INTO TABLE directDictionaryTable_hive """).collect + +} + + +//Range_Filter_01 +test("Range_Filter_01", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' and empno < '15'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' and empno < '15'""", "QueriesRangeFilterTestCase_Range_Filter_01") + +} + + +//Range_Filter_02 +test("Range_Filter_02", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '00' and empno < '09'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '00' and empno < '09'""", "QueriesRangeFilterTestCase_Range_Filter_02") + +} + + +//Range_Filter_03 +test("Range_Filter_03", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '22' and empno < '30'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '22' and empno < '30'""", "QueriesRangeFilterTestCase_Range_Filter_03") + +} + + +//Range_Filter_04 +test("Range_Filter_04", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '00' and empno < '30'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '00' and empno < '30'""", "QueriesRangeFilterTestCase_Range_Filter_04") + +} + + +//Range_Filter_05 +test("Range_Filter_05", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno >= '20' and empno <= '30'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno >= '20' and empno <= '30'""", "QueriesRangeFilterTestCase_Range_Filter_05") + +} + + +//Range_Filter_06 +test("Range_Filter_06", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '20' and empno <= '30'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '20' and empno <= '30'""", "QueriesRangeFilterTestCase_Range_Filter_06") + +} + + +//Range_Filter_07 +test("Range_Filter_07", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno <= '11' and empno > '00'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno <= '11' and empno > '00'""", "QueriesRangeFilterTestCase_Range_Filter_07") + +} + + +//Range_Filter_08 +test("Range_Filter_08", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno < '11' and empno > '00'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno < '11' and empno > '00'""", "QueriesRangeFilterTestCase_Range_Filter_08") + +} + + +//Range_Filter_09 +test("Range_Filter_09", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno < '11' and empno > '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno < '11' and empno > '20'""", "QueriesRangeFilterTestCase_Range_Filter_09") + +} + + +//Range_Filter_10 +test("Range_Filter_10", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno <= '11' and empno > '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno <= '11' and empno > '20'""", "QueriesRangeFilterTestCase_Range_Filter_10") + +} + + +//Range_Filter_11 +test("Range_Filter_11", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno < '11' and empno >= '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno < '11' and empno >= '20'""", "QueriesRangeFilterTestCase_Range_Filter_11") + +} + + +//Range_Filter_12 +test("Range_Filter_12", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno <= '11' and empno >= '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno <= '11' and empno >= '20'""", "QueriesRangeFilterTestCase_Range_Filter_12") + +} + + +//Range_Filter_13 +test("Range_Filter_13", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno <= '11' and empno >= '11'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno <= '11' and empno >= '11'""", "QueriesRangeFilterTestCase_Range_Filter_13") + +} + + +//Range_Filter_14 +test("Range_Filter_14", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno <= '20' and empno >= '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno <= '20' and empno >= '20'""", "QueriesRangeFilterTestCase_Range_Filter_14") + +} + + +//Range_Filter_15 +test("Range_Filter_15", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno <= '15' and empno >= '15'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno <= '15' and empno >= '15'""", "QueriesRangeFilterTestCase_Range_Filter_15") + +} + + +//Range_Filter_16 +test("Range_Filter_16", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' and empno > '11' and empno < '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' and empno > '11' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_16") + +} + + +//Range_Filter_17 +test("Range_Filter_17", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' or empno > '11' and empno < '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' or empno > '11' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_17") + +} + + +//Range_Filter_18 +test("Range_Filter_18", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' or empno > '11' and empno < '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' or empno > '11' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_18") + +} + + +//Range_Filter_19 +test("Range_Filter_19", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' and workgroupcategory = '1' and empno < '20'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' and workgroupcategory = '1' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_19") + +} + + +//Range_Filter_20 +test("Range_Filter_20", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' and empno < '20' and workgroupcategory = '1'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' and empno < '20' and workgroupcategory = '1'""", "QueriesRangeFilterTestCase_Range_Filter_20") + +} + + +//Range_Filter_21 +test("Range_Filter_21", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' and empno < '13' and workgroupcategory = '1' and empno > '14' and empno < '17'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' and empno < '13' and workgroupcategory = '1' and empno > '14' and empno < '17'""", "QueriesRangeFilterTestCase_Range_Filter_21") + +} + + +//Range_Filter_22 +test("Range_Filter_22", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where empno > '11' and empno < '13' and workgroupcategory = '1' or empno > '14' or empno < '17'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where empno > '11' and empno < '13' and workgroupcategory = '1' or empno > '14' or empno < '17'""", "QueriesRangeFilterTestCase_Range_Filter_22") + +} + + +//Range_Filter_23 +test("Range_Filter_23", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and empno < '15'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and empno < '15'""", "QueriesRangeFilterTestCase_Range_Filter_23") + +} + + +//Range_Filter_24 +test("Range_Filter_24", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '00' and empno < '09'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '00' and empno < '09'""", "QueriesRangeFilterTestCase_Range_Filter_24") + +} + + +//Range_Filter_25 +test("Range_Filter_25", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '22' and empno < '30'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '22' and empno < '30'""", "QueriesRangeFilterTestCase_Range_Filter_25") + +} + + +//Range_Filter_26 +test("Range_Filter_26", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '00' and empno < '30'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '00' and empno < '30'""", "QueriesRangeFilterTestCase_Range_Filter_26") + +} + + +//Range_Filter_27 +test("Range_Filter_27", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno < '11' and empno > '20'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno < '11' and empno > '20'""", "QueriesRangeFilterTestCase_Range_Filter_27") + +} + + +//Range_Filter_28 +test("Range_Filter_28", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and empno > '11' and empno < '20'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and empno > '11' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_28") + +} + + +//Range_Filter_29 +test("Range_Filter_29", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' or empno > '11' and empno < '20'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' or empno > '11' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_29") + +} + + +//Range_Filter_30 +test("Range_Filter_30", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' or empno > '11' and empno < '20'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' or empno > '11' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_30") + +} + + +//Range_Filter_31 +test("Range_Filter_31", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and workgroupcategory = '1' and empno < '20'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and workgroupcategory = '1' and empno < '20'""", "QueriesRangeFilterTestCase_Range_Filter_31") + +} + + +//Range_Filter_32 +test("Range_Filter_32", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and empno < '20' and workgroupcategory = '1'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and empno < '20' and workgroupcategory = '1'""", "QueriesRangeFilterTestCase_Range_Filter_32") + +} + + +//Range_Filter_33 +test("Range_Filter_33", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and empno < '13' and workgroupcategory = '1' and empno > '14' and empno < '17'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and empno < '13' and workgroupcategory = '1' and empno > '14' and empno < '17'""", "QueriesRangeFilterTestCase_Range_Filter_33") + +} + + +//Range_Filter_34 +test("Range_Filter_34", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and empno < '13' and workgroupcategory = '1' or empno > '14' or empno < '17'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and empno < '13' and workgroupcategory = '1' or empno > '14' or empno < '17'""", "QueriesRangeFilterTestCase_Range_Filter_34") + +} + + +//Range_Filter_35 +test("Range_Filter_35", Include) { + + checkAnswer(s"""select s.empno, s.empname, t.empno, t.empname from DICTIONARY_CARBON_6 s, NO_DICTIONARY_CARBON_6 t where s.empno > '11' and t.empno < '16' and s.empname = t.empname""", + s"""select s.empno, s.empname, t.empno, t.empname from DICTIONARY_CARBON_6_hive s, NO_DICTIONARY_CARBON_6_hive t where s.empno > '11' and t.empno < '16' and s.empname = t.empname""", "QueriesRangeFilterTestCase_Range_Filter_35") + +} + + +//Range_Filter_36 +test("Range_Filter_36", Include) { + + checkAnswer(s"""select s.empno, s.empname, t.empno, t.empname from DICTIONARY_CARBON_6 s, NO_DICTIONARY_CARBON_6 t where s.empno > '09' and t.empno < '30' and s.empname = t.empname""", + s"""select s.empno, s.empname, t.empno, t.empname from DICTIONARY_CARBON_6_hive s, NO_DICTIONARY_CARBON_6_hive t where s.empno > '09' and t.empno < '30' and s.empname = t.empname""", "QueriesRangeFilterTestCase_Range_Filter_36") + +} + + +//Range_Filter_37 +test("Range_Filter_37", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where workgroupcategory > 1 and workgroupcategory < 5""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where workgroupcategory > 1 and workgroupcategory < 5""", "QueriesRangeFilterTestCase_Range_Filter_37") + +} + + +//Range_Filter_38 +test("Range_Filter_38", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where workgroupcategory > 1 or workgroupcategory < 5""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where workgroupcategory > 1 or workgroupcategory < 5""", "QueriesRangeFilterTestCase_Range_Filter_38") + +} + + +//Range_Filter_39 +test("Range_Filter_39", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where workgroupcategory > 1 or workgroupcategory < 5 and workgroupcategory > 3""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where workgroupcategory > 1 or workgroupcategory < 5 and workgroupcategory > 3""", "QueriesRangeFilterTestCase_Range_Filter_39") + +} + + +//Range_Filter_40 +test("Range_Filter_40", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where workgroupcategory > 1 or workgroupcategory < 5 and workgroupcategory > 3 or workgroupcategory < 10""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where workgroupcategory > 1 or workgroupcategory < 5 and workgroupcategory > 3 or workgroupcategory < 10""", "QueriesRangeFilterTestCase_Range_Filter_40") + +} + + +//Range_Filter_41 +test("Range_Filter_41", Include) { + + sql(s"""select doj from directDictionaryTable where doj > '2016-03-14 15:00:17'""").collect + +} + + +//Range_Filter_42 +test("Range_Filter_42", Include) { + + sql(s"""select doj from directDictionaryTable where doj > '2016-03-14 15:00:16' and doj < '2016-03-14 15:00:18'""").collect + +} + + +//Range_Filter_43 +test("Range_Filter_43", Include) { + + sql(s"""select count(*) from directDictionaryTable where doj > '2016-03-14 15:00:18.0' and doj < '2016-03-14 15:00:09.0'""").collect + +} + + +//Range_Filter_44 +ignore("Range_Filter_44", Include) { + + checkAnswer(s"""select doj from directDictionaryTable where doj > '2016-03-14 15:00:09'""", + s"""select doj from directDictionaryTable_hive where doj > '2016-03-14 15:00:09'""", "QueriesRangeFilterTestCase_Range_Filter_44") + +} + + +//Range_Filter_45 + ignore("Range_Filter_45", Include) { + + checkAnswer(s"""select doj from directDictionaryTable where doj > '2016-03-14 15:00:09' or doj > '2016-03-14 15:00:15'""", + s"""select doj from directDictionaryTable_hive where doj > '2016-03-14 15:00:09' or doj > '2016-03-14 15:00:15'""", "QueriesRangeFilterTestCase_Range_Filter_45") + +} + + +//Range_Filter_46 + ignore("Range_Filter_46", Include) { + + checkAnswer(s"""select doj from directDictionaryTable where doj > '2016-03-14 15:00:09' or doj > '2016-03-14 15:00:15' and doj < '2016-03-14 15:00:13'""", + s"""select doj from directDictionaryTable_hive where doj > '2016-03-14 15:00:09' or doj > '2016-03-14 15:00:15' and doj < '2016-03-14 15:00:13'""", "QueriesRangeFilterTestCase_Range_Filter_46") + +} + + +//Range_Filter_47 +test("Range_Filter_47", Include) { + + checkAnswer(s"""select doj from directDictionaryTable where doj > '2016-03-14 15:05:09' or doj > '2016-03-14 15:05:15' and doj < '2016-03-14 15:50:13'""", + s"""select doj from directDictionaryTable_hive where doj > '2016-03-14 15:05:09' or doj > '2016-03-14 15:05:15' and doj < '2016-03-14 15:50:13'""", "QueriesRangeFilterTestCase_Range_Filter_47") + +} + + +//Range_Filter_48 +test("Range_Filter_48", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 10""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 10""", "QueriesRangeFilterTestCase_Range_Filter_48") + +} + + +//Range_Filter_49 +test("Range_Filter_49", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 10 and deptno < 10""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 10 and deptno < 10""", "QueriesRangeFilterTestCase_Range_Filter_49") + +} + + +//Range_Filter_50 +test("Range_Filter_50", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 10 or deptno < 10""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 10 or deptno < 10""", "QueriesRangeFilterTestCase_Range_Filter_50") + +} + + +//Range_Filter_51 +test("Range_Filter_51", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 10 or deptno < 15 and deptno >12""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 10 or deptno < 15 and deptno >12""", "QueriesRangeFilterTestCase_Range_Filter_51") + +} + + +//Range_Filter_52 +test("Range_Filter_52", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 10 or deptno < 15 and deptno > 12""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 10 or deptno < 15 and deptno > 12""", "QueriesRangeFilterTestCase_Range_Filter_52") + +} + + +//Range_Filter_53 +test("Range_Filter_53", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 14 or deptno < 10 and deptno > 12""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 14 or deptno < 10 and deptno > 12""", "QueriesRangeFilterTestCase_Range_Filter_53") + +} + + +//Range_Filter_54 +test("Range_Filter_54", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 14 and deptno < 14""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 14 and deptno < 14""", "QueriesRangeFilterTestCase_Range_Filter_54") + +} + + +//Range_Filter_55 +test("Range_Filter_55", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno > 14 or deptno < 14""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6_hive where deptno > 14 or deptno < 14""", "QueriesRangeFilterTestCase_Range_Filter_55") + +} + + +//Range_Filter_56 +test("Range_Filter_56", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and empno < '15'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and empno < '15'""", "QueriesRangeFilterTestCase_Range_Filter_56") + +} + + +//Range_Filter_57 +test("Range_Filter_57", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' or empno > '15'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' or empno > '15'""", "QueriesRangeFilterTestCase_Range_Filter_57") + +} + + +//Range_Filter_58 +test("Range_Filter_58", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' or empno > '20' and empno < '18'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' or empno > '20' and empno < '18'""", "QueriesRangeFilterTestCase_Range_Filter_58") + +} + + +//Range_Filter_59 +test("Range_Filter_59", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno < '11' or empno > '20'""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno < '11' or empno > '20'""", "QueriesRangeFilterTestCase_Range_Filter_59") + +} + + +//Range_Filter_60 +test("Range_Filter_60", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' and workgroupcategory > 2""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' and workgroupcategory > 2""", "QueriesRangeFilterTestCase_Range_Filter_60") + +} + + +//Range_Filter_61 +test("Range_Filter_61", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6 where empno > '11' or workgroupcategory > 2""", + s"""select empno,empname,workgroupcategory from DICTIONARY_CARBON_6_hive where empno > '11' or workgroupcategory > 2""", "QueriesRangeFilterTestCase_Range_Filter_61") + +} + + +//Range_Filter_62 +test("Range_Filter_62", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8 where empno > '13' and workgroupcategory < 3""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8_hive where empno > '13' and workgroupcategory < 3""", "QueriesRangeFilterTestCase_Range_Filter_62") + +} + + +//Range_Filter_63 +test("Range_Filter_63", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8 where empno > '13' and workgroupcategory < 3 and deptno > 12 and empno < '17'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8_hive where empno > '13' and workgroupcategory < 3 and deptno > 12 and empno < '17'""", "QueriesRangeFilterTestCase_Range_Filter_63") + +} + + +//Range_Filter_64 +test("Range_Filter_64", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8 where empno > '13' or workgroupcategory < 3 and deptno > 12 and projectcode > 928478 and empno > '17'""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8_hive where empno > '13' or workgroupcategory < 3 and deptno > 12 and projectcode > 928478 and empno > '17'""", "QueriesRangeFilterTestCase_Range_Filter_64") + +} + + +//Range_Filter_65 +test("Range_Filter_65", Include) { + + checkAnswer(s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8 where empno > '13' and empno < '17' and workgroupcategory < 1 and deptno > 14""", + s"""select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_8_hive where empno > '13' and empno < '17' and workgroupcategory < 1 and deptno > 14""", "QueriesRangeFilterTestCase_Range_Filter_65") +} + + override def afterAll { + sql("drop table if exists NO_DICTIONARY_CARBON_8") + sql("drop table if exists NO_DICTIONARY_CARBON_8_hive") + sql("drop table if exists NO_DICTIONARY_CARBON_6") + sql("drop table if exists NO_DICTIONARY_CARBON_6_hive") + sql("drop table if exists NO_DICTIONARY_CARBON_7") + sql("drop table if exists NO_DICTIONARY_CARBON_7_hive") + sql("drop table if exists DICTIONARY_CARBON_6") + sql("drop table if exists DICTIONARY_CARBON_6_hive") + sql("drop table if exists directDictionaryTable") + sql("drop table if exists directDictionaryTable_hive") + sql("drop table if exists NO_DICTIONARY_CARBON") + sql("drop table if exists NO_DICTIONARY_CARBON_hive") + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/carbondata/blob/14624953/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesSparkBlockDistTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesSparkBlockDistTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesSparkBlockDistTestCase.scala new file mode 100644 index 0000000..6270ee5 --- /dev/null +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/QueriesSparkBlockDistTestCase.scala @@ -0,0 +1,281 @@ + +/* + * 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.common.util._ +import org.scalatest.BeforeAndAfterAll + +/** + * Test Class for QueriesSparkBlockDistTestCase to verify all scenerios + */ + +class QueriesSparkBlockDistTestCase extends QueryTest with BeforeAndAfterAll { + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC002123 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC002123", Include) { + sql("drop table if exists flow_carbon_256b") + sql("drop table if exists flow_carbon_256b_hive") + sql(s"""CREATE TABLE IF NOT EXISTS flow_carbon_256b ( txn_dte String, dt String, txn_bk String, txn_br String, own_bk String, own_br String, opp_bk String, bus_opr_cde String, opt_prd_cde String, cus_no String, cus_ac String, opp_ac_nme String, opp_ac String, bv_no String, aco_ac String, ac_dte String, txn_cnt int, jrn_par int, mfm_jrn_no String, cbn_jrn_no String, ibs_jrn_no String, vch_no String, vch_seq String, srv_cde String, bus_cd_no String, id_flg String, bv_cde String, txn_time String, txn_tlr String, ety_tlr String, ety_bk String, ety_br String, bus_pss_no String, chk_flg String, chk_tlr String, chk_jrn_no String, bus_sys_no String, txn_sub_cde String, fin_bus_cde String, fin_bus_sub_cde String, chl String, tml_id String, sus_no String, sus_seq String, cho_seq String, itm_itm String, itm_sub String, itm_sss String, dc_flg String, amt decimal(15,2), bal decimal(15,2), ccy String, spv_flg String, vch_vld_dte String, pst_bk String, pst_br String, ec_flg String, aco_tlr String, gen_flg String, his_rec_sum_flg String, his_flg String, vch_typ String, val_dte String, opp_ac_flg String, cmb_flg String, ass_vch_flg String, cus_pps_flg String, bus_rmk_cde String, vch_bus_rmk String, tec_rmk_cde String, vch_tec_rmk String, rsv_ara String, gems_last_upd_d String, gems_last_upd_d_bat String, maps_date String, maps_job String ) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_INCLUDE'='dt,jrn_par,txn_bk,txn_br,ety_bk,ety_br,chk_flg,bus_sys_no,bus_opr_cde,chl,sus_no,itm_itm,itm_sub,itm_sss,dc_flg,ccy,spv_flg,pst_bk,pst_br,ec_flg,gen_flg,his_rec_sum_flg,his_flg,vch_typ,opp_ac_flg,cmb_flg,ass_vch_flg,cus_pps_flg,bus_rmk_cde,vch_bus_rmk,tec_rmk_cde,vch_t ec_rmk,rsv_ara,own_br,own_bk','DICTIONARY_EXCLUDE'='aco_ac,ac_dte,mfm_jrn_no,cbn_jrn_no,ibs_jrn_no,vch_no,vch_seq,srv_cde,cus_no,bus_cd_no,id_flg,cus_ac,bv_cde,bv_no,txn_dte,txn_time,txn_tlr,ety_tlr,bus_pss_no,chk_tlr,chk_jrn_no,txn_sub_cde,fin_bus_cde,fin_bus_sub_cde,opt_prd_cde,tml_id,sus_seq,cho_seq,vch_vld_dte,aco_tlr,opp_ac,opp_ac_nme,opp_bk,val_dte,gems_last_upd_d,gems_last_upd_d_bat,maps_date,maps_job')""").collect + + sql(s"""CREATE TABLE IF NOT EXISTS flow_carbon_256b_hive ( txn_dte String, dt String, txn_bk String, txn_br String, own_bk String, own_br String, opp_bk String, bus_opr_cde String, opt_prd_cde String, cus_no String, cus_ac String, opp_ac_nme String, opp_ac String, bv_no String, aco_ac String, ac_dte String, txn_cnt int, jrn_par int, mfm_jrn_no String, cbn_jrn_no String, ibs_jrn_no String, vch_no String, vch_seq String, srv_cde String, bus_cd_no String, id_flg String, bv_cde String, txn_time String, txn_tlr String, ety_tlr String, ety_bk String, ety_br String, bus_pss_no String, chk_flg String, chk_tlr String, chk_jrn_no String, bus_sys_no String, txn_sub_cde String, fin_bus_cde String, fin_bus_sub_cde String, chl String, tml_id String, sus_no String, sus_seq String, cho_seq String, itm _itm String, itm_sub String, itm_sss String, dc_flg String, amt decimal(15,2), bal decimal(15,2), ccy String, spv_flg String, vch_vld_dte String, pst_bk String, pst_br String, ec_flg String, aco_tlr String, gen_flg String, his_rec_sum_flg String, his_flg String, vch_typ String, val_dte String, opp_ac_flg String, cmb_flg String, ass_vch_flg String, cus_pps_flg String, bus_rmk_cde String, vch_bus_rmk String, tec_rmk_cde String, vch_tec_rmk String, rsv_ara String, gems_last_upd_d String, gems_last_upd_d_bat String, maps_date String, maps_job String ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','""").collect + + sql(s"""LOAD DATA inpath '$resourcesPath/Data/cmb/data.csv' into table flow_carbon_256b options('BAD_RECORDS_ACTION'='FORCE','DELIMITER'=',', 'QUOTECHAR'='"','FILEHEADER'='txn_dte,dt,txn_bk,txn_br,own_bk,own_br,opp_bk,bus_opr_cde,opt_prd_cde,cus_no,cus_ac,opp_ac_nme,opp_ac,bv_no,aco_ac,ac_dte,txn_cnt,jrn_par,mfm_jrn_no,cbn_jrn_no,ibs_jrn_no,vch_no,vch_seq,srv_cde,bus_cd_no,id_flg,bv_cde,txn_time,txn_tlr,ety_tlr,ety_bk,ety_br,bus_pss_no,chk_flg,chk_tlr,chk_jrn_no,bus_sys_no,txn_sub_cde,fin_bus_cde,fin_bus_sub_cde,chl,tml_id,sus_no,sus_seq,cho_seq,itm_itm,itm_sub,itm_sss,dc_flg,amt,bal,ccy,spv_flg,vch_vld_dte,pst_bk,pst_br,ec_flg,aco_tlr,gen_flg,his_rec_sum_flg,his_flg,vch_typ,val_dte,opp_ac_flg,cmb_flg,ass_vch_flg,cus_pps_flg,bus_rmk_cde,vch_bus_rmk,tec_rmk_cde,vch_tec_rmk,rsv_ara,gems_last_upd_d,gems_last_upd_d_bat,maps_date,maps_job')""").collect + sql(s"""LOAD DATA inpath '$resourcesPath/Data/cmb/data.csv' into table flow_carbon_256b_hive""").collect + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC001", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where txn_dte>='20140101' and txn_dte <= '20140601' and txn_bk ='00000000121' order by txn_dte limit 1000""", + s"""select * from flow_carbon_256b_hive where txn_dte>='20140101' and txn_dte <= '20140601' and txn_bk ='00000000121' order by txn_dte limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC002 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC002", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where own_br ='00000000515' and txn_dte>='20140101' and txn_dte <= '20150101' order by own_br limit 1000""", + s"""select * from flow_carbon_256b_hive where own_br ='00000000515' and txn_dte>='20140101' and txn_dte <= '20150101' order by own_br limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC002") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC003", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where opt_prd_cde ='2889' and txn_dte>='20140101' and txn_dte <= '20160101' order by opt_prd_cde limit 1000""", + s"""select * from flow_carbon_256b_hive where opt_prd_cde ='2889' and txn_dte>='20140101' and txn_dte <= '20160101' order by opt_prd_cde limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS001_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS002_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS002_TC001", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where cus_ac like '%22262135060488208%' and (txn_dte>='20150101' and txn_dte<='20160101') and txn_bk IN ('00000000215', '00000000025','00000000086') OR own_bk IN ('00000000001','01511999999','00000000180') order by cus_ac limit 1000""", + s"""select * from flow_carbon_256b_hive where cus_ac like '%22262135060488208%' and (txn_dte>='20150101' and txn_dte<='20160101') and txn_bk IN ('00000000215', '00000000025','00000000086') OR own_bk IN ('00000000001','01511999999','00000000180') order by cus_ac limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS002_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC001", Include) { + + checkAnswer(s"""select own_br, count(opt_prd_cde) from flow_carbon_256b group by own_br limit 1000""", + s"""select own_br, count(opt_prd_cde) from flow_carbon_256b_hive group by own_br limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC002 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC002", Include) { + + checkAnswer(s"""select own_br, count(distinct opt_prd_cde) from flow_carbon_256b where own_br like '6%' group by own_br limit 1000""", + s"""select own_br, count(distinct opt_prd_cde) from flow_carbon_256b_hive where own_br like '6%' group by own_br limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC002") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC003", Include) { + + checkAnswer(s"""select own_br, count(distinct opt_prd_cde) from flow_carbon_256b group by own_br limit 1000""", + s"""select own_br, count(distinct opt_prd_cde) from flow_carbon_256b_hive group by own_br limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC004 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC004", Include) { + + checkAnswer(s"""select own_br, count(1) as cn from flow_carbon_256b group by own_br having cn>1""", + s"""select own_br, count(1) as cn from flow_carbon_256b_hive group by own_br having cn>1""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS003_TC004") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC001", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where cus_ac like '622262135067246539%' and (txn_dte>='20150101' and txn_dte<='20160101') and txn_bk IN ('00000000000', '00000000001','00000000002') OR own_bk IN ('00000000424','00000001383','00000001942','00000001262') limit 1000""", + s"""select * from flow_carbon_256b_hive where cus_ac like '622262135067246539%' and (txn_dte>='20150101' and txn_dte<='20160101') and txn_bk IN ('00000000000', '00000000001','00000000002') OR own_bk IN ('00000000424','00000001383','00000001942','00000001262') limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC002 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC002", Include) { + + checkAnswer(s"""select own_br, sum(txn_cnt) as cn from flow_carbon_256b group by own_br having cn>1 limit 1000""", + s"""select own_br, sum(txn_cnt) as cn from flow_carbon_256b_hive group by own_br having cn>1 limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC002") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC003", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where cus_ac = '6222621350672465397' and txn_bk IN ('00000000000', '00000000001','00000000002') OR own_bk IN ('00000000124','00000000175','00000000034','00000000231','00000000167','00000000182','00000000206') or opp_bk='1491999999107' and (txn_dte>='20140101' and txn_dte<='20140630') limit 1000""", + s"""select * from flow_carbon_256b_hive where cus_ac = '6222621350672465397' and txn_bk IN ('00000000000', '00000000001','00000000002') OR own_bk IN ('00000000124','00000000175','00000000034','00000000231','00000000167','00000000182','00000000206') or opp_bk='1491999999107' and (txn_dte>='20140101' and txn_dte<='20140630') limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS004_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS005_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS005_TC001", Include) { + + checkAnswer(s"""select vch_seq, sum(amt) from flow_carbon_256b group by vch_seq limit 1000""", + s"""select vch_seq, sum(amt) from flow_carbon_256b_hive group by vch_seq limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS005_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS005_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS005_TC003", Include) { + + checkAnswer(s"""select vch_seq, count(distinct cus_ac) * sum(amt) AS Total from flow_carbon_256b group by vch_seq limit 1000""", + s"""select vch_seq, count(distinct cus_ac) * sum(amt) AS Total from flow_carbon_256b_hive group by vch_seq limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS005_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS006_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS006_TC001", Include) { + + checkAnswer(s"""select vch_seq, COALESCE(txn_cnt, jrn_par) Value from flow_carbon_256b group by vch_seq,txn_cnt,jrn_par limit 1000""", + s"""select vch_seq, COALESCE(txn_cnt, jrn_par) Value from flow_carbon_256b_hive group by vch_seq,txn_cnt,jrn_par limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS006_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC001", Include) { + + checkAnswer(s"""select * from flow_carbon_256b where cus_no = '62226009239386397' and dt>='20140301' and dt<='20140330' order by amt desc limit 1000""", + s"""select * from flow_carbon_256b_hive where cus_no = '62226009239386397' and dt>='20140301' and dt<='20140330' order by amt desc limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC002 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC002", Include) { + + checkAnswer(s"""select cus_ac from flow_carbon_256b where jrn_par is not null order by cus_ac limit 1000""", + s"""select cus_ac from flow_carbon_256b_hive where jrn_par is not null order by cus_ac limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC002") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC003", Include) { + + checkAnswer(s"""select cus_ac from flow_carbon_256b where jrn_par is null order by cus_ac limit 1000""", + s"""select cus_ac from flow_carbon_256b_hive where jrn_par is null order by cus_ac limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS007_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC001", Include) { + + checkAnswer(s"""select txn_bk, MAX(distinct cus_ac) from flow_carbon_256b group by txn_bk, cus_ac""", + s"""select txn_bk, MAX(distinct cus_ac) from flow_carbon_256b_hive group by txn_bk, cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC002 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC002", Include) { + + checkAnswer(s"""select txn_bk, count(distinct cus_ac) from flow_carbon_256b group by txn_bk, cus_ac""", + s"""select txn_bk, count(distinct cus_ac) from flow_carbon_256b_hive group by txn_bk, cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC002") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC003", Include) { + + checkAnswer(s"""select distinct(txn_bk) AS TXN_BK, avg(cus_ac) from flow_carbon_256b group by txn_bk,cus_ac""", + s"""select distinct(txn_bk) AS TXN_BK, avg(cus_ac) from flow_carbon_256b_hive group by txn_bk,cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC004 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC004", Include) { + + checkAnswer(s"""select txn_bk, LAST(cus_ac) from flow_carbon_256b group by txn_bk,cus_ac""", + s"""select txn_bk, LAST(cus_ac) from flow_carbon_256b_hive group by txn_bk,cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC004") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC005 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC005", Include) { + + checkAnswer(s"""select txn_bk, FIRST(cus_ac) from flow_carbon_256b group by txn_bk,cus_ac""", + s"""select txn_bk, FIRST(cus_ac) from flow_carbon_256b_hive group by txn_bk,cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS008_TC005") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC001", Include) { + + checkAnswer(s"""select txn_bk, percentile_approx(cast(txn_cnt as double) ,0.2) from flow_carbon_256b group by txn_bk,cus_ac""", + s"""select txn_bk, percentile_approx(cast(txn_cnt as double) ,0.2) from flow_carbon_256b_hive group by txn_bk,cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC001") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC002 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC002", Include) { + + checkAnswer(s"""select txn_bk, collect_set(cus_ac) from flow_carbon_256b group by txn_bk,cus_ac""", + s"""select txn_bk, collect_set(cus_ac) from flow_carbon_256b_hive group by txn_bk,cus_ac""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC002") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC003 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC003", Include) { + + checkAnswer(s"""select txn_bk, variance(cus_ac) from flow_carbon_256b group by txn_bk,cus_ac limit 1000""", + s"""select txn_bk, variance(cus_ac) from flow_carbon_256b_hive group by txn_bk,cus_ac limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS009_TC003") + + } + + + //AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS010_TC001 + test("AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS010_TC001", Include) { + + checkAnswer(s"""select txn_bk, (txn_cnt + jrn_par) AS Result from flow_carbon_256b group by txn_bk,txn_cnt,jrn_par limit 1000""", + s"""select txn_bk, (txn_cnt + jrn_par) AS Result from flow_carbon_256b_hive group by txn_bk,txn_cnt,jrn_par limit 1000""", "QueriesSparkBlockDistTestCase_AR-Productize-New-Features-Huawei-Spark2.1-014_001_PTS010_TC001") + } + + override def afterAll { + sql("drop table if exists flow_carbon_256b") + sql("drop table if exists flow_carbon_256b_hive") + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/carbondata/blob/14624953/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/ShowLoadsTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/ShowLoadsTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/ShowLoadsTestCase.scala new file mode 100644 index 0000000..4a4db89 --- /dev/null +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/ShowLoadsTestCase.scala @@ -0,0 +1,63 @@ + +/* + * 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._ +import org.scalatest.BeforeAndAfterAll + +/** + * Test Class for ShowLoadsTestCase to verify all scenerios + */ + +class ShowLoadsTestCase extends QueryTest with BeforeAndAfterAll { + + + //Verify failure/success/Partial status in show segments. + test("AR-DataSightCarbon-Maintenance-DataLoadManagement001_TOR_001-PTS-005-TC-01_196", Include) { + sql( + s"""drop TABLE if exists ShowSegment_196""".stripMargin).collect + sql(s"""CREATE TABLE ShowSegment_196 (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string,DOB timestamp, DOJ timestamp, BIGINT_COLUMN1 bigint,BIGINT_COLUMN2 bigint,DECIMAL_COLUMN1 decimal(30,10),Double_COLUMN1 double,DECIMAL_COLUMN2 decimal(36,10), Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('table_blocksize'='1')""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/InsertData/join1.csv' into table ShowSegment_196 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,Double_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/InsertData/join1.csv' into table ShowSegment_196 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,Double_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""show segments for table ShowSegment_196""").collect() + sql(s"""drop table ShowSegment_196""").collect + } + + + //Verify show segment commands with database name. + test("AR-DataSightCarbon-Maintenance-DataLoadManagement001_TOR_001-PTS-002-TC-01_196", Include) { + sql(s"""drop TABLE if exists Database_ShowSegment_196""").collect + sql(s"""CREATE TABLE Database_ShowSegment_196 (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string,DOB timestamp, DOJ timestamp, BIGINT_COLUMN1 bigint,BIGINT_COLUMN2 bigint,DECIMAL_COLUMN1 decimal(30,10),Double_COLUMN1 double,DECIMAL_COLUMN2 decimal(36,10), Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('table_blocksize'='1')""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/InsertData/join1.csv' into table Database_ShowSegment_196 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,Double_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""show segments for table default.Database_ShowSegment_196""").collect() + sql(s"""drop table Database_ShowSegment_196""").collect + } + + + //Show Segments failing if table name not in same case + test("PTS-TOR_AR-DataSight_Carbon-LCM_002_001-001-TC-008_830", Include) { + sql(s"""drop TABLE if exists Case_ShowSegment_196""").collect + sql(s"""CREATE TABLE Case_ShowSegment_196 (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string,DOB timestamp, DOJ timestamp, BIGINT_COLUMN1 bigint,BIGINT_COLUMN2 bigint,DECIMAL_COLUMN1 decimal(30,10),Double_COLUMN1 double,DECIMAL_COLUMN2 decimal(36,10), Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('table_blocksize'='1')""").collect + sql(s"""show segments for table CASE_ShowSegment_196""").collect + + sql(s"""drop table Case_ShowSegment_196""").collect + } + +} \ No newline at end of file
