Created
September 1, 2021 05:50
-
-
Save kougazhang/e7731d986224ced084337154a7b8e3a1 to your computer and use it in GitHub Desktop.
#java #flink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.flink.api.java.io.TextOutputFormat; | |
import org.apache.flink.core.fs.Path; | |
import java.io.IOException; | |
public class GZIPOutputFormat<T> extends TextOutputFormat<T> { | |
public GZIPOutputFormat(Path outputPath) { | |
super(outputPath); | |
} | |
@Override | |
public void open(int taskNumber, int numTasks) throws IOException { | |
super.open(taskNumber, numTasks); | |
// wrap gzip | |
this.stream = new GZIPWrappedStream(this.stream, 4096, false); | |
} | |
} |
Author
kougazhang
commented
Sep 1, 2021
// usage
sorted.write(new GZIPOutputFormat<>(new Path(jobKey.dest_path)), jobKey.dest_path, FileSystem.WriteMode.OVERWRITE);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment