You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/02/18 08:18:13 UTC

[GitHub] [iotdb] SiasDoming opened a new issue #5089: ChunkReaderByTimestamp does not work

SiasDoming opened a new issue #5089:
URL: https://github.com/apache/iotdb/issues/5089


   **Describe the bug**
   ChunkReaderByTimestamp in package `org.apache.iotdb.tsfile.read.reader.chunk` works exactly the same with its super class ChunkReader.
   ChunkReaderByTimestamp overrides `protected boolean pageSatisfied(PageHeader pageHeader)` method and make it return false for those pages before `currentTimestamp`. It is designed (I guess) to filter data and access pages/points whose `time >= currentTimestamp`.
   However, the override method is **only** called through `public ChunkReader(Chunk chunk)` -> `private void initAllPageReaders(Statistics chunkStatistic)` -> `protected boolean pageSatisfied(PageHeader pageHeader)`, which means it only take effect during constructing new instances. The key to the problem is when we call the constructor, the private variable `currentTimestamp` **has not been set!!!** The method will always use the default initial value 0 for long type and work exactly the same with the original one.
   
   I'm wondering for what purpose the ChunkReaderByTimestamp is designed and if are there are any interfaces not implemented for it to work as expected. As other reader classes whose name ends with *ReaderByTimestamp often provide interfaces to fetch data for specified timetamps, such as `public Object getValueInTimestamp(long timestamp)` and `Object[] getValuesInTimestamps(long[] timestamps, int length)`.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Import `org.apache.iotdb.tsfile.read.reader.chunk.ChunkReaderByTimestamp` and its super class `org.apache.iotdb.tsfile.read.reader.chunk.ChunkReader`.
   2. Read or build one Chunk with a few data
   3. Construct a ChunkReader, a ChunkReaderByTimestamp, and set the `currentTimestamp` of the latter one with interface `public void setCurrentTimestamp(long currentTimestamp)`
   4. Run with debugger and watch the member variable `private List<IPageReader> pageReaderList` of these two instances. They are always the same.
   5. Or fetch data by `while (reader.hasNextSatisfiedPage()) {BatchData batchData = reader.nextPageData()}` and print all points. They are always the same, too.
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HTHou closed issue #5089: ChunkReaderByTimestamp does not work

Posted by GitBox <gi...@apache.org>.
HTHou closed issue #5089:
URL: https://github.com/apache/iotdb/issues/5089


   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org