@Test public void testLoad() throws Exception { Configuration conf = getConfiguration(); Writable key = new IntWritable(0); Vector value = new DenseVector(VECTOR); Path path = getTestTempDirPath("output"); FileSystem fs = FileSystem.get(path.toUri(), conf); path = fs.makeQualified(path); fs.deleteOnExit(path); HadoopUtil.delete(conf, path); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, path, IntWritable.class, VectorWritable.class); try { writer.append(key, new VectorWritable(value)); } finally { Closeables.close(writer, false); } DistributedCache.setCacheFiles(new URI[] {path.toUri()}, conf); Vector result = VectorCache.load(conf); assertNotNull("Vector is null", result); assertEquals("Loaded vector is not identical to original", result, value); }
public static Vector load(Configuration conf) throws IOException { Path[] files = HadoopUtil.getCachedFiles(conf); if (files.length != 1) { throw new IOException("Cannot read Frequency list from Distributed Cache (" + files.length + ')'); } if (log.isInfoEnabled()) { log.info("Files are: {}", Arrays.toString(files)); } return load(conf, files[0]); }
VectorCache { public static Vector load(Configuration conf) throws IOException { Path[] files = HadoopUtil.getCachedFiles(conf); if (files.length != 1) { throw new IOException("Cannot read Frequency list from Distributed Cache (" + files.length + ')'); } if (log.isInfoEnabled()) { log.info("Files are: {}", Arrays.toString(files)); } return load(conf, files[0]); } }
VectorCache { public static Vector load(Configuration conf) throws IOException { Path[] files = HadoopUtil.getCachedFiles(conf); if (files.length != 1) { throw new IOException("Cannot read Frequency list from Distributed Cache (" + files.length + ')'); } if (log.isInfoEnabled()) { log.info("Files are: {}", Arrays.toString(files)); } return load(conf, files[0]); } private  VectorCache(); }
VectorCache { public static Vector load(Configuration conf) throws IOException { Path[] files = HadoopUtil.getCachedFiles(conf); if (files.length != 1) { throw new IOException("Cannot read Frequency list from Distributed Cache (" + files.length + ')'); } if (log.isInfoEnabled()) { log.info("Files are: {}", Arrays.toString(files)); } return load(conf, files[0]); } private  VectorCache(); static void save(Writable key,
                          Vector vector,
                          Path output,
                          Configuration conf,
                          boolean overwritePath,
                          boolean deleteOnExit); static void save(Writable key, Vector vector, Path output, Configuration conf); static Vector load(Configuration conf); static Vector load(Configuration conf, Path input); }
VectorCache { public static Vector load(Configuration conf) throws IOException { Path[] files = HadoopUtil.getCachedFiles(conf); if (files.length != 1) { throw new IOException("Cannot read Frequency list from Distributed Cache (" + files.length + ')'); } if (log.isInfoEnabled()) { log.info("Files are: {}", Arrays.toString(files)); } return load(conf, files[0]); } private  VectorCache(); static void save(Writable key,
                          Vector vector,
                          Path output,
                          Configuration conf,
                          boolean overwritePath,
                          boolean deleteOnExit); static void save(Writable key, Vector vector, Path output, Configuration conf); static Vector load(Configuration conf); static Vector load(Configuration conf, Path input);  }