Java Code Examples for org.apache.hadoop.mapreduce.MapContext#write()

The following examples show how to use org.apache.hadoop.mapreduce.MapContext#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RasterTileResizeMapper.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
protected void mapNativeValue(
    final GeoWaveInputKey key,
    final GridCoverage value,
    final MapContext<GeoWaveInputKey, GridCoverage, GeoWaveInputKey, Object> context)
    throws IOException, InterruptedException {
  if (helper.isOriginalCoverage(key.getInternalAdapterId())) {
    final InternalDataAdapter<?> adapter =
        super.serializationTool.getInternalAdapter(key.getInternalAdapterId());
    if ((adapter != null)
        && (adapter.getAdapter() != null)
        && (adapter.getAdapter() instanceof RasterDataAdapter)) {
      final Iterator<GridCoverage> coverages = helper.getCoveragesForIndex(value);
      if (coverages == null) {
        LOGGER.error("Couldn't get coverages instance, getCoveragesForIndex returned null");
        throw new IOException(
            "Couldn't get coverages instance, getCoveragesForIndex returned null");
      }
      while (coverages.hasNext()) {
        final GridCoverage c = coverages.next();
        // it should be a FitToIndexGridCoverage because it was just
        // converted above
        if (c instanceof FitToIndexGridCoverage) {
          final byte[] partitionKey = ((FitToIndexGridCoverage) c).getPartitionKey();
          final byte[] sortKey = ((FitToIndexGridCoverage) c).getSortKey();
          final GeoWaveKey geowaveKey =
              new GeoWaveKeyImpl(
                  helper.getNewDataId(c),
                  key.getInternalAdapterId(),
                  partitionKey,
                  sortKey,
                  0);
          final GeoWaveInputKey inputKey =
              new GeoWaveInputKey(helper.getNewAdapterId(), geowaveKey, helper.getIndexName());
          context.write(inputKey, c);
        }
      }
    }
  }
}
 
Example 2
Source File: GeoWaveDedupeMapper.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
protected void mapNativeValue(
    final GeoWaveInputKey key,
    final Object value,
    final MapContext<GeoWaveInputKey, Object, GeoWaveInputKey, Object> context)
    throws IOException, InterruptedException {
  context.write(key, value);
}
 
Example 3
Source File: StoreCopyMapper.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
protected void mapNativeValue(
    final GeoWaveInputKey key,
    final Object value,
    final MapContext<GeoWaveInputKey, Object, GeoWaveInputKey, Object> context)
    throws IOException, InterruptedException {
  context.write(key, value);
}