Skip to content

Commit

Permalink
Problem: When bad records action is set to fail and any IUD operation…
Browse files Browse the repository at this point in the history
… is executed and it fails due to bad records error message is not displayed correctly because of which user is not clear with the cause of update operation failure. Whereas in the same case in other operations like data load and insert into, if there is any failure due to bad record proper error message is displayed to the user for failure due to bad record.

Fix: Instead of forming own message get the executor failure message and send it to update operation as exception message.
  • Loading branch information
manishgupta88 committed May 11, 2017
1 parent 36ecb37 commit 822363f
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 822363f

Please sign in to comment.