private static boolean removeDirectory(File dir) {
    boolean success = false;
    if (dir.isDirectory()) {
      File[] files = dir.listFiles();
      if (files != null && files.length > 0) {
        for (File file : files) {
          success = removeDirectory(file);
          if (!success) {
            return false;
          }
        }
      }
      success = dir.delete();
    } else {
        success = dir.delete();
    }
    return success;
  }
Test that value from Hive table are read properly in Pig
hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/AbstractHCatLoaderTest.java