@Test
  public void testRYW() throws IOException {

    File f = new File("binary.dat");
    f.delete();
    f.createNewFile();
    f.deleteOnExit();

    OutputStream fileOutStream = new FileOutputStream(f);
    DataOutput outStream = new DataOutputStream(fileOutStream);

    HCatRecord[] recs = getHCatRecords();
    for (int i = 0; i < recs.length; i++) {
      recs[i].write(outStream);
    }
    fileOutStream.flush();
    fileOutStream.close();

    InputStream fInStream = new FileInputStream(f);
    DataInput inpStream = new DataInputStream(fInStream);

    for (int i = 0; i < recs.length; i++) {
      HCatRecord rec = new DefaultHCatRecord();
      rec.readFields(inpStream);
      StringBuilder msg = new StringBuilder("recs[" + i + "]='" + recs[i] + "' rec='" + rec + "'");
      boolean isEqual = HCatDataCheckUtil.recordsEqual(recs[i], rec, msg);
      Assert.assertTrue(msg.toString(), isEqual);
    }

    Assert.assertEquals(fInStream.available(), 0);
    fInStream.close();

  }
test that we properly serialize/deserialize HCatRecordS
@throws IOException
hcatalog/core/src/test/java/org/apache/hive/hcatalog/data/TestDefaultHCatRecord.java