String path = variables.parse(rawBasePath, false);
String id = repository.getRelatedId(path);
OutputAttemptContext outputContext = HadoopDataSourceUtil.createContext(context, id);
DataFormat<? super T> format = ReflectionUtils.newInstance(dataFormatClass, context.getConfiguration());
DirectDataSource datasource = repository.getRelatedDataSource(path);
String basePath = repository.getComponentPath(path);
String unresolvedResourcePath = rawResourcePath.replaceAll(
Pattern.quote("*"),
String.format("%04d", context.getTaskAttemptID().getTaskID().getId()));
String resourcePath = variables.parse(unresolvedResourcePath);
DataDefinition<? super T> definition = SimpleDataDefinition.newInstance(dataType, format);
if (log.isDebugEnabled()) {
log.debug(MessageFormat.format(
"Open mapper output (id={0}, basePath={1}, resourcePath={2})",
id,
basePath,
resourcePath));
}
int records = 0;
ModelOutput<? super T> output = datasource.openOutput(
outputContext,
definition,
basePath,
resourcePath,
outputContext.getCounter());