Github user shivzone commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/1326#discussion_r159297386 --- Diff: pxf/pxf-hdfs/src/main/java/org/apache/hawq/pxf/plugins/hdfs/utilities/HdfsUtilities.java --- @@ -151,18 +153,42 @@ public static boolean isThreadSafe(String dataDir, String compCodec) { * @param fsp file split to be serialized * @return byte serialization of fsp * @throws IOException if I/O errors occur while writing to the underlying - * stream + * stream */ public static byte[] prepareFragmentMetadata(FileSplit fsp) throws IOException { - ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); - ObjectOutputStream objectStream = new ObjectOutputStream( - byteArrayStream); - objectStream.writeLong(fsp.getStart()); - objectStream.writeLong(fsp.getLength()); - objectStream.writeObject(fsp.getLocations()); + + return prepareFragmentMetadata(fsp.getStart(), fsp.getLength(), fsp.getLocations()); + + } + + public static byte[] prepareFragmentMetadata(long start, long length, String[] locations) + throws IOException { + + ByteArrayOutputStream byteArrayStream = writeBaseFragmentInfo(start, length, locations); return byteArrayStream.toByteArray(); + + } + + private static ByteArrayOutputStream writeBaseFragmentInfo(long start, long length, String[] locations) throws IOException { + ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); + ObjectOutputStream objectStream = new ObjectOutputStream(byteArrayStream); + objectStream.writeLong(start); + objectStream.writeLong(length); + objectStream.writeObject(locations); + return byteArrayStream; + } + + public static byte[] prepareFragmentMetadata(long start, --- End diff -- I do'nt see this function used anywhere ?
---