choubenson commented on code in PR #7621:
URL: https://github.com/apache/iotdb/pull/7621#discussion_r1005181242


##########
tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/chunk/ChunkReader.java:
##########
@@ -199,6 +209,63 @@ private PageReader 
constructPageReaderForNextPage(PageHeader pageHeader) throws
     return reader;
   }
 
+  /**
+   * Read page data without uncompressing it.
+   *
+   * @return compressed page data
+   */
+  public ByteBuffer readPageDataWithoutUncompressing(PageHeader pageHeader) 
throws IOException {
+    int compressedPageBodyLength = pageHeader.getCompressedSize();
+    byte[] compressedPageBody = new byte[compressedPageBodyLength];
+
+    // doesn't has a complete page body
+    if (compressedPageBodyLength > chunkDataBuffer.remaining()) {
+      throw new IOException(
+          "do not has a complete page body. Expected:"
+              + compressedPageBodyLength
+              + ". Actual:"
+              + chunkDataBuffer.remaining());
+    }
+
+    chunkDataBuffer.get(compressedPageBody);
+    return ByteBuffer.wrap(compressedPageBody);
+  }
+
+  /**
+   * Read data from compressed page data. Uncompress the page and decode it to 
batch data.
+   *
+   * @param compressedPageData Compressed page data
+   */
+  public TsBlock readPageData(PageHeader pageHeader, ByteBuffer 
compressedPageData)
+      throws IOException {
+    // uncompress page data

Review Comment:
   Yes, but if extract it as a function and put it into the `IChunkReader` 
interface, is it a good idea?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to