diff --git a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java index faa7ff67b2693..8df6a212cbdd3 100644 --- a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java +++ b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java @@ -241,14 +241,11 @@ public void write(GenericRecord oldRecord) { if (copyOldRecord) { // this should work as it is, since this is an existing record - String errMsg = "Failed to merge old record into new file for key " + key + " from old file " + getOldFilePath() - + " to new file " + newFilePath + " with writerSchema " + writerSchemaWithMetafields.toString(true); try { fileWriter.writeAvro(key, oldRecord); - } catch (ClassCastException e) { - LOG.debug("Old record is " + oldRecord); - throw new HoodieUpsertException(errMsg, e); } catch (IOException | RuntimeException e) { + String errMsg = String.format("Failed to merge old record into new file for key %s from old file %s to new file %s with writerSchema %s", + key, getOldFilePath(), newFilePath, writerSchemaWithMetafields.toString(true)); LOG.debug("Old record is " + oldRecord); throw new HoodieUpsertException(errMsg, e); }