Hello everyone, What is the correct way to run a o...
# troubleshooting
v
Hello everyone, What is the correct way to run a one-off Flink job without a sink? I’m trying to run an Iceberg rewrite data files action, which is fairly simple, something like this:
Copy code
public static void main(String[] args) throws Exception {
    var env = StreamExecutionEnvironment.getExecutionEnvironment();
    Actions.forTable(table).rewriteDataFiles().execute();
    env.execute();
}
Flink needs to have a data stream and a sink to work with. Under the hood of
rewriteDataFiles()
action there is a data stream created, but I don’t see the sink anywhere. This program will throw exceptions, but still perform the rewrite action. Since I’m using the Flink k8s operator, my Flink job pod keeps crashing. How do I make Flink gracefully finish the action? Thanks.
t
To run a one-off Flink job without a sink, consider adding a dummy sink, like a
DiscardingSink
, to satisfy Flink's requirement for a data stream to have an endpoint. Alternatively, you can use a custom source that emits a limited number of elements and completes, signaling Flink that the job has finished. Ensure your job's configuration aligns with its nature when using the Flink Kubernetes operator to prevent unnecessary restarts or crashes.
v
Thanks for your suggestion. That works. Also, I realised that
rewriteDataFiles().execute()
creates a data stream then call execute and collect under the hood.