Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.2-alpha
-
None
-
Reviewed
Description
From Muddy Dixon on HADOOP-8449:
Hi
We found the changes in order of switch and guard block in
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException
Because of this change, return value of
codec.createInputStream(i)
is changed if codec exists.
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException { FSDataInputStream i = srcFs.open(p); // check codecs CompressionCodecFactory cf = new CompressionCodecFactory(getConf()); CompressionCodec codec = cf.getCodec(p); if (codec != null) { return codec.createInputStream(i); } switch(i.readShort()) { // cases }
New:
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException { FSDataInputStream i = srcFs.open(p); switch(i.readShort()) { // <=== index (or pointer) processes!! // cases default: { // Check the type of compression instead, depending on Codec class's // own detection methods, based on the provided path. CompressionCodecFactory cf = new CompressionCodecFactory(getConf()); CompressionCodec codec = cf.getCodec(p); if (codec != null) { return codec.createInputStream(i); } break; } } // File is non-compressed, or not a file container we know. i.seek(0); return i; }
Fix is to use i.seek(0) before we use i anywhere. I missed that.
Attachments
Attachments
Issue Links
- is broken by
-
HADOOP-8449 hadoop fs -text fails with compressed sequence files with the codec file extension
- Closed