You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Vinayakumar B (JIRA)" <ji...@apache.org> on 2016/05/12 10:12:12 UTC

[jira] [Updated] (HADOOP-13138) Unable to append to a SequenceFile with Compression.NONE.

     [ https://issues.apache.org/jira/browse/HADOOP-13138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vinayakumar B updated HADOOP-13138:
-----------------------------------
    Attachment: HADOOP-13138-01.patch

Attaching the patch for the above Problem.

Thanks [~mgervais] for reporting the issue.

> Unable to append to a SequenceFile with Compression.NONE.
> ---------------------------------------------------------
>
>                 Key: HADOOP-13138
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13138
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>            Reporter: Gervais Mickaël
>            Assignee: Vinayakumar B
>            Priority: Critical
>         Attachments: HADOOP-13138-01.patch
>
>
> 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: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org