@Test public void testKeyFound() { final String key = "3858243"; final String expectedValue = "1975 5485 1973 \"FR\" \"\" 445095 3 12 2 6 63 7 2 0.8571 0 0.2778 6 8.1429 0 0 0 0"; final Writable actualValue = findInMapFile(new Text(key), dirURI, conf); Assert.assertNotNull("Value for key: " + key + " shouldn't be null", actualValue); Assert.assertEquals("Wrong value retirned for key: " + key, expectedValue, actualValue.toString()); }
public static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf) { MapFile.Reader reader = null; Writable value = null; LOGGER.debug("MapFile URI: {}.", dirURI); try { final Path inputPath = new Path(dirURI); final FileSystem fs = inputPath.getFileSystem(conf); reader = new MapFile.Reader(fs, dirURI.toString(), conf); value = reader.get(key, new Text()); } catch (IOException ioe) { ioe.printStackTrace(); } finally { closeStreams(reader); } LOGGER.debug("Returning value: {}, for key: {}.", value, key); return value; }
IOUtils { public static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf) { MapFile.Reader reader = null; Writable value = null; LOGGER.debug("MapFile URI: {}.", dirURI); try { final Path inputPath = new Path(dirURI); final FileSystem fs = inputPath.getFileSystem(conf); reader = new MapFile.Reader(fs, dirURI.toString(), conf); value = reader.get(key, new Text()); } catch (IOException ioe) { ioe.printStackTrace(); } finally { closeStreams(reader); } LOGGER.debug("Returning value: {}, for key: {}.", value, key); return value; } }
IOUtils { public static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf) { MapFile.Reader reader = null; Writable value = null; LOGGER.debug("MapFile URI: {}.", dirURI); try { final Path inputPath = new Path(dirURI); final FileSystem fs = inputPath.getFileSystem(conf); reader = new MapFile.Reader(fs, dirURI.toString(), conf); value = reader.get(key, new Text()); } catch (IOException ioe) { ioe.printStackTrace(); } finally { closeStreams(reader); } LOGGER.debug("Returning value: {}, for key: {}.", value, key); return value; }  }
IOUtils { public static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf) { MapFile.Reader reader = null; Writable value = null; LOGGER.debug("MapFile URI: {}.", dirURI); try { final Path inputPath = new Path(dirURI); final FileSystem fs = inputPath.getFileSystem(conf); reader = new MapFile.Reader(fs, dirURI.toString(), conf); value = reader.get(key, new Text()); } catch (IOException ioe) { ioe.printStackTrace(); } finally { closeStreams(reader); } LOGGER.debug("Returning value: {}, for key: {}.", value, key); return value; }  static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf); @SuppressWarnings("resource") static URI createMapFile(URI inputURI, final Configuration conf); static URI compressFile(final URI uncompressedURI, final String codecName, final Configuration conf); static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension); static String removeExtension(String filename); static URI uncompressFile(final URI archiveURI, final Configuration conf); }
IOUtils { public static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf) { MapFile.Reader reader = null; Writable value = null; LOGGER.debug("MapFile URI: {}.", dirURI); try { final Path inputPath = new Path(dirURI); final FileSystem fs = inputPath.getFileSystem(conf); reader = new MapFile.Reader(fs, dirURI.toString(), conf); value = reader.get(key, new Text()); } catch (IOException ioe) { ioe.printStackTrace(); } finally { closeStreams(reader); } LOGGER.debug("Returning value: {}, for key: {}.", value, key); return value; }  static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf); @SuppressWarnings("resource") static URI createMapFile(URI inputURI, final Configuration conf); static URI compressFile(final URI uncompressedURI, final String codecName, final Configuration conf); static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension); static String removeExtension(String filename); static URI uncompressFile(final URI archiveURI, final Configuration conf); static final Logger LOGGER; }