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/OffheapQuery1TestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapQuery1TestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapQuery1TestCase.scala new file mode 100644 index 0000000..9bd4f1f --- /dev/null +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapQuery1TestCase.scala @@ -0,0 +1,1275 @@ + +/* + * 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 + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties + +/** + * Test Class for OffheapQuery1TestCase to verify all scenerios + */ + +class OffheapQuery1TestCase extends QueryTest with BeforeAndAfterAll { + + +//To check select query with limit +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_001", Include) { + sql(s"""CREATE TABLE uniqdataquery1 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdataquery1 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""select * from uniqdataquery1 limit 100""").collect + + +} + + +//To check select query with limit as string +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_002", Include) { + try { + + sql(s"""select * from uniqdataquery1 limit """"").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check select query with no input given at limit +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_003", Include) { + + sql(s"""select * from uniqdataquery1 limit""").collect + + +} + + +//To check select count query with where and group by clause +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_004", Include) { + + sql(s"""select count(*) from uniqdataquery1 where cust_name="CUST_NAME_00000" group by cust_name""").collect + + +} + + +//To check select count query and group by cust_name using like operator +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_005", Include) { + + sql(s"""select count(*) from uniqdataquery1 where cust_name like "cust_name_0%" group by cust_name""").collect + + +} + + +//To check select count query and group by name using IN operator with empty values +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_006", Include) { + + sql(s"""select count(*) from uniqdataquery1 where cust_name IN("","") group by cust_name""").collect + + +} + + +//To check select count query and group by name using IN operator with specific values +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_007", Include) { + + sql(s"""select count(*) from uniqdataquery1 where cust_name IN(1,2,3) group by cust_name""").collect + + +} + + +//To check select distinct query +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_008", Include) { + + sql(s"""select distinct cust_name from uniqdataquery1 group by cust_name""").collect + + +} + + +//To check where clause with OR and no operand +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_009", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id > 1 OR """).collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check OR clause with LHS and RHS having no arguments +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_010", Include) { + try { + + sql(s"""select * from uniqdataquery1 where OR """).collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check OR clause with LHS having no arguments +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_011", Include) { + try { + + sql(s"""select * from uniqdataquery1 where OR cust_id > "1"""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check incorrect query +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_013", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id > 0 OR name """).collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check select query with rhs false +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_014", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id > 9005 OR false""").collect + + +} + + +//To check count on multiple arguments +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_015", Include) { + + sql(s"""select count(cust_id,cust_name) from uniqdataquery1 where cust_id > 10544""").collect + + +} + + +//To check count with no argument +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_016", Include) { + + sql(s"""select count() from uniqdataquery1 where cust_id > 10544""").collect + + +} + + +//To check count with * as an argument +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_017", Include) { + + sql(s"""select count(*) from uniqdataquery1 where cust_id>10544""").collect + + +} + + +//To check select count query execution with entire column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_018", Include) { + + sql(s"""select count(*) from uniqdataquery1""").collect + + +} + + +//To check select distinct query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_019", Include) { + + sql(s"""select distinct * from uniqdataquery1""").collect + + +} + + +//To check select multiple column query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_020", Include) { + + sql(s"""select cust_name,cust_id,count(cust_name) from uniqdataquery1 group by cust_name,cust_id""").collect + + +} + + +//To check select count and distinct query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_021", Include) { + try { + + sql(s"""select count(cust_id),distinct(cust_name) from uniqdataquery1""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check sum query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_022", Include) { + + sql(s"""select sum(cust_id) as sum,cust_name from uniqdataquery1 group by cust_name""").collect + + +} + + +//To check sum of names query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_023", Include) { + + sql(s"""select sum(cust_name) from uniqdataquery1""").collect + + +} + + +//To check select distinct and groupby query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_024", Include) { + + sql(s"""select distinct(cust_name,cust_id) from uniqdataquery1 group by cust_name,cust_id""").collect + + +} + + +//To check select with where clause on cust_name query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_025", Include) { + + sql(s"""select cust_id from uniqdataquery1 where cust_name="cust_name_00000"""").collect + + +} + + +//To check query execution with IN operator without paranthesis +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_027", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id IN 9000,9005""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check query execution with IN operator with paranthesis +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_028", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id IN (9000,9005)""").collect + + +} + + +//To check query execution with IN operator with out specifying any field. +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_029", Include) { + try { + + sql(s"""select * from uniqdataquery1 where IN(1,2)""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check OR with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_030", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id>9005 or cust_id=9005""").collect + + +} + + +//To check OR with boolean expression +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_031", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id>9005 or false""").collect + + +} + + +//To check AND with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_032", Include) { + + sql(s"""select * from uniqdataquery1 where true AND true""").collect + + +} + + +//To check AND with using booleans +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_033", Include) { + + sql(s"""select * from uniqdataquery1 where true AND false""").collect + + +} + + +//To check AND with using booleans in invalid syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_034", Include) { + try { + + sql(s"""select * from uniqdataquery1 where AND true""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check AND Passing two conditions on same input +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_035", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id=6 and cust_id>5""").collect + + +} + + +//To check AND changing case +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_036", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id=6 aND cust_id>5""").collect + + +} + + +//To check AND using 0 and 1 treated as boolean values +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_037", Include) { + try { + + sql(s"""select * from uniqdataquery1 where true aNd 0""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check AND on two columns +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_038", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id=9000 and cust_name='cust_name_00000'""").collect + + +} + + +//To check '='operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_039", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id=9000 and cust_name='cust_name_00000' and ACTIVE_EMUI_VERSION='ACTIVE_EMUI_VERSION_00000'""").collect + + +} + + +//To check '='operator without Passing any value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_040", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id=""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '='operator without Passing columnname and value. +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_041", Include) { + try { + + sql(s"""select * from uniqdataquery1 where =""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '!='operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_042", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id!=9000""").collect + + +} + + +//To check '!='operator by keeping space between them +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_043", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id ! = 9001""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '!='operator by Passing boolean value whereas column expects an integer +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_044", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id != true""").collect + + +} + + +//To check '!='operator without providing any value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_045", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id != """).collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '!='operator without providing any column name +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_046", Include) { + try { + + sql(s"""select * from uniqdataquery1 where != false""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'NOT' with valid syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_047", Include) { + + sql(s"""select * from uniqdataquery1 where NOT(cust_id=9000)""").collect + + +} + + +//To check 'NOT' using boolean values +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_048", Include) { + + sql(s"""select * from uniqdataquery1 where NOT(false)""").collect + + +} + + +//To check 'NOT' applying it on a value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_049", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id = 'NOT(false)'""").collect + + +} + + +//To check 'NOT' with between operator +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_050", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id NOT BETWEEN 9000 and 9005""").collect + + +} + + +//To check 'NOT' operator in nested way +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_051", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id NOT (NOT(true))""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'NOT' operator with parenthesis. +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_052", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id NOT ()""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'NOT' operator without condition. +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_053", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id NOT""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'NOT' operator checking case sensitivity. +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_054", Include) { + + sql(s"""select * from uniqdataquery1 where nOt(false)""").collect + + +} + + +//To check '>' operator without specifying column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_055", Include) { + try { + + sql(s"""select * from uniqdataquery1 where > 20""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '>' operator without specifying value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_056", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id > """).collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '>' operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_057", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id >9005""").collect + + +} + + +//To check '>' operator for Integer value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_058", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id > 9010""").collect + + +} + + +//To check '>' operator for String value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_059", Include) { + + sql(s"""select * from uniqdataquery1 where cust_name > 'cust_name_00000'""").collect + + +} + + +//To check '<' operator without specifying column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_060", Include) { + try { + + sql(s"""select * from uniqdataquery1 where < 5""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '<' operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_061", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id < 9005""").collect + + +} + + +//To check '<' operator for String value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_062", Include) { + + sql(s"""select * from uniqdataquery1 where cust_name < "cust_name_00001"""").collect + + +} + + +//To check '<=' operator without specifying column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_063", Include) { + try { + + sql(s"""select * from uniqdataquery1 where <= 2""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '<=' operator without providing value +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_064", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id <= """).collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check '<=' operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_065", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id <=9002""").collect + + +} + + +//To check '<=' operator adding space between'<' and '=' +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_066", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id < = 9002""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'BETWEEN' operator without providing range +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_067", Include) { + try { + + sql(s"""select * from uniqdataquery1 where age between""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'BETWEEN' operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_068", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id between 9002 and 9030""").collect + + +} + + +//To check 'BETWEEN' operator providing two same values +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_069", Include) { + + sql(s"""select * from uniqdataquery1 where cust_name beTWeen 'CU%' and 'CU%'""").collect + + +} + + +//To check 'NOT BETWEEN' operator for integer +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_070", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id NOT between 9024 and 9030""").collect + + +} + + +//To check 'NOT BETWEEN' operator for string +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_071", Include) { + + sql(s"""select * from uniqdataquery1 where cust_name NOT beTWeen 'cust_name_00000' and 'cust_name_00001'""").collect + + +} + + +//To check 'IS NULL' for case sensitiveness. +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_072", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id Is NulL""").collect + + +} + + +//To check 'IS NULL' for null field +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_073", Include) { + + sql(s"""select * from uniqdataquery1 where cust_name Is NulL""").collect + + +} + + +//To check 'IS NULL' without providing column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_074", Include) { + try { + + sql(s"""select * from uniqdataquery1 where Is NulL""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check 'IS NOT NULL' without providing column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_075", Include) { + try { + + sql(s"""select * from uniqdataquery1 where IS NOT NULL""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check ''IS NOT NULL' operator with correct syntax +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_076", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id IS NOT NULL""").collect + + +} + + +//To check 'Like' operator for integer +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_077", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id Like '9%'""").collect + + +} + + +//To check Limit clause with where condition +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_078", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id>10987 limit 15""").collect + + +} + + +//To check Limit clause with where condition and no argument +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_079", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id=10987 limit""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check Limit clause with where condition and decimal argument +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_080", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id=10987 limit 0.0""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check where clause with distinct and group by +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_081", Include) { + + sql(s"""select distinct cust_name from uniqdataquery1 where cust_name IN("CUST_NAME_01999") group by cust_name""").collect + + +} + + +//To check subqueries +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_082", Include) { + + sql(s"""select * from (select cust_id from uniqdataquery1 where cust_id IN (10987,10988)) uniqdataquery1 where cust_id IN (10987, 10988)""").collect + + +} + + +//To count with where clause +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_083", Include) { + + sql(s"""select count(cust_id) from uniqdataquery1 where cust_id > 10874""").collect + + +} + + +//To check Join query +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_084", Include) { + dropTable("uniqdataquery11") + sql(s"""CREATE TABLE uniqdataquery11 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdataquery11 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""select uniqdataquery1.CUST_ID from uniqdataquery1 join uniqdataquery11 where uniqdataquery1.CUST_ID > 10700 and uniqdataquery11.CUST_ID > 10500""").collect +} + + +//To check Left join with where clause +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_085", Include) { + + sql(s"""select uniqdataquery1.CUST_ID from uniqdataquery1 LEFT join uniqdataquery11 where uniqdataquery1.CUST_ID > 10000""").collect + + +} + + +//To check Full join +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_086", Include) { + try { + + sql(s"""select uniqdataquery1.CUST_ID from uniqdataquery1 FULL JOIN uniqdataquery11 where CUST_ID""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check Broadcast join +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_087", Include) { + + sql(s"""select broadcast.cust_id from uniqdataquery1 broadcast join uniqdataquery11 where broadcast.cust_id > 10900""").collect + + sql(s"""drop table uniqdataquery11""").collect +} + + +//To avg function +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_088", Include) { + + sql(s"""select avg(cust_name) from uniqdataquery1 where cust_id > 10544 group by cust_name""").collect + + +} + + +//To check subquery with aggrgate function avg +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_089", Include) { + + sql(s"""select cust_id,avg(cust_id) from uniqdataquery1 where cust_id IN (select cust_id from uniqdataquery1 where cust_id > 0) group by cust_id""").collect + + +} + + +//To check HAVING on Measure +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_090", Include) { + + sql(s"""select cust_id from uniqdataquery1 where cust_id > 10543 group by cust_id having cust_id = 10546""").collect + + +} + + +//To check HAVING on dimension +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_091", Include) { + + sql(s"""select cust_name from uniqdataquery1 where cust_id > 10544 group by cust_name having cust_name like 'C%'""").collect + + +} + + +//To check HAVING on multiple columns +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_092", Include) { + + sql(s"""select cust_id,cust_name from uniqdataquery1 where cust_id > 10544 group by cust_id,cust_name having cust_id = 10545 AND cust_name like 'C%'""").collect + + +} + + +//To check HAVING with empty condition +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_094", Include) { + + sql(s"""select cust_name from uniqdataquery1 where cust_id > 10544 group by cust_name having """"").collect + + +} + + +//To check SORT on measure +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_095", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id > 10544 sort by cust_id asc""").collect + + +} + + +//To check SORT on dimemsion +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_096", Include) { + + sql(s"""select * from uniqdataquery1 where cust_id > 10544 sort by cust_name desc""").collect + + +} + + +//To check SORT using 'AND' on multiple column +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_097", Include) { + try { + + sql(s"""select * from uniqdataquery1 where cust_id > 10544 sort by cust_name desc and cust_id asc""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check Select average names and group by name query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_098", Include) { + + sql(s"""select avg(cust_name) from uniqdataquery1 group by cust_name""").collect + + +} + + +//To check Select average id and group by id query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_099", Include) { + + sql(s"""select avg(cust_id) from uniqdataquery1 group by cust_id""").collect + + +} + + +//To check average aggregate function with no arguments +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_100", Include) { + try { + + sql(s"""select cust_id,avg() from uniqdataquery1 group by cust_id""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check average aggregate function with empty string +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_101", Include) { + + sql(s"""select cust_id,avg("") from uniqdataquery1 group by cust_id""").collect + + +} + + +//To check nested average aggregate function +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_102", Include) { + try { + + sql(s"""select cust_id,avg(count(cust_id)) from uniqdataquery1 group by cust_id""").collect + + assert(false) + } catch { + case _ => assert(true) + } + +} + + +//To check Multilevel query +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_103", Include) { + + sql(s"""select cust_id,avg(cust_id) from uniqdataquery1 where cust_id IN (select cust_id from uniqdataquery1) group by cust_id""").collect + + +} + + +//To check Using first() with group by clause +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_104", Include) { + + sql(s"""select first(cust_id) from uniqdataquery1 group by cust_id""").collect + + +} + + +//To check max with groupby clause query execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_105", Include) { + + sql(s"""select max(cust_name) from uniqdataquery1 group by(cust_name)""").collect + + +} + + +//To check max with groupby clause query with id execution +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_106", Include) { + + sql(s"""select max(cust_name) from uniqdataquery1 group by(cust_name),cust_id""").collect + + +} + + +//To check multiple aggregate functions +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_107", Include) { + + sql(s"""select max(cust_name),sum(cust_name),count(cust_id) from uniqdataquery1 group by(cust_name),cust_id""").collect + + +} + + +//To check max with empty string as argument +test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_108", Include) { + + sql(s"""select max("") from uniqdataquery1 group by(cust_name)""").collect + + + } + + + //To check select count of names with group by clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_109", Include) { + + sql(s"""select count(cust_name) from uniqdataquery1 group by cust_name""").collect + + + } + + + //To check Order by ASC + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_110", Include) { + + sql(s"""select * from uniqdataquery1 order by cust_id ASC""").collect + + + } + + + //To check Order by DESC + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_111", Include) { + + sql(s"""select * from uniqdataquery1 order by cust_id DESC""").collect + + + } + + + //To check Order by without column name + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_112", Include) { + try { + + sql(s"""select * from uniqdataquery1 order by ASC""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check cast Int to String + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_113", Include) { + + sql(s"""select cast(bigint_column1 as STRING) from uniqdataquery1""").collect + + + } + + + //To check cast string to int + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_114", Include) { + + sql(s"""select cast(cust_name as INT) from uniqdataquery1""").collect + + + } + + + //To check cast int to decimal + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_115", Include) { + + sql(s"""select cast(bigint_column1 as DECIMAL(10,4)) from uniqdataquery1""").collect + + + } + + + //To check Using window with order by + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_116", Include) { + + sql(s"""select cust_name, sum(bigint_column1) OVER w from uniqdataquery1 WINDOW w AS (PARTITION BY bigint_column2 ORDER BY cust_id)""").collect + + + } + + + //To check Using window without partition + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_117", Include) { + try { + + sql(s"""select cust_name, sum(bigint_column1) OVER w from uniqdataquery1 WINDOW w""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check Using ROLLUP with group by + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_118", Include) { + + sql(s"""select cust_name from uniqdataquery1 group by cust_name with ROLLUP""").collect + + + } + + + //To check Using ROLLUP without group by clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_119", Include) { + try { + + sql(s"""select cust_name from uniqdataquery1 with ROLLUP""").collect + + assert(false) + } catch { + case _ => assert(true) + } + sql(s"""drop table uniqdataquery1""").collect + } + + val prop = CarbonProperties.getInstance() + val p1 = prop.getProperty("enable.unsafe.in.query.processing", CarbonCommonConstants.ENABLE_UNSAFE_IN_QUERY_EXECUTION_DEFAULTVALUE) + val p2 = prop.getProperty("use.offheap.in.query.processing", CarbonCommonConstants.USE_OFFHEAP_IN_QUERY_PROCSSING_DEFAULT) + + override protected def beforeAll() { + // Adding new properties + prop.addProperty("enable.unsafe.in.query.processing", "true") + prop.addProperty("use.offheap.in.query.processing", "true") + } + + override def afterAll: Unit = { + //Reverting to old + prop.addProperty("enable.unsafe.in.query.processing", p1) + prop.addProperty("use.offheap.in.query.processing", p2) + } + +} \ 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/OffheapQuery2TestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapQuery2TestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapQuery2TestCase.scala new file mode 100644 index 0000000..bb356d1 --- /dev/null +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapQuery2TestCase.scala @@ -0,0 +1,1276 @@ + +/* + * 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 + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties + +/** + * Test Class for OffheapQuery2TestCase to verify all scenerios + */ + +class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { + + + //To check select query with limit + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_120", Include) { + sql(s"""CREATE TABLE uniqdataquery2 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdataquery2 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""select * from uniqdataquery2 limit 100""").collect + + + } + + + //To check select query with limit as string + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_121", Include) { + try { + + sql(s"""select * from uniqdataquery2 limit """"").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check select query with no input given at limit + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_122", Include) { + + sql(s"""select * from uniqdataquery2 limit""").collect + + + } + + + //To check select count query with where and group by clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_123", Include) { + + sql(s"""select count(*) from uniqdataquery2 where cust_name="CUST_NAME_00000" group by cust_name""").collect + + + } + + + //To check select count query and group by cust_name using like operator + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_124", Include) { + + sql(s"""select count(*) from uniqdataquery2 where cust_name like "cust_name_0%" group by cust_name""").collect + + + } + + + //To check select count query and group by name using IN operator with empty values + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_125", Include) { + + sql(s"""select count(*) from uniqdataquery2 where cust_name IN("","") group by cust_name""").collect + + + } + + + //To check select count query and group by name using IN operator with specific values + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_126", Include) { + + sql(s"""select count(*) from uniqdataquery2 where cust_name IN(1,2,3) group by cust_name""").collect + + + } + + + //To check select distinct query + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_127", Include) { + + sql(s"""select distinct cust_name from uniqdataquery2 group by cust_name""").collect + + + } + + + //To check where clause with OR and no operand + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_128", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id > 1 OR """).collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check OR clause with LHS and RHS having no arguments + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_129", Include) { + try { + + sql(s"""select * from uniqdataquery2 where OR """).collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check OR clause with LHS having no arguments + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_130", Include) { + try { + + sql(s"""select * from uniqdataquery2 where OR cust_id > "1"""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check incorrect query + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_132", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id > 0 OR name """).collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check select query with rhs false + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_133", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id > 9005 OR false""").collect + + + } + + + //To check count on multiple arguments + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_134", Include) { + + sql(s"""select count(cust_id,cust_name) from uniqdataquery2 where cust_id > 10544""").collect + + + } + + + //To check count with no argument + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_135", Include) { + + sql(s"""select count() from uniqdataquery2 where cust_id > 10544""").collect + + + } + + + //To check count with * as an argument + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_136", Include) { + + sql(s"""select count(*) from uniqdataquery2 where cust_id>10544""").collect + + + } + + + //To check select count query execution with entire column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_137", Include) { + + sql(s"""select count(*) from uniqdataquery2""").collect + + + } + + + //To check select distinct query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_138", Include) { + + sql(s"""select distinct * from uniqdataquery2""").collect + + + } + + + //To check select multiple column query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_139", Include) { + + sql(s"""select cust_name,cust_id,count(cust_name) from uniqdataquery2 group by cust_name,cust_id""").collect + + + } + + + //To check select count and distinct query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_140", Include) { + try { + + sql(s"""select count(cust_id),distinct(cust_name) from uniqdataquery2""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check sum query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_141", Include) { + + sql(s"""select sum(cust_id) as sum,cust_name from uniqdataquery2 group by cust_name""").collect + + + } + + + //To check sum of names query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_142", Include) { + + sql(s"""select sum(cust_name) from uniqdataquery2""").collect + + + } + + + //To check select distinct and groupby query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_143", Include) { + + sql(s"""select distinct(cust_name,cust_id) from uniqdataquery2 group by cust_name,cust_id""").collect + + + } + + + //To check select with where clause on cust_name query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_144", Include) { + + sql(s"""select cust_id from uniqdataquery2 where cust_name="cust_name_00000"""").collect + + + } + + + //To check query execution with IN operator without paranthesis + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_146", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id IN 9000,9005""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check query execution with IN operator with paranthesis + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_147", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id IN (9000,9005)""").collect + + + } + + + //To check query execution with IN operator with out specifying any field. + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_148", Include) { + try { + + sql(s"""select * from uniqdataquery2 where IN(1,2)""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check OR with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_149", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id>9005 or cust_id=9005""").collect + + + } + + + //To check OR with boolean expression + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_150", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id>9005 or false""").collect + + + } + + + //To check AND with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_151", Include) { + + sql(s"""select * from uniqdataquery2 where true AND true""").collect + + + } + + + //To check AND with using booleans + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_152", Include) { + + sql(s"""select * from uniqdataquery2 where true AND false""").collect + + + } + + + //To check AND with using booleans in invalid syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_153", Include) { + try { + + sql(s"""select * from uniqdataquery2 where AND true""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check AND Passing two conditions on same input + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_154", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id=6 and cust_id>5""").collect + + + } + + + //To check AND changing case + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_155", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id=6 aND cust_id>5""").collect + + + } + + + //To check AND using 0 and 1 treated as boolean values + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_156", Include) { + try { + + sql(s"""select * from uniqdataquery2 where true aNd 0""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check AND on two columns + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_157", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id=9000 and cust_name='cust_name_00000'""").collect + + + } + + + //To check '='operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_158", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id=9000 and cust_name='cust_name_00000' and ACTIVE_EMUI_VERSION='ACTIVE_EMUI_VERSION_00000'""").collect + + + } + + + //To check '='operator without Passing any value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_159", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id=""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '='operator without Passing columnname and value. + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_160", Include) { + try { + + sql(s"""select * from uniqdataquery2 where =""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '!='operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_161", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id!=9000""").collect + + + } + + + //To check '!='operator by keeping space between them + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_162", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id ! = 9001""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '!='operator by Passing boolean value whereas column expects an integer + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_163", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id != true""").collect + + + } + + + //To check '!='operator without providing any value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_164", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id != """).collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '!='operator without providing any column name + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_165", Include) { + try { + + sql(s"""select * from uniqdataquery2 where != false""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'NOT' with valid syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_166", Include) { + + sql(s"""select * from uniqdataquery2 where NOT(cust_id=9000)""").collect + + + } + + + //To check 'NOT' using boolean values + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_167", Include) { + + sql(s"""select * from uniqdataquery2 where NOT(false)""").collect + + + } + + + //To check 'NOT' applying it on a value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_168", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id = 'NOT(false)'""").collect + + + } + + + //To check 'NOT' with between operator + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_169", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id NOT BETWEEN 9000 and 9005""").collect + + + } + + + //To check 'NOT' operator in nested way + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_170", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id NOT (NOT(true))""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'NOT' operator with parenthesis. + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_171", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id NOT ()""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'NOT' operator without condition. + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_172", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id NOT""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'NOT' operator checking case sensitivity. + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_173", Include) { + + sql(s"""select * from uniqdataquery2 where nOt(false)""").collect + + + } + + + //To check '>' operator without specifying column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_174", Include) { + try { + + sql(s"""select * from uniqdataquery2 where > 20""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '>' operator without specifying value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_175", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id > """).collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '>' operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_176", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id >9005""").collect + + + } + + + //To check '>' operator for Integer value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_177", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id > 9010""").collect + + + } + + + //To check '>' operator for String value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_178", Include) { + + sql(s"""select * from uniqdataquery2 where cust_name > 'cust_name_00000'""").collect + + + } + + + //To check '<' operator without specifying column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_179", Include) { + try { + + sql(s"""select * from uniqdataquery2 where < 5""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '<' operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_180", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id < 9005""").collect + + + } + + + //To check '<' operator for String value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_181", Include) { + + sql(s"""select * from uniqdataquery2 where cust_name < "cust_name_00001"""").collect + + + } + + + //To check '<=' operator without specifying column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_182", Include) { + try { + + sql(s"""select * from uniqdataquery2 where <= 2""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '<=' operator without providing value + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_183", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id <= """).collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check '<=' operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_184", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id <=9002""").collect + + + } + + + //To check '<=' operator adding space between'<' and '=' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_185", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id < = 9002""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'BETWEEN' operator without providing range + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_186", Include) { + try { + + sql(s"""select * from uniqdataquery2 where age between""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'BETWEEN' operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_187", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id between 9002 and 9030""").collect + + + } + + + //To check 'BETWEEN' operator providing two same values + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_188", Include) { + + sql(s"""select * from uniqdataquery2 where cust_name beTWeen 'CU%' and 'CU%'""").collect + + + } + + + //To check 'NOT BETWEEN' operator for integer + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_189", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id NOT between 9024 and 9030""").collect + + + } + + + //To check 'NOT BETWEEN' operator for string + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_190", Include) { + + sql(s"""select * from uniqdataquery2 where cust_name NOT beTWeen 'cust_name_00000' and 'cust_name_00001'""").collect + + + } + + + //To check 'IS NULL' for case sensitiveness. + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_191", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id Is NulL""").collect + + + } + + + //To check 'IS NULL' for null field + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_192", Include) { + + sql(s"""select * from uniqdataquery2 where cust_name Is NulL""").collect + + + } + + + //To check 'IS NULL' without providing column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_193", Include) { + try { + + sql(s"""select * from uniqdataquery2 where Is NulL""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check 'IS NOT NULL' without providing column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_194", Include) { + try { + + sql(s"""select * from uniqdataquery2 where IS NOT NULL""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check ''IS NOT NULL' operator with correct syntax + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_195", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id IS NOT NULL""").collect + + + } + + + //To check 'Like' operator for integer + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_196", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id Like '9%'""").collect + + + } + + + //To check Limit clause with where condition + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_197", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id>10987 limit 15""").collect + + + } + + + //To check Limit clause with where condition and no argument + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_198", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id=10987 limit""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check Limit clause with where condition and decimal argument + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_199", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id=10987 limit 0.0""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check where clause with distinct and group by + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_200", Include) { + + sql(s"""select distinct cust_name from uniqdataquery2 where cust_name IN("CUST_NAME_01999") group by cust_name""").collect + + + } + + + //To check subqueries + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_201", Include) { + + sql(s"""select * from (select cust_id from uniqdataquery2 where cust_id IN (10987,10988)) uniqdataquery2 where cust_id IN (10987, 10988)""").collect + + + } + + + //To count with where clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_202", Include) { + + sql(s"""select count(cust_id) from uniqdataquery2 where cust_id > 10874""").collect + + + } + + + //To check Join query + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_203", Include) { + sql(s"""CREATE TABLE uniqdataquery22 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdataquery22 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""select uniqdataquery2.CUST_ID from uniqdataquery2 join uniqdataquery22 where uniqdataquery2.CUST_ID > 10700 and uniqdataquery22.CUST_ID > 10500""").collect + + + } + + + //To check Left join with where clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_204", Include) { + + sql(s"""select uniqdataquery2.CUST_ID from uniqdataquery2 LEFT join uniqdataquery22 where uniqdataquery2.CUST_ID > 10000""").collect + + + } + + + //To check Full join + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_205", Include) { + try { + + sql(s"""select uniqdataquery2.CUST_ID from uniqdataquery2 FULL JOIN uniqdataquery22 where CUST_ID""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check Broadcast join + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_206", Include) { + + sql(s"""select broadcast.cust_id from uniqdataquery2 broadcast join uniqdataquery22 where broadcast.cust_id > 10900""").collect + + sql(s"""drop table uniqdataquery22""").collect + } + + + //To avg function + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_207", Include) { + + sql(s"""select avg(cust_name) from uniqdataquery2 where cust_id > 10544 group by cust_name""").collect + + + } + + + //To check subquery with aggrgate function avg + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_208", Include) { + + sql(s"""select cust_id,avg(cust_id) from uniqdataquery2 where cust_id IN (select cust_id from uniqdataquery2 where cust_id > 0) group by cust_id""").collect + + + } + + + //To check HAVING on Measure + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_209", Include) { + + sql(s"""select cust_id from uniqdataquery2 where cust_id > 10543 group by cust_id having cust_id = 10546""").collect + + + } + + + //To check HAVING on dimension + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_210", Include) { + + sql(s"""select cust_name from uniqdataquery2 where cust_id > 10544 group by cust_name having cust_name like 'C%'""").collect + + + } + + + //To check HAVING on multiple columns + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_211", Include) { + + sql(s"""select cust_id,cust_name from uniqdataquery2 where cust_id > 10544 group by cust_id,cust_name having cust_id = 10545 AND cust_name like 'C%'""").collect + + + } + + + //To check HAVING with empty condition + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_213", Include) { + + sql(s"""select cust_name from uniqdataquery2 where cust_id > 10544 group by cust_name having """"").collect + + + } + + + //To check SORT on measure + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_214", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id > 10544 sort by cust_id asc""").collect + + + } + + + //To check SORT on dimemsion + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_215", Include) { + + sql(s"""select * from uniqdataquery2 where cust_id > 10544 sort by cust_name desc""").collect + + + } + + + //To check SORT using 'AND' on multiple column + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_216", Include) { + try { + + sql(s"""select * from uniqdataquery2 where cust_id > 10544 sort by cust_name desc and cust_id asc""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check Select average names and group by name query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_217", Include) { + + sql(s"""select avg(cust_name) from uniqdataquery2 group by cust_name""").collect + + + } + + + //To check Select average id and group by id query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_218", Include) { + + sql(s"""select avg(cust_id) from uniqdataquery2 group by cust_id""").collect + + + } + + + //To check average aggregate function with no arguments + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_219", Include) { + try { + + sql(s"""select cust_id,avg() from uniqdataquery2 group by cust_id""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check average aggregate function with empty string + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_220", Include) { + + sql(s"""select cust_id,avg("") from uniqdataquery2 group by cust_id""").collect + + + } + + + //To check nested average aggregate function + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_221", Include) { + try { + + sql(s"""select cust_id,avg(count(cust_id)) from uniqdataquery2 group by cust_id""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check Multilevel query + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_222", Include) { + + sql(s"""select cust_id,avg(cust_id) from uniqdataquery2 where cust_id IN (select cust_id from uniqdataquery2) group by cust_id""").collect + + + } + + + //To check Using first() with group by clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_223", Include) { + + sql(s"""select first(cust_id) from uniqdataquery2 group by cust_id""").collect + + + } + + + //To check max with groupby clause query execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_224", Include) { + + sql(s"""select max(cust_name) from uniqdataquery2 group by(cust_name)""").collect + + + } + + + //To check max with groupby clause query with id execution + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_225", Include) { + + sql(s"""select max(cust_name) from uniqdataquery2 group by(cust_name),cust_id""").collect + + + } + + + //To check multiple aggregate functions + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_226", Include) { + + sql(s"""select max(cust_name),sum(cust_name),count(cust_id) from uniqdataquery2 group by(cust_name),cust_id""").collect + + + } + + + //To check max with empty string as argument + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_227", Include) { + + sql(s"""select max("") from uniqdataquery2 group by(cust_name)""").collect + + + } + + + //To check select count of names with group by clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_228", Include) { + + sql(s"""select count(cust_name) from uniqdataquery2 group by cust_name""").collect + + + } + + + //To check Order by ASC + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_229", Include) { + + sql(s"""select * from uniqdataquery2 order by cust_id ASC""").collect + + + } + + + //To check Order by DESC + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_230", Include) { + + sql(s"""select * from uniqdataquery2 order by cust_id DESC""").collect + + + } + + + //To check Order by without column name + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_231", Include) { + try { + + sql(s"""select * from uniqdataquery2 order by ASC""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check cast Int to String + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_232", Include) { + + sql(s"""select cast(bigint_column1 as STRING) from uniqdataquery2""").collect + + + } + + + //To check cast string to int + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_233", Include) { + + sql(s"""select cast(cust_name as INT) from uniqdataquery2""").collect + + + } + + + //To check cast int to decimal + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_234", Include) { + + sql(s"""select cast(bigint_column1 as DECIMAL(10,4)) from uniqdataquery2""").collect + + + } + + + //To check Using window with order by + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_235", Include) { + + sql(s"""select cust_name, sum(bigint_column1) OVER w from uniqdataquery2 WINDOW w AS (PARTITION BY bigint_column2 ORDER BY cust_id)""").collect + + + } + + + //To check Using window without partition + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_236", Include) { + try { + + sql(s"""select cust_name, sum(bigint_column1) OVER w from uniqdataquery2 WINDOW w""").collect + + assert(false) + } catch { + case _ => assert(true) + } + + } + + + //To check Using ROLLUP with group by + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_237", Include) { + + sql(s"""select cust_name from uniqdataquery2 group by cust_name with ROLLUP""").collect + + + } + + + //To check Using ROLLUP without group by clause + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-006-01-01-01_001-TC_238", Include) { + try { + + sql(s"""select cust_name from uniqdataquery2 with ROLLUP""").collect + + assert(false) + } catch { + case _ => assert(true) + } + sql(s"""drop table uniqdataquery2""").collect + } + + val prop = CarbonProperties.getInstance() + val p1 = prop.getProperty("enable.unsafe.in.query.processing", CarbonCommonConstants.ENABLE_UNSAFE_IN_QUERY_EXECUTION_DEFAULTVALUE) + val p2 = prop.getProperty("use.offheap.in.query.processing", CarbonCommonConstants.USE_OFFHEAP_IN_QUERY_PROCSSING_DEFAULT) + + override protected def beforeAll() { + // Adding new properties + prop.addProperty("enable.unsafe.in.query.processing", "false") + prop.addProperty("use.offheap.in.query.processing", "true") + } + + override def afterAll: Unit = { + //Reverting to old + prop.addProperty("enable.unsafe.in.query.processing", p1) + prop.addProperty("use.offheap.in.query.processing", p2) + } + +} \ 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/OffheapSort1TestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort1TestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort1TestCase.scala new file mode 100644 index 0000000..21d292e --- /dev/null +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort1TestCase.scala @@ -0,0 +1,239 @@ + +/* + * 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 + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties + +/** + * Test Class for OffheapSort1TestCase to verify all scenerios + */ + +class OffheapSort1TestCase extends QueryTest with BeforeAndAfterAll { + + + + + //To load data after setting offheap memory in carbon property file + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_001", Include) { + sql(s"""CREATE TABLE uniqdata11 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata11 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata11""").collect + + + sql(s"""drop table uniqdata11""").collect + + } + + + //To load 1 lac data load after setting offheap memory in carbon property file + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_002", Include) { + sql(s"""CREATE TABLE uniqdata12 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata12 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata12""").collect + + + sql(s"""drop table uniqdata12""").collect + + } + + + //To load data after setting offheap memory in carbon property file with option file header in load + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_003", Include) { + sql(s"""CREATE TABLE uniqdata12a(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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata12a OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata12a""").collect + + + sql(s"""drop table uniqdata12a""").collect + + } + + + //To load data after setting offheap memory in carbon property file without folder path in load + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_004", Include) { + try { + sql(s"""CREATE TABLE uniqdata13 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'org.apache.carbondata.format'""").collect + + sql(s"""LOAD DATA into table uniqdata13 OPTIONS('DELIMITER'=',' , 'FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + assert(false) + } catch { + case _ => assert(true) + } + sql(s"""drop table uniqdata13""").collect + + } + + + //To load data after setting offheap memory in carbon property file without table_name in load + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_005", Include) { + sql(s"""drop table if exists uniqdata14""").collect + try { + sql(s"""CREATE TABLE uniqdata14 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'org.apache.carbondata.format'""").collect + + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/HeapVector/2000_UniqData.csv' into table OPTIONS('DELIMITER'=',' , 'FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + assert(false) + } catch { + case _ => assert(true) + } + + sql(s"""drop table if exists uniqdata14""").collect + + } + + + //To load data after setting offheap memory in carbon property file with option QUOTECHAR'='"' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_006", Include) { + sql(s"""CREATE TABLE uniqdata15 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata15 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + sql(s"""select * from uniqdata15""").collect + sql(s"""drop table uniqdata15""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS('COMMENTCHAR'='#') + + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_007", Include) { + sql(s"""CREATE TABLE uniqdata16 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata16 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata16""").collect + + + sql(s"""drop table uniqdata16""").collect + + } + + + //To load data after setting offheap memory in carbon property file with option 'MULTILINE'='true' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_008", Include) { + sql(s"""CREATE TABLE uniqdata17 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata17 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata17""").collect + + + sql(s"""drop table uniqdata17""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS('ESCAPECHAR'='\') + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_009", Include) { + sql(s"""CREATE TABLE uniqdata18 (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata18 OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','ESCAPECHAR'='\','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata18""").collect + + + sql(s"""drop table uniqdata18""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS 'BAD_RECORDS_ACTION'='FORCE' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_010", Include) { + sql(s"""CREATE TABLE uniqdata19b (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata19b OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','ESCAPECHAR'='\','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata19b""").collect + + + sql(s"""drop table uniqdata19b""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS 'BAD_RECORDS_ACTION'='IGNORE' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_011", Include) { + sql(s"""CREATE TABLE uniqdata19c (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata19c OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','ESCAPECHAR'='\','BAD_RECORDS_ACTION'='IGNORE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata19c""").collect + + + sql(s"""drop table uniqdata19c""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS 'BAD_RECORDS_ACTION'='REDIRECT' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_012", Include) { + sql(s"""CREATE TABLE uniqdata19d (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata19d OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','ESCAPECHAR'='\','BAD_RECORDS_ACTION'='REDIRECT','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata19d""").collect + + + sql(s"""drop table uniqdata19d""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS 'BAD_RECORDS_LOGGER_ENABLE'='FALSE' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_013", Include) { + sql(s"""CREATE TABLE uniqdata19e (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata19e OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','ESCAPECHAR'='\','BAD_RECORDS_ACTION'='REDIRECT','BAD_RECORDS_LOGGER_ENABLE'='FALSE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata19e""").collect + + + sql(s"""drop table uniqdata19e""").collect + + } + + + //To load data after setting offheap memory in carbon property file with OPTIONS 'BAD_RECORDS_LOGGER_ENABLE'='TRUE' + test("PTS-AR-Productize-New-Features-Huawei-Spark2.1-003-01-01-01_001-TC_014", Include) { + sql(s"""CREATE TABLE uniqdata19f (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), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'carbondata'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/uniqdata/2000_UniqData.csv' into table uniqdata19f OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','COMMENTCHAR'='#','MULTILINE'='true','ESCAPECHAR'='\','BAD_RECORDS_ACTION'='REDIRECT','BAD_RECORDS_LOGGER_ENABLE'='TRUE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')""").collect + + sql(s"""select * from uniqdata19f""").collect + + + sql(s"""drop table uniqdata19f""").collect + + } + + val prop = CarbonProperties.getInstance() + val p1 = prop.getProperty("enable.unsafe.sort", CarbonCommonConstants.ENABLE_UNSAFE_SORT_DEFAULT) + val p2 = prop.getProperty("offheap.sort.chunk.size.inmb", CarbonCommonConstants.OFFHEAP_SORT_CHUNK_SIZE_IN_MB_DEFAULT) + val p3 = prop.getProperty("sort.inmemory.size.inmb", CarbonCommonConstants.IN_MEMORY_FOR_SORT_DATA_IN_MB_DEFAULT) + + override protected def beforeAll() { + // Adding new properties + prop.addProperty("enable.unsafe.sort", "true") + prop.addProperty("offheap.sort.chunk.size.inmb", "128") + prop.addProperty("sort.inmemory.size.inmb", "1024") + } + + override def afterAll: Unit = { + //Reverting to old + prop.addProperty("enable.unsafe.sort", p1) + prop.addProperty("offheap.sort.chunk.size.inmb", p2) + prop.addProperty("sort.inmemory.size.inmb", p3) + } +} \ No newline at end of file
