Skip to content

Commit

Permalink
[CARBONDATA-1045] Mismatch in message display with insert and load op…
Browse files Browse the repository at this point in the history
…eration on failure due to bad records in update operation. This closes #904
  • Loading branch information
ravipesala committed May 11, 2017
2 parents 36ecb37 + 822363f commit 35b23c9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
@@ -0,0 +1,2 @@
item,name
2,Apple
Expand Up @@ -826,7 +826,11 @@ object CarbonDataRDDFactory {
// updateModel.get.executorErrors.errorMsg = errorMessage
if (updateModel.get.executorErrors.failureCauses == FailureCauses.NONE) {
updateModel.get.executorErrors.failureCauses = FailureCauses.EXECUTOR_FAILURE
updateModel.get.executorErrors.errorMsg = "Update failed as the data load has failed."
if (null != executorMessage && !executorMessage.isEmpty) {
updateModel.get.executorErrors.errorMsg = executorMessage
} else {
updateModel.get.executorErrors.errorMsg = "Update failed as the data load has failed."
}
}
return
}
Expand Down
Expand Up @@ -365,6 +365,24 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
}
}

test("Failure of update operation due to bad record with proper error message") {
try {
CarbonProperties.getInstance()
.addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, "FAIL")
val errorMessage = intercept[Exception] {
sql("drop table if exists update_with_bad_record")
sql("create table update_with_bad_record(item int, name String) stored by 'carbondata'")
sql(s"LOAD DATA LOCAL INPATH '$resourcesPath/IUD/bad_record.csv' into table " +
s"update_with_bad_record")
sql("update update_with_bad_record set (item)=(3.45)").show()
sql("drop table if exists update_with_bad_record")
}
assert(errorMessage.getMessage.contains("Data load failed due to bad record"))
} finally {
CarbonProperties.getInstance()
.addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION, "FORCE")
}
}

override def afterAll {
sql("use default")
Expand Down

0 comments on commit 35b23c9

Please sign in to comment.