@ SuppressWarnings ( "unchecked" ) private static < E > Dataset < E > loadOrCreateJobDataset ( JobContext jobContext ) { Dataset < Object > dataset = load ( jobContext ) . getDataset ( ) ; String jobDatasetName = getJobDatasetName ( jobContext ) ; DatasetRepository repo = getDatasetRepository ( jobContext ) ; if ( repo . exists ( TEMP_NAMESPACE , jobDatasetName ) ) { Dataset < E > tempDataset = repo . load ( TEMP_NAMESPACE , jobDatasetName , DatasetKeyOutputFormat . < E > getType ( jobContext ) ) ; try { Compatibility . checkCompatible ( dataset . getDescriptor ( ) , tempDataset . getDescriptor ( ) ) ; return tempDataset ; } catch ( RuntimeException ex ) { // swallow } } return repo . create ( TEMP_NAMESPACE , jobDatasetName , copy ( dataset . getDescriptor ( ) ) , DatasetKeyOutputFormat . < E > getType ( jobContext ) ) ; }
The job dataset may already exist if the ApplicationMaster was restarted