ashokkumar-allu commented on code in PR #18585:
URL: https://github.com/apache/hudi/pull/18585#discussion_r3406777058


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/validator/SparkPreCommitValidator.java:
##########
@@ -82,6 +82,11 @@ public void validate(String instantTime, 
HoodieWriteMetadata<O> writeResult, Dat
     HoodieTimer timer = HoodieTimer.start();
     try {
       validateRecordsBeforeAndAfter(before, after, 
getPartitionsModified(writeResult));
+    } catch (HoodieValidationException e) {
+      throw e;
+    } catch (Exception e) {

Review Comment:
   Great catch — this was unintentional. Fixed via your option 2.
   
   `validate()` now has three catch blocks:
   1. `catch (HoodieValidationException e)` → re-throws as-is (legitimate 
validation failure)
   2. `catch (RuntimeException e)` → re-throws as-is (validator bug: NPE, 
ClassCastException, etc.) — propagates crash-loud with the original stack trace
   3. `catch (Exception e)` → promotes to `RuntimeException` (checked exception 
from validator — also crash-loud)
   
   This means `runValidator()` (which only catches `HoodieValidationException`) 
now lets unexpected exceptions propagate through 
`ExecutorServiceBasedEngineContext.map()` and up to the write client, so the 
operator sees the original exception rather than a generic "At least one 
pre-commit validation failed" message.
   
   Also added `testUnexpectedValidatorExceptionIsNotSilenced` in 
`TestSparkValidatorUtils` — a `BuggyValidator` that throws 
`IllegalStateException` and asserts the original exception appears in the cause 
chain (not buried under a generic validation message). Updated 
`TestSparkPreCommitValidator.testValidateRethrowsUnexpectedRuntimeException` to 
assert `assertSame(cause, ex)` — the original `RuntimeException` is re-thrown 
directly.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to