carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishgupta88 <...@git.apache.org>
Subject [GitHub] carbondata pull request #1082: [CARBONDATA-1218] [GLOBAL SORT] In case of da...
Date Thu, 04 Jan 2018 06:22:55 GMT
Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1082#discussion_r159584326
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordLoggerTest.scala
---
    @@ -247,6 +248,33 @@ class BadRecordLoggerTest extends QueryTest with BeforeAndAfterAll
{
         }
       }
     
    +  test(
    +    "test if first load failed due to bad record then second load should not failed if
there is " +
    +    "no bad record") {
    +    sql("drop table IF EXISTS loadIssue")
    +    sql("""CREATE TABLE IF NOT EXISTS loadIssue(ID BigInt, item String) STORED BY 'carbondata'""")
    +    CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION,
    +      "FAIL").addProperty(CarbonCommonConstants.LOAD_SORT_SCOPE, "GLOBAL_SORT")
    +    try {
    +      sql("insert into loadIssue select 'x','Book'");
    +    } catch {
    +      case ex: Exception =>
    +        assert(true)
    +    }
    +    try {
    +      sql("insert into loadIssue select 1,'Book'");
    +    } catch {
    +      case ex: Exception =>
    +        assert(false)
    +    } finally {
    +      CarbonProperties.getInstance()
    +        .addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, "FORCE")
    +        .addProperty(CarbonCommonConstants.LOAD_SORT_SCOPE, "LOCAL_SORT")
    +    }
    +    assert(true)
    +    sql("drop table IF EXISTS loadIssue")
    +  }
    +
    --- End diff --
    
    1. Use only one try and finally block inside test code..try should start from first line
and end at last and finally should only reset the carbon property
    2. Instead of try catch use intercept[Exception] only for the 1st case where exception
is expected. For 2nd case try catch is not required...if exception comes anyways test case
will fail


---

Mime
View raw message