You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@crunch.apache.org by "Gabriel Reid (JIRA)" <ji...@apache.org> on 2014/03/23 10:52:43 UTC

[jira] [Commented] (CRUNCH-369) Crunch doesn't use custom getSplits functions of FileInputFormat subclasses

    [ https://issues.apache.org/jira/browse/CRUNCH-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13944393#comment-13944393 ] 

Gabriel Reid commented on CRUNCH-369:
-------------------------------------

I think this is indeed a use case we should support, but I'd rather not do a direct check on the FileInputFormat class. How about overloading From#formattedFile to take a boolean to specify that the combine format should be disabled?

> Crunch doesn't use custom getSplits functions of FileInputFormat subclasses
> ---------------------------------------------------------------------------
>
>                 Key: CRUNCH-369
>                 URL: https://issues.apache.org/jira/browse/CRUNCH-369
>             Project: Crunch
>          Issue Type: Bug
>          Components: IO
>    Affects Versions: 0.9.0
>            Reporter: Jeremy Lewi
>            Priority: Minor
>
> Suppose I create a source for a custom InputFormat which is a subclass of FileInputFormat; e.g.
> TableSource<LongWritable, FastQWritable> source = From.formattedFile(
>      inputFile, FastQInputFormatNew.class, LongWritable.class,
>       FastQWritable.class);
> where FastQInputFormat is a subclass of FileInputFormat.
> This won't work as expected because by default CrunchInputFormat.getSplits will end up using CrunchCombineFileInputFormat to split the file. This doesn't work because my custom FIleInputFormat uses a custom file splitter.
> I can work around this by explicitly disabling the combining: e.g
> source.inputConf(RuntimeParameters.DISABLE_COMBINE_FILE, Boolean.TRUE.toString());
> but this doesn't strike me as the best solution. If I tell Crunch to use a custom InputFormat I shouldn't have to specify a second config option in order to tell Crunch to respect the getSplits function in my custom InputFormat.
> I think CrunchInputFormat.getSplits should check that the format class exactly matches FileInputFormat; i.e. it isn't a subclass. For subclasses Crunch should use the getsplits function in the custom InputFormat class. I think changing the check to the following might work
> if (format.getClass().equals(FileInputFormat.class) &&
>     !conf.getBoolean(RuntimeParameters.DISABLE_COMBINE_FILE, true) 



--
This message was sent by Atlassian JIRA
(v6.2#6252)