[AMORO-3853] Support Java 17 and removing reflective/internal dependencies in Flink modules#4124
[AMORO-3853] Support Java 17 and removing reflective/internal dependencies in Flink modules#4124xxubai wants to merge 14 commits intoapache:masterfrom
Conversation
2ea94d3 to
b6c7e1c
Compare
…istency in time calculations
| watermarkOutput.emitPeriodicWatermark(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The reflection fallback block (lines 548-560) can be removed entirely.
SplitLocalOutput (the private inner class Flink returns from createOutputForSplit) is still registered in WatermarkOutputMultiplexer at the point releaseOutputForSplit is called — the split is not unregistered until internal.releaseOutputForSplit(splitId) returns. So calling watermarkOutput.emitPeriodicWatermark() at the reader level already covers this split: it iterates all currently-registered split outputs and computes the combined minimum watermark.
Suggested simplification:
private void emitPeriodicWatermark(SourceOutput<T> splitOutput) {
if (splitOutput == null) {
return;
}
if (splitOutput instanceof SourceOutputWithWatermarks) {
((SourceOutputWithWatermarks<T>) splitOutput).emitPeriodicWatermark();
return;
}
// splitOutput is an internal Flink type (e.g. SplitLocalOutput from
// ProgressiveTimestampsAndWatermarks) that does not expose
// SourceOutputWithWatermarks publicly. The reader-level call below is
// semantically equivalent: it iterates all registered split outputs
// (this split is still registered until internal.releaseOutputForSplit()
// returns) and flushes the combined periodic watermark.
watermarkOutput.emitPeriodicWatermark();
}This removes the setAccessible(true) call which is exactly the JDK-17 blocker this PR aims to fix.
There was a problem hiding this comment.
Thanks, good point. I removed the reflection fallback and simplified it to use watermarkOutput.emitPeriodicWatermark() directly
Why are the changes needed?
The mixed Flink modules still had several Java 17 blockers, including hard-coded build/toolchain settings, runtime failures caused by JDK proxy and module encapsulation, and brittle reflection against Flink private internals.
This patch makes the mixed Flink Java 17 path buildable, testable, and packageable again.
Close #3853.
Brief change log
How was this patch tested?
Test commands:
./mvnw -nsu -pl amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common -am test -DfailIfNoTests=false./mvnw -nsu -pl amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common,amoro-format-mixed/amoro-mixed-flink/v1.17/amoro-mixed-flink-1.17,amoro-format-mixed/amoro-mixed-flink/v1.18/amoro-mixed-flink-1.18 -am -DskipTests packageDocumentation