Gervais Mickaël created HDFS-10393:
--------------------------------------
Summary: Unable to append to a SequenceFile with Compression.NONE.
Key: HDFS-10393
URL: https://issues.apache.org/jira/browse/HDFS-10393
Project: Hadoop HDFS
Issue Type: Bug
Components: hdfs-client
Affects Versions: 2.7.2
Reporter: Gervais Mickaël
Priority: Critical
Hi,
I'm trying to use the append functionnality to an existing _SequenceFile_.
If I set _Compression.NONE_, it works when the file is created, but when the
file already exists I've a _NullPointerException_, by the way it works if I
specify a compression with a codec.
{code:title=Failing code|borderStyle=solid}
Option compression = compression(CompressionType.NONE);
Option keyClass = keyClass(LongWritable.class);
Option valueClass = valueClass(BytesWritable.class);
Option out = file(dfs);
Option append = appendIfExists(true);
writer = createWriter(conf,
out,
append,
compression,
keyClass,
valueClass);
{code}
The following exeception is thrown when the file exists because compression
option is checked:
{code}
Exception in thread "main" java.lang.NullPointerException
at
org.apache.hadoop.io.SequenceFile$Writer.<init>(SequenceFile.java:1119)
at org.apache.hadoop.io.SequenceFile.createWriter(SequenceFile.java:273)
{code}
This is due to the *codec* which is _null_:
{code:title=SequenceFile.java|borderStyle=solid}
if (readerCompressionOption.value != compressionTypeOption.value
|| !readerCompressionOption.codec.getClass().getName()
.equals(compressionTypeOption.codec.getClass().getName())) {
throw new IllegalArgumentException(
"Compression option provided does not match the file");
}
{code}
Thansk
Mickaël
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]