Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1914#discussion_r165675863
--- Diff:
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordActionTest.scala
---
@@ -92,6 +92,44 @@ class BadRecordActionTest extends QueryTest with
BeforeAndAfterAll {
Seq(Row(2)))
}
+ test("test bad record REDIRECT but not having location should throw
exception"){
+ sql("drop table if exists sales")
+ sql(
+ """CREATE TABLE IF NOT EXISTS sales(ID BigInt, date Timestamp,
country String,
+ actual_price Double, Quantity int, sold_price Decimal(19,2))
STORED BY 'carbondata'""")
+ val exMessage = intercept[Exception]{
+ sql("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE sales
OPTIONS" +
+ "('bad_records_action'='REDIRECT', 'DELIMITER'=" +
+ " ',', 'QUOTECHAR'= '\"', 'BAD_RECORD_PATH'='')")
+ }
+ assert(exMessage.getMessage.contains("Invalid bad records location."))
+ }
+
+ test("test bad record is REDIRECT with location in carbon properties
should pass"){
+ sql("drop table if exists sales")
+
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,"/tmp")
+ sql("drop table if exists sales")
+ sql(
+ """CREATE TABLE IF NOT EXISTS sales(ID BigInt, date Timestamp,
country String,
+ actual_price Double, Quantity int, sold_price Decimal(19,2))
STORED BY 'carbondata'""")
+ sql("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE sales
OPTIONS" +
+ "('bad_records_action'='REDIRECT', 'DELIMITER'=" +
+ " ',', 'QUOTECHAR'= '\"')")
+ }
+
+ test("test bad record is redirect with location in option while data
loading should pass"){
+ sql("drop table if exists sales")
+
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,"")
--- End diff --
Instead of quotes use the default value from CarboNCommonConsstants
---