You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by jackylk <gi...@git.apache.org> on 2017/09/07 05:23:55 UTC

[GitHub] carbondata pull request #1337: [CARBONDATA-1445] Fix update fail when carbon...

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

    https://github.com/apache/carbondata/pull/1337#discussion_r137448549
  
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala ---
    @@ -448,6 +448,40 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
         sql("DROP TABLE IF EXISTS default.carbon1")
       }
     
    +  test("""CARBONDATA-1445 carbon.update.persist.enable=false it will fail to update data""") {
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.isPersistEnabled, "false")
    +    import sqlContext.implicits._
    +    val df = sqlContext.sparkContext.parallelize(0 to 50)
    +      .map(x => ("a", x.toString, (x % 2).toString, x, x.toLong, x * 2))
    +      .toDF("stringField1", "stringField2", "stringField3", "intField", "longField", "int2Field")
    +    sql("DROP TABLE IF EXISTS default.study_carbondata ")
    +    sql(s""" CREATE TABLE IF NOT EXISTS default.study_carbondata (
    +           |    stringField1          string,
    +           |    stringField2          string,
    +           |    stringField3          string,
    +           |    intField              int,
    +           |    longField             bigint,
    +           |    int2Field             int) STORED BY 'carbondata'""".stripMargin)
    +    df.write
    +      .format("carbondata")
    +      .option("tableName", "study_carbondata")
    +      .option("compress", "true")  // just valid when tempCSV is true
    +      .option("tempCSV", "false")
    +      .option("single_pass", "true")
    +      .option("sort_scope", "LOCAL_SORT")
    +      .mode(SaveMode.Append)
    +      .save()
    +    sql("""
    +      UPDATE default.study_carbondata a
    --- End diff --
    
    Please add assert to check the updated value


---