Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADAM-1459] Don't split FASTQ when compressed. #1460

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

import java.io.EOFException;
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.CompressionCodecFactory;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
Expand All @@ -43,6 +47,21 @@
*/
public final class InterleavedFastqInputFormat extends FileInputFormat<Void, Text> {

/**
* For now, we do not support splittable compression codecs. As in, we will
* read the compressed data, but we will not allow it to be splittable. We
* will fix this in #1457.
*
* @param context The job context to get the configuration from.
* @param filename The path the input file is saved at.
* @return Returns false if this file is compressed.
*/
@Override protected boolean isSplitable(JobContext context, Path filename) {
Configuration conf = context.getConfiguration();
final CompressionCodec codec = new CompressionCodecFactory(context.getConfiguration()).getCodec(filename);
return (codec == null);
}

/**
* A record reader for the interleaved FASTQ format.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

import java.io.EOFException;
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.CompressionCodecFactory;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
Expand All @@ -35,6 +39,21 @@
*/
public final class SingleFastqInputFormat extends FileInputFormat<Void, Text> {

/**
* For now, we do not support splittable compression codecs. As in, we will
* read the compressed data, but we will not allow it to be splittable. We
* will fix this in #1457.
*
* @param context The job context to get the configuration from.
* @param filename The path the input file is saved at.
* @return Returns false if this file is compressed.
*/
@Override protected boolean isSplitable(JobContext context, Path filename) {
Configuration conf = context.getConfiguration();
final CompressionCodec codec = new CompressionCodecFactory(context.getConfiguration()).getCodec(filename);
return (codec == null);
}

/**
* A record reader for the standard FASTQ format.
*
Expand Down