hudi-agent commented on code in PR #19202:
URL: https://github.com/apache/hudi/pull/19202#discussion_r3584913003
##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/ITTestHoodieDataSource.java:
##########
@@ -4275,6 +4336,32 @@ private static boolean
containsReadNextRowGroupFrame(Throwable t) {
return false;
}
+ /**
+ * True for a real {@link NoSuchElementException} as well as one wrapped in
Flink's
+ * {@code SerializedThrowable} when the failure is propagated back from the
cluster (its
+ * {@code toString()} preserves the original {@code
java.util.NoSuchElementException} prefix).
+ */
+ private static boolean isNoSuchElementException(Throwable t) {
+ return t instanceof NoSuchElementException
+ || t.toString().startsWith(NoSuchElementException.class.getName());
+ }
+
+ /**
+ * Whether {@code t}'s stack trace (preserved even through {@code
SerializedThrowable}) contains a
+ * frame from one of the CDC read iterators that a teardown {@code close()}
can null out mid-drain -
+ * {@code CdcIterators$CdcFileSplitsIterator} or {@code
CdcIterators$BaseImageIterator}.
+ */
+ private static boolean containsCdcIteratorTeardownFrame(Throwable t) {
+ for (StackTraceElement frame : t.getStackTrace()) {
+ String className = frame.getClassName();
+ if
(className.contains(CdcIterators.CdcFileSplitsIterator.class.getName())
+ ||
className.contains(CdcIterators.BaseImageIterator.class.getName())) {
Review Comment:
🤖 nit: could you use `equals` instead of `contains` here? `class.getName()`
already returns the full binary name (e.g.
`org.apache.hudi.table.format.cdc.CdcIterators$CdcFileSplitsIterator`), which
matches `frame.getClassName()` exactly — `contains` gives no extra flexibility
but makes a future reader wonder whether the substring match is intentional.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]