Kejian-Li commented on a change in pull request #3981: URL: https://github.com/apache/carbondata/pull/3981#discussion_r504458957
########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala ########## @@ -69,6 +69,60 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll { sql("""drop table iud.zerorows""") } + test("update and insert overwrite partition") { + sql("""drop table if exists iud.updateinpartition""") + sql( + """CREATE TABLE iud.updateinpartition (id STRING, sales INT) + | PARTITIONED BY (dtm STRING) + | STORED AS carbondata""".stripMargin) + sql( + s"""load data local + | inpath '$resourcesPath/IUD/updateinpartition.csv' into table updateinpartition""".stripMargin) + sql( + """update iud.updateinpartition u set (u.sales) = (u.sales + 1) where id='001'""".stripMargin) + sql( + """update iud.updateinpartition u set (u.sales) = (u.sales + 2) where id='011'""".stripMargin) + + // delete data from a partition, make sure the update executed before still works. + sql("""delete from updateinpartition where dtm=20200908 and id='012'""".stripMargin) + checkAnswer( + sql("""select sales from iud.updateinpartition where id='001'""".stripMargin), Seq(Row(1)) + ) + checkAnswer( + sql("""select sales from iud.updateinpartition where id='011'""".stripMargin), Seq(Row(2)) + ) + checkAnswer( + sql("""select sales from iud.updateinpartition where id='012'""".stripMargin), Seq() + ) + + // insert overwrite a partition. make sure the update executed before still works. + sql( + """insert overwrite table iud.updateinpartition + | partition (dtm=20200908) + | select * from iud.updateinpartition where dtm = 20200907""".stripMargin) + checkAnswer( + sql( + """select sales from iud.updateinpartition + | where dtm=20200908 and id='001'""".stripMargin), Seq(Row(1)) + ) + checkAnswer( + sql( + """select sales from iud.updateinpartition + | where dtm=20200908 and id='001'""".stripMargin), Seq(Row(1)) + ) Review comment: Are they duplicated? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org