/// <exception cref="System.IO.IOException"/> private void WriteData(FileSystem fs, int elementSize) { MapFile.Delete(fs, File); SetFile.Writer writer = new SetFile.Writer(fs, File, typeof(IntWritable)); for (int i = 0; i < elementSize; i++) { writer.Append(new IntWritable(i)); } writer.Close(); }
/// <exception cref="System.IO.IOException"/> private static void WriteTest(FileSystem fs, RandomDatum[] data, string file, SequenceFile.CompressionType compress) { MapFile.Delete(fs, file); Log.Info("creating with " + data.Length + " records"); SetFile.Writer writer = new SetFile.Writer(conf, fs, file, WritableComparator.Get (typeof(RandomDatum)), compress); for (int i = 0; i < data.Length; i++) { writer.Append(data[i]); } writer.Close(); }
/// <exception cref="System.IO.IOException"/> private static void WriteTest(FileSystem fs, RandomDatum[] data, string file) { Configuration conf = new Configuration(); MapFile.Delete(fs, file); if (Log.IsDebugEnabled()) { Log.Debug("creating with " + data.Length + " debug"); } ArrayFile.Writer writer = new ArrayFile.Writer(conf, fs, file, typeof(RandomDatum )); writer.SetIndexInterval(100); for (int i = 0; i < data.Length; i++) { writer.Append(data[i]); } writer.Close(); }
public virtual void TestRename() { string NewFileName = "test-new.mapfile"; string OldFileName = "test-old.mapfile"; MapFile.Writer writer = null; try { FileSystem fs = FileSystem.GetLocal(conf); writer = CreateWriter(OldFileName, typeof(IntWritable), typeof(IntWritable)); writer.Close(); MapFile.Rename(fs, new Path(TestDir, OldFileName).ToString(), new Path(TestDir, NewFileName ).ToString()); MapFile.Delete(fs, new Path(TestDir, NewFileName).ToString()); } catch (IOException ex) { NUnit.Framework.Assert.Fail("testRename error " + ex); } finally { IOUtils.Cleanup(null, writer); } }