http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingIUDTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingIUDTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingIUDTestCase.scala index d6fa3ca..b4459ab 100644 --- a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingIUDTestCase.scala +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingIUDTestCase.scala @@ -20,6 +20,8 @@ package org.apache.carbondata.cluster.sdv.generated import java.sql.Timestamp +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties import org.apache.spark.sql.Row import org.apache.spark.sql.common.util._ import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, BeforeAndAfterEach} @@ -60,6 +62,9 @@ class DataLoadingIUDTestCase extends QueryTest with BeforeAndAfterAll with Befor sql("drop table if exists t_carbn01b").collect sql("drop table if exists T_Hive1").collect sql("drop table if exists T_Hive6").collect + sql(s"""create table default.t_carbn01b(Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/InsertData/T_Hive1.csv' INTO table default.t_carbn01B options ('DELIMITER'=',', 'QUOTECHAR'='\', 'FILEHEADER'='Active_status,Item_type_cd,Qty_day_avg,Qty_total,Sell_price,Sell_pricep,Discount_price,Profit,Item_code,Item_name,Outlet_name,Update_time,Create_date')""").collect + } override def before(fun: => Any) { @@ -75,9 +80,7 @@ class DataLoadingIUDTestCase extends QueryTest with BeforeAndAfterAll with Befor //NA test("IUD-01-01-01_001-001", Include) { - sql(s"""create table default.t_carbn01b(Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""LOAD DATA INPATH '$resourcesPath/Data/InsertData/T_Hive1.csv' INTO table default.t_carbn01B options ('DELIMITER'=',', 'QUOTECHAR'='\', 'FILEHEADER'='Active_status,Item_type_cd,Qty_day_avg,Qty_total,Sell_price,Sell_pricep,Discount_price,Profit,Item_code,Item_name,Outlet_name,Update_time,Create_date')""").collect - sql("create table T_Hive1(Active_status BOOLEAN, Item_type_cd TINYINT, Qty_day_avg SMALLINT, Qty_total INT, Sell_price BIGINT, Sell_pricep FLOAT, Discount_price DOUBLE , Profit DECIMAL(3,2), Item_code STRING, Item_name VARCHAR(50), Outlet_name CHAR(100), Update_time TIMESTAMP, Create_date DATE) row format delimited fields terminated by ',' collection items terminated by '$'") + sql("create table T_Hive1(Active_status BOOLEAN, Item_type_cd TINYINT, Qty_day_avg SMALLINT, Qty_total INT, Sell_price BIGINT, Sell_pricep FLOAT, Discount_price DOUBLE , Profit DECIMAL(3,2), Item_code STRING, Item_name VARCHAR(50), Outlet_name CHAR(100), Update_time TIMESTAMP, Create_date DATE) row format delimited fields terminated by ',' collection items terminated by '$'") sql(s"""LOAD DATA INPATH '$resourcesPath/Data/InsertData/T_Hive1.csv' overwrite into table T_Hive1""").collect sql("create table T_Hive6(Item_code STRING, Sub_item_cd ARRAY<string>)row format delimited fields terminated by ',' collection items terminated by '$'") sql(s"""load data inpath '$resourcesPath/Data/InsertData/T_Hive1.csv' overwrite into table T_Hive6""").collect @@ -115,16 +118,13 @@ test("IUD-01-01-01_001-02", Include) { //Check for update Carbon table using a data value on a string column without giving values in semi quote test("IUD-01-01-01_001-03", Include) { - try { + intercept[Exception] { sql(s"""drop table IF EXISTS default.t_carbn01""").collect sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect sql(s"""update default.t_carbn01 set (active_status) = (NO) """).collect sql(s"""NA""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table default.t_carbn01 """).collect } @@ -204,18 +204,14 @@ test("IUD-01-01-01_001-11", Include) { //Check for update Carbon table for a column where column name is mentioned incorrectly test("IUD-01-01-01_001-14", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set (item_status_cd) = ('10')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set (item_status_cd) = ('10')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -245,35 +241,27 @@ test("IUD-01-01-01_001-16", Include) { //Check for update Carbon table for a numeric value column using string value test("IUD-01-01-01_001-17", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set (item_type_cd) = ('Orange')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set (item_type_cd) = ('Orange')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } //Check for update Carbon table for a numeric value column using decimal value test("IUD-01-01-01_001-18", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set (item_type_cd) = ('10.11')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set (item_type_cd) = ('10.11')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -303,18 +291,14 @@ test("IUD-01-01-01_001-20", Include) { //Check for update Carbon table for a numeric Int value column using large numeric value which is beyond 32 bit test("IUD-01-01-01_001-21", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set (item_type_cd) = (-2147483649)""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set (item_type_cd) = (-2147483649)""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -380,18 +364,14 @@ test("IUD-01-01-01_001-26", Include) { //Check for update Carbon table for a decimal value column using String value test("IUD-01-01-01_001-27", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set (profit) = ('hakshk')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set (profit) = ('hakshk')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -445,86 +425,66 @@ test("IUD-01-01-01_001-31", Include) { //Check for update Carbon table for a time stamp value column using date timestamp all formats. test("IUD-01-01-01_001-35", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set(update_time) = ('04-11-20004 18:13:59.113')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set(update_time) = ('04-11-20004 18:13:59.113')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } //Check for update Carbon table for a time stamp value column using string value test("IUD-01-01-01_001-32", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set(update_time) = ('fhjfhjfdshf')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set(update_time) = ('fhjfhjfdshf')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } //Check for update Carbon table for a time stamp value column using numeric test("IUD-01-01-01_001-33", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set(update_time) = (56546)""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set(update_time) = (56546)""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } //Check for update Carbon table for a time stamp value column using date test("IUD-01-01-01_001-34", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set(update_time) = ('2016-11-04')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set(update_time) = ('2016-11-04')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } //Check for update Carbon table for a time stamp value column using date timestamp test("IUD-01-01-01_001-36", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set(update_time) = ('2016-11-04 18:63:59.113')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set(update_time) = ('2016-11-04 18:63:59.113')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -554,18 +514,14 @@ test("IUD-01-01-01_001-40", Include) { //Check update Carbon table using a / operation on a column value test("IUD-01-01-01_001-41", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set(item_type_cd)= (item_type_cd/1)""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set(item_type_cd)= (item_type_cd/1)""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -821,18 +777,14 @@ test("IUD-01-01-01_004-05", Include) { //Check for update Carbon table where source table is having big int and target is having int value column for update test("IUD-01-01-01_004-06", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 a set (a.item_type_cd) = (select b.sell_price from default.t_carbn01b b where b.sell_price=200000343430000000)""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 a set (a.item_type_cd) = (select b.sell_price from default.t_carbn01b b where b.sell_price=200000343430000000)""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -850,35 +802,27 @@ test("IUD-01-01-01_004-07", Include) { //Check for update Carbon table where source table is having string and target is having decimal value column for update test("IUD-01-01-01_004-08", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 a set (a.profit) = (select b.item_code from default.t_carbn01b b where b.item_code='DE3423ee')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 a set (a.profit) = (select b.item_code from default.t_carbn01b b where b.item_code='DE3423ee')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } //Check for update Carbon table where source table is having string and target is having timestamp column for update test("IUD-01-01-01_004-09", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 a set (a.update_time) = (select b.item_code from default.t_carbn01b b where b.item_code='DE3423ee')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 a set (a.update_time) = (select b.item_code from default.t_carbn01b b where b.item_code='DE3423ee')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -968,17 +912,21 @@ test("IUD-01-01-01_005-12", Include) { //Check for update Carbon table where a update column is dimension and is defined with exclude dictionary. test("IUD-01-01-01_005-13", Include) { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Item_type_cd INT, Profit DECIMAL(3,2))STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_INCLUDE'='Item_type_cd')""").collect - sql(s"""insert into default.t_carbn01 select item_type_cd, profit from default.t_carbn01b""").collect - - try { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Item_type_cd INT, Profit DECIMAL(3,2))STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('DICTIONARY_INCLUDE'='Item_type_cd')""").collect + sql(s"""insert into default.t_carbn01 select item_type_cd, profit from default.t_carbn01b""").collect + val currProperty = CarbonProperties.getInstance().getProperty(CarbonCommonConstants + .CARBON_BAD_RECORDS_ACTION); + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, "FAIL") + intercept[Exception] { sql(s"""update default.t_carbn01 set (item_type_cd) = ('ASASDDD')""").collect - assert(false) - } catch { - case _ => assert(true) + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, currProperty) } - sql(s"""drop table default.t_carbn01 """).collect + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, currProperty) + sql(s"""drop table default.t_carbn01 """).collect } @@ -1061,18 +1009,14 @@ test("IUD-01-01-01_009-01", Include) { //Check update on carbon table using incorrect data value test("IUD-01-01-01_010-01", Include) { - try { - sql(s"""drop table IF EXISTS default.t_carbn01 """).collect - sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""update default.t_carbn01 set Update_time = '11-11-2012 77:77:77') where item_code='ASD423ee')""").collect + intercept[Exception] { + sql(s"""drop table IF EXISTS default.t_carbn01 """).collect + sql(s"""create table default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""update default.t_carbn01 set Update_time = '11-11-2012 77:77:77') where item_code='ASD423ee')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -1586,17 +1530,13 @@ test("IUD-01-01-02_009-01", Include) { //Check update on carbon table where a column being updated with incorrect data type. test("IUD-01-01-02_011-01", Include) { - try { - sql(s"""create table if not exists default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""Update T_Carbn04 set (Item_type_cd) = ('Banana')""").collect + intercept[Exception] { + sql(s"""create table if not exists default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""Update T_Carbn04 set (Item_type_cd) = ('Banana')""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -1613,17 +1553,13 @@ test("IUD-01-01-01_022-01", Include) { //Check update on carbon table where multiple values are returned in expression. test("IUD-01-01-01_023-00", Include) { - try { - sql(s"""create table if not exists default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""Update default.t_carbn01 set Item_type_cd = (select Item_type_cd from default.t_carbn01b )""").collect + intercept[Exception] { + sql(s"""create table if not exists default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""Update default.t_carbn01 set Item_type_cd = (select Item_type_cd from default.t_carbn01b )""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect } @@ -1643,17 +1579,13 @@ test("IUD-01-01-02_023-01", Include) { //Check update on carbon table where non matching values are returned from expression. test("IUD-01-01-01_024-01", Include) { - try { - sql(s"""create table if not exists default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect - sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect - sql(s"""Update default.t_carbn01 set Item_type_cd = (select Item_code from default.t_carbn01b)""").collect + intercept[Exception] { + sql(s"""create table if not exists default.t_carbn01 (Active_status String,Item_type_cd INT,Qty_day_avg INT,Qty_total INT,Sell_price BIGINT,Sell_pricep DOUBLE,Discount_price DOUBLE,Profit DECIMAL(3,2),Item_code String,Item_name String,Outlet_name String,Update_time TIMESTAMP,Create_date String)STORED BY 'org.apache.carbondata.format'""").collect + sql(s"""insert into default.t_carbn01 select * from default.t_carbn01b""").collect + sql(s"""Update default.t_carbn01 set Item_type_cd = (select Item_code from default.t_carbn01b)""").collect sql(s"""NA""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table default.t_carbn01 """).collect + sql(s"""drop table default.t_carbn01 """).collect }
http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingTestCase.scala index 8ff47af..52396ee 100644 --- a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingTestCase.scala +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/DataLoadingTestCase.scala @@ -124,7 +124,7 @@ class DataLoadingTestCase extends QueryTest with BeforeAndAfterAll { //Data load-->Empty BadRecords Parameters test("BadRecord_Dataload_011", Include) { - try { + intercept[Exception] { sql(s"""CREATE TABLE badrecords_test1 (ID int,CUST_ID int,sal int,cust_name string) STORED BY 'org.apache.carbondata.format'""") .collect @@ -133,11 +133,8 @@ class DataLoadingTestCase extends QueryTest with BeforeAndAfterAll { checkAnswer( s"""select count(*) from badrecords_test1""", Seq(Row(0)), "DataLoadingTestCase-BadRecord_Dataload_011") - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table badrecords_test1""").collect + sql(s"""drop table badrecords_test1""").collect } http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/InvertedindexTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/InvertedindexTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/InvertedindexTestCase.scala index bae0124..d9d35fb 100644 --- a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/InvertedindexTestCase.scala +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/InvertedindexTestCase.scala @@ -886,17 +886,13 @@ class InvertedindexTestCase extends QueryTest with BeforeAndAfterAll { //to check alter drop column for no_inverted test("NoInvertedindex-TC097", Include) { sql(s"""drop table if exists uniqdata""").collect - try { - sql(s"""CREATE TABLE uniqdata (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' TBLPROPERTIES('COLUMN_GROUPS'='(CUST_NAME,ACTIVE_EMUI_VERSION)','DICTIONARY_INCLUDE'='CUST_ID','NO_INVERTED_INDEX'='CUST_NAME')""").collect - sql(s"""Alter table uniqdata drop columns(BIGINT_COLUMN1)""").collect - sql(s"""LOAD DATA INPATH '$resourcesPath/Data/noinverted.csv' into table uniqdata 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 + intercept[Exception] { + sql(s"""CREATE TABLE uniqdata (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' TBLPROPERTIES('COLUMN_GROUPS'='(CUST_NAME,ACTIVE_EMUI_VERSION)','DICTIONARY_INCLUDE'='CUST_ID','NO_INVERTED_INDEX'='CUST_NAME')""").collect + sql(s"""Alter table uniqdata drop columns(BIGINT_COLUMN1)""").collect + sql(s"""LOAD DATA INPATH '$resourcesPath/Data/noinverted.csv' into table uniqdata 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 BIGINT_COLUMN1 from uniqdata""").collect - - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table if exists uniqdata""").collect + sql(s"""drop table if exists uniqdata""").collect } http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/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 index d93b2ee..e213e49 100644 --- 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 @@ -44,15 +44,9 @@ test("OffHeapQuery-001-TC_001", Include) { //To check select query with limit as string test("OffHeapQuery-001-TC_002", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 limit """"").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -112,57 +106,33 @@ test("OffHeapQuery-001-TC_008", Include) { //To check where clause with OR and no operand test("OffHeapQuery-001-TC_009", Include) { - try { - + intercept[Exception] { 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("OffHeapQuery-001-TC_010", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where OR """).collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check OR clause with LHS having no arguments test("OffHeapQuery-001-TC_011", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where OR cust_id > "1"""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check incorrect query test("OffHeapQuery-001-TC_013", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id > 0 OR name """).collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -231,15 +201,9 @@ test("OffHeapQuery-001-TC_020", Include) { //To check select count and distinct query execution test("OffHeapQuery-001-TC_021", Include) { - try { - + intercept[Exception] { sql(s"""select count(cust_id),distinct(cust_name) from uniqdataquery1""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -281,15 +245,9 @@ test("OffHeapQuery-001-TC_025", Include) { //To check query execution with IN operator without paranthesis test("OffHeapQuery-001-TC_027", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id IN 9000,9005""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -304,15 +262,9 @@ test("OffHeapQuery-001-TC_028", Include) { //To check query execution with IN operator with out specifying any field. test("OffHeapQuery-001-TC_029", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where IN(1,2)""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -354,15 +306,9 @@ test("OffHeapQuery-001-TC_033", Include) { //To check AND with using booleans in invalid syntax test("OffHeapQuery-001-TC_034", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where AND true""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -386,15 +332,9 @@ test("OffHeapQuery-001-TC_036", Include) { //To check AND using 0 and 1 treated as boolean values test("OffHeapQuery-001-TC_037", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where true aNd 0""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -418,29 +358,17 @@ test("OffHeapQuery-001-TC_039", Include) { //To check '='operator without Passing any value test("OffHeapQuery-001-TC_040", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id=""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '='operator without Passing columnname and value. test("OffHeapQuery-001-TC_041", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where =""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -455,15 +383,9 @@ test("OffHeapQuery-001-TC_042", Include) { //To check '!='operator by keeping space between them test("OffHeapQuery-001-TC_043", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id ! = 9001""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -478,29 +400,17 @@ test("OffHeapQuery-001-TC_044", Include) { //To check '!='operator without providing any value test("OffHeapQuery-001-TC_045", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id != """).collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '!='operator without providing any column name test("OffHeapQuery-001-TC_046", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where != false""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -542,43 +452,25 @@ test("OffHeapQuery-001-TC_050", Include) { //To check 'NOT' operator in nested way test("OffHeapQuery-001-TC_051", Include) { - try { - + intercept[Exception] { 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("OffHeapQuery-001-TC_052", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id NOT ()""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check 'NOT' operator without condition. test("OffHeapQuery-001-TC_053", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id NOT""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -593,29 +485,17 @@ test("OffHeapQuery-001-TC_054", Include) { //To check '>' operator without specifying column test("OffHeapQuery-001-TC_055", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where > 20""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '>' operator without specifying value test("OffHeapQuery-001-TC_056", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id > """).collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -648,15 +528,9 @@ test("OffHeapQuery-001-TC_059", Include) { //To check '<' operator without specifying column test("OffHeapQuery-001-TC_060", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where < 5""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -680,29 +554,17 @@ test("OffHeapQuery-001-TC_062", Include) { //To check '<=' operator without specifying column test("OffHeapQuery-001-TC_063", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where <= 2""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '<=' operator without providing value test("OffHeapQuery-001-TC_064", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id <= """).collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -717,29 +579,17 @@ test("OffHeapQuery-001-TC_065", Include) { //To check '<=' operator adding space between'<' and '=' test("OffHeapQuery-001-TC_066", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id < = 9002""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check 'BETWEEN' operator without providing range test("OffHeapQuery-001-TC_067", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where age between""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -799,29 +649,17 @@ test("OffHeapQuery-001-TC_073", Include) { //To check 'IS NULL' without providing column test("OffHeapQuery-001-TC_074", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where Is NulL""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check 'IS NOT NULL' without providing column test("OffHeapQuery-001-TC_075", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where IS NOT NULL""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -854,29 +692,17 @@ test("OffHeapQuery-001-TC_078", Include) { //To check Limit clause with where condition and no argument test("OffHeapQuery-001-TC_079", Include) { - try { - + intercept[Exception] { 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("OffHeapQuery-001-TC_080", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 where cust_id=10987 limit 0.0""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -927,15 +753,9 @@ test("OffHeapQuery-001-TC_085", Include) { //To check Full join test("OffHeapQuery-001-TC_086", Include) { - try { - + intercept[Exception] { sql(s"""select uniqdataquery1.CUST_ID from uniqdataquery1 FULL JOIN uniqdataquery11 where CUST_ID""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1022,15 +842,9 @@ test("OffHeapQuery-001-TC_096", Include) { //To check SORT using 'AND' on multiple column test("OffHeapQuery-001-TC_097", Include) { - try { - + intercept[Exception] { 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) } - } @@ -1054,15 +868,9 @@ test("OffHeapQuery-001-TC_099", Include) { //To check average aggregate function with no arguments test("OffHeapQuery-001-TC_100", Include) { - try { - + intercept[Exception] { sql(s"""select cust_id,avg() from uniqdataquery1 group by cust_id""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1077,15 +885,9 @@ test("OffHeapQuery-001-TC_101", Include) { //To check nested average aggregate function test("OffHeapQuery-001-TC_102", Include) { - try { - + intercept[Exception] { sql(s"""select cust_id,avg(count(cust_id)) from uniqdataquery1 group by cust_id""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1172,15 +974,9 @@ test("OffHeapQuery-001-TC_108", Include) { //To check Order by without column name test("OffHeapQuery-001-TC_112", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery1 order by ASC""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1222,15 +1018,9 @@ test("OffHeapQuery-001-TC_108", Include) { //To check Using window without partition test("OffHeapQuery-001-TC_117", Include) { - try { - + intercept[Exception] { sql(s"""select cust_name, sum(bigint_column1) OVER w from uniqdataquery1 WINDOW w""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1245,13 +1035,8 @@ test("OffHeapQuery-001-TC_108", Include) { //To check Using ROLLUP without group by clause test("OffHeapQuery-001-TC_119", Include) { - try { - + intercept[Exception] { sql(s"""select cust_name from uniqdataquery1 with ROLLUP""").collect - - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table uniqdataquery1""").collect } http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/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 index 10a9866..888070f 100644 --- 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 @@ -44,15 +44,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check select query with limit as string test("OffHeapQuery-002-TC_121", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 limit """"").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -112,57 +106,33 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check where clause with OR and no operand test("OffHeapQuery-002-TC_128", Include) { - try { - + intercept[Exception] { 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("OffHeapQuery-002-TC_129", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where OR """).collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check OR clause with LHS having no arguments test("OffHeapQuery-002-TC_130", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where OR cust_id > "1"""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check incorrect query test("OffHeapQuery-002-TC_132", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id > 0 OR name """).collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -231,15 +201,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check select count and distinct query execution test("OffHeapQuery-002-TC_140", Include) { - try { - + intercept[Exception] { sql(s"""select count(cust_id),distinct(cust_name) from uniqdataquery2""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -281,15 +245,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check query execution with IN operator without paranthesis test("OffHeapQuery-002-TC_146", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id IN 9000,9005""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -304,15 +262,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check query execution with IN operator with out specifying any field. test("OffHeapQuery-002-TC_148", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where IN(1,2)""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -354,15 +306,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check AND with using booleans in invalid syntax test("OffHeapQuery-002-TC_153", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where AND true""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -386,15 +332,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check AND using 0 and 1 treated as boolean values test("OffHeapQuery-002-TC_156", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where true aNd 0""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -418,29 +358,17 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '='operator without Passing any value test("OffHeapQuery-002-TC_159", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id=""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '='operator without Passing columnname and value. test("OffHeapQuery-002-TC_160", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where =""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -455,15 +383,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '!='operator by keeping space between them test("OffHeapQuery-002-TC_162", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id ! = 9001""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -478,29 +400,17 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '!='operator without providing any value test("OffHeapQuery-002-TC_164", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id != """).collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '!='operator without providing any column name test("OffHeapQuery-002-TC_165", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where != false""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -542,43 +452,25 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check 'NOT' operator in nested way test("OffHeapQuery-002-TC_170", Include) { - try { - + intercept[Exception] { 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("OffHeapQuery-002-TC_171", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id NOT ()""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check 'NOT' operator without condition. test("OffHeapQuery-002-TC_172", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id NOT""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -593,29 +485,17 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '>' operator without specifying column test("OffHeapQuery-002-TC_174", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where > 20""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '>' operator without specifying value test("OffHeapQuery-002-TC_175", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id > """).collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -648,15 +528,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '<' operator without specifying column test("OffHeapQuery-002-TC_179", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where < 5""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -680,29 +554,17 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '<=' operator without specifying column test("OffHeapQuery-002-TC_182", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where <= 2""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check '<=' operator without providing value test("OffHeapQuery-002-TC_183", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id <= """).collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -717,13 +579,8 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check '<=' operator adding space between'<' and '=' test("OffHeapQuery-002-TC_185", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id < = 9002""").collect - - assert(false) - } catch { - case _ => assert(true) } } @@ -731,15 +588,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check 'BETWEEN' operator without providing range test("OffHeapQuery-002-TC_186", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where age between""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -799,29 +650,17 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check 'IS NULL' without providing column test("OffHeapQuery-002-TC_193", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where Is NulL""").collect - - assert(false) - } catch { - case _ => assert(true) } - } //To check 'IS NOT NULL' without providing column test("OffHeapQuery-002-TC_194", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where IS NOT NULL""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -854,29 +693,17 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check Limit clause with where condition and no argument test("OffHeapQuery-002-TC_198", Include) { - try { - + intercept[Exception] { 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("OffHeapQuery-002-TC_199", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 where cust_id=10987 limit 0.0""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -928,15 +755,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check Full join test("OffHeapQuery-002-TC_205", Include) { - try { - + intercept[Exception] { sql(s"""select uniqdataquery2.CUST_ID from uniqdataquery2 FULL JOIN uniqdataquery22 where CUST_ID""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1023,15 +844,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check SORT using 'AND' on multiple column test("OffHeapQuery-002-TC_216", Include) { - try { - + intercept[Exception] { 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) } - } @@ -1055,15 +870,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check average aggregate function with no arguments test("OffHeapQuery-002-TC_219", Include) { - try { - + intercept[Exception] { sql(s"""select cust_id,avg() from uniqdataquery2 group by cust_id""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1078,15 +887,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check nested average aggregate function test("OffHeapQuery-002-TC_221", Include) { - try { - + intercept[Exception] { sql(s"""select cust_id,avg(count(cust_id)) from uniqdataquery2 group by cust_id""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1173,15 +976,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check Order by without column name test("OffHeapQuery-002-TC_231", Include) { - try { - + intercept[Exception] { sql(s"""select * from uniqdataquery2 order by ASC""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1223,15 +1020,9 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check Using window without partition test("OffHeapQuery-002-TC_236", Include) { - try { - + intercept[Exception] { sql(s"""select cust_name, sum(bigint_column1) OVER w from uniqdataquery2 WINDOW w""").collect - - assert(false) - } catch { - case _ => assert(true) } - } @@ -1246,13 +1037,8 @@ class OffheapQuery2TestCase extends QueryTest with BeforeAndAfterAll { //To check Using ROLLUP without group by clause test("OffHeapQuery-002-TC_238", Include) { - try { - + intercept[Exception] { sql(s"""select cust_name from uniqdataquery2 with ROLLUP""").collect - - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table uniqdataquery2""").collect } http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/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 index 44287a2..b1cafee 100644 --- 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 @@ -74,13 +74,10 @@ class OffheapSort1TestCase extends QueryTest with BeforeAndAfterAll { //To load data after setting offheap memory in carbon property file without folder path in load test("OffHeapSort_001-TC_004", Include) { - try { + intercept[Exception] { 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 @@ -90,13 +87,10 @@ class OffheapSort1TestCase extends QueryTest with BeforeAndAfterAll { //To load data after setting offheap memory in carbon property file without table_name in load test("OffHeapSort_001-TC_005", Include) { sql(s"""drop table if exists uniqdata14""").collect - try { + intercept[Exception] { 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 http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort2TestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort2TestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort2TestCase.scala index b21ec20..21c74c9 100644 --- a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort2TestCase.scala +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/OffheapSort2TestCase.scala @@ -70,14 +70,11 @@ class OffheapSort2TestCase extends QueryTest with BeforeAndAfterAll { //To load data after setting offheap memory in carbon property file without folder path in load test("OffHeapSort_002-TC_018", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata213""").collect sql(s"""CREATE TABLE uniqdata213 (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 uniqdata213 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 uniqdata213""").collect @@ -87,14 +84,11 @@ class OffheapSort2TestCase extends QueryTest with BeforeAndAfterAll { //To load data after setting offheap memory in carbon property file without table_name in load test("OffHeapSort_002-TC_019", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata214""").collect sql(s"""CREATE TABLE uniqdata214 (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 uniqdata214""").collect http://git-wip-us.apache.org/repos/asf/carbondata/blob/3dff273b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PartitionTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PartitionTestCase.scala b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PartitionTestCase.scala index b89c353..31ec14e 100644 --- a/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PartitionTestCase.scala +++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/PartitionTestCase.scala @@ -31,12 +31,9 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if column in partitioned by is already specified in table schema test("Partition-Local-sort_TC001", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (INTEGER_COLUMN1 int)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='List','LIST_INFO'='1,3')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -60,38 +57,31 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if List info is not given with List type partition test("Partition-Local-sort_TC004", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='List')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } - //Verify exception if Partition type is not given + //exception should not be thrown if Partition type is not given test("Partition-Local-sort_TC005", Include) { try { - sql(s"""drop table if exists uniqdata""").collect + sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('LIST_INFO'='1,2')""").collect - assert(false) + sql(s"""drop table if exists uniqdata""").collect } catch { - case _ => assert(true) + case _ => assert(false) } - sql(s"""drop table if exists uniqdata""").collect } //Verify exception if Partition type is 'range' and LIST_INFO Is provided test("Partition-Local-sort_TC006", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB timestamp, BIGINT_COLUMN1 bigint,BIGINT_COLUMN2 bigint,DECIMAL_COLUMN1 decimal(30,10), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='RANGE', 'LIST_INFO'='1,2')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -99,12 +89,9 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if Partition type is 'range' and NUM_PARTITIONS Is provided test("Partition-Local-sort_TC007", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='RANGE', 'NUM_PARTITIONS'='1')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -128,12 +115,9 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if Partition type is 'LIST' and NUM_PARTITIONS Is provided test("Partition-Local-sort_TC010", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ int)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'NUM_PARTITIONS'='1')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -141,12 +125,9 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if Partition type is 'LIST' and RANGE_INFO Is provided test("Partition-Local-sort_TC011", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'RANGE_INFO'='20160302,20150302')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -154,12 +135,9 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if datatype is not provided with partition column test("Partition-Local-sort_TC012", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='20160302,20150302')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -167,28 +145,23 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if a non existent file header is provided in partition test("Partition-Local-sort_TC013", Include) { - try { - sql(s"""drop table if exists uniqdata""").collect - sql(s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='20160302,20150302') + intercept[Exception] { + sql(s"""drop table if exists uniqdata""").collect + sql( + s"""CREATE TABLE uniqdata (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (DOJ timestamp)STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='20160302,20150302') LOAD DATA INPATH '$resourcesPath/Data/partition/2000_UniqData_partition.csv' into table uniqdata OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','FILEHEADER'='CUST_NAME,ACTIVE_EMUI_VERSION,DOJ,DOB,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1,DOJ,CUST_ID')""").collect - assert(false) - } catch { - case _ => assert(true) } - sql(s"""drop table if exists uniqdata""").collect + sql(s"""drop table if exists uniqdata""").collect } //Verify exception if Partition By Is empty test("Partition-Local-sort_TC014", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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, DOJ timestamp) PARTITIONED BY ()STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='0,1') """).collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -235,13 +208,10 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception if 2 partition columns are provided test("Partition-Local-sort_TC018", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s""" CREATE TABLE uniqdata (CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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) PARTITIONED BY (CUST_ID int , DOJ timestamp) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='0,1')""").collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect } @@ -384,16 +354,13 @@ class PartitionTestCase extends QueryTest with BeforeAndAfterAll { //Verify exception is thrown if partition column is dropped test("Partition-Local-sort_TC029", Include) { - try { + intercept[Exception] { sql(s"""drop table if exists uniqdata""").collect sql(s"""CREATE TABLE uniqdata (CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB 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, DOJ timestamp) PARTITIONED BY (CUST_ID int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('PARTITION_TYPE'='LIST', 'LIST_INFO'='0,1') alter table uniqdata drop columns(CUST_ID) """).collect - assert(false) - } catch { - case _ => assert(true) } sql(s"""drop table if exists uniqdata""").collect }