Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CARBONDATA-3980] Load fails with aborted exception when Bad records action is unspecified #3919

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -191,7 +191,12 @@ case class CarbonLoadDataCommand(databaseNameOp: Option[String],
if (isUpdateTableStatusRequired) {
CarbonLoaderUtil.updateTableStatusForFailure(carbonLoadModel, uuid)
}
throw ex
val errorMessage = operationContext.getProperty("Error message")
if (errorMessage != null) {
throw new RuntimeException(errorMessage.toString, ex.getCause)
} else {
throw ex
}
}
Seq.empty
}
Expand Down
Expand Up @@ -1064,6 +1064,7 @@ object CommonLoadUtils {
if (loadParams.updateModel.isDefined) {
CarbonScalaUtil.updateErrorInUpdateModel(loadParams.updateModel.get, executorMessage)
}
ShreelekhyaG marked this conversation as resolved.
Show resolved Hide resolved
loadParams.operationContext.setProperty("Error message", errorMessage)
LOGGER.info(errorMessage)
LOGGER.error(ex)
throw ex
Expand Down
Expand Up @@ -219,6 +219,25 @@ class StandardPartitionBadRecordLoggerTest extends QueryTest with BeforeAndAfter
}
}

test("test load with partition column having bad record value") {
sql("drop table if exists dataloadOptionTests")
sql("CREATE TABLE dataloadOptionTests (empno int, empname String, designation String, " +
"workgroupcategory int, workgroupcategoryname String, deptno int, projectjoindate " +
"Timestamp, projectenddate Date,attendance int,utilization int,salary int) PARTITIONED BY " +
"(deptname String,doj Timestamp,projectcode int) STORED AS carbondata ")
val csvFilePath = s"$resourcesPath/data.csv"
val ex = intercept[RuntimeException] {
sql("LOAD DATA local inpath '" + csvFilePath +
"' INTO TABLE dataloadOptionTests OPTIONS ('bad_records_action'='FAIL', 'DELIMITER'= '," +
"', 'QUOTECHAR'= '\"', 'dateformat'='DD-MM-YYYY','timestampformat'='DD-MM-YYYY')")
}
assert(ex.getMessage.contains(
"DataLoad failure: Data load failed due to bad record: The value with column name " +
"projectjoindate and column data type TIMESTAMP is not a valid TIMESTAMP type.Please " +
"enable bad record logger to know the detail reason."))
sql("drop table dataloadOptionTests")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please drop the table here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok


def drop(): Unit = {
sql("drop table IF EXISTS sales")
sql("drop table IF EXISTS serializable_values")
Expand Down