In Flink, how to write DataStream to single file?
<p>The <code>writeAsText</code> or <code>writeAsCsv</code> methods of a <code>DataStream</code> write as many files as worker threads. As far as I could see, the methods only let you specify the path to these files and some formatting.</p>

<p>For debugging and testing purposes, it would be really useful to be able to print everything to a single file, without having to change the set up to having a single worker thread.</p>

<p>Is there any non-overly-complicated way to achieve this? I suspect it should be possible implementing a custom <code>SinkFunction</code>, but not sure about that one (besides, it also feels like a hassle for something that seems relatively simple).</p>