Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1914#discussion_r165809266
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordActionTest.scala
 ---
    @@ -92,6 +92,65 @@ 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 REDIRECT but not having empty location in option 
should throw exception") {
    +    
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,
    +      CarbonCommonConstants.CARBON_BADRECORDS_LOC_DEFAULT_VAL)
    +    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'= '\"')")
    +    }
    +    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")
    --- End diff --
    
    Change /tmp to resourcesPath  in all your test cases


---

Reply via email to