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

    https://github.com/apache/carbondata/pull/1914#discussion_r165675592
  
    --- 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'= '\"')")
    --- End diff --
    
    1. Put the test case in try and finally block
    2. Add the bad store path in try and in finally rest the path to default



---

Reply via email to