SeriesReaderByTimestamp implements IReaderByTimestamp { @Override public Object getValueInTimestamp(long timestamp) throws IOException { seriesReader.setTimeFilter(timestamp); if ((batchData == null || (batchData.getTimeByIndex(batchData.length() - 1) < timestamp)) && !hasNext(timestamp)) { return null; } return batchData.getValueInTimestamp(timestamp); } SeriesReaderByTimestamp();  SeriesReaderByTimestamp(PartialPath seriesPath, Set<String> allSensors,
      TSDataType dataType, QueryContext context, QueryDataSource dataSource,
      TsFileFilter fileFilter); @Override Object getValueInTimestamp(long timestamp); @Override boolean readerIsEmpty();  }
@Test public void test() throws IOException, IllegalPathException { QueryDataSource dataSource = new QueryDataSource( new PartialPath(SERIES_READER_TEST_SG + ".device0.sensor0"), seqResources, unseqResources); Set<String> allSensors = new HashSet<>(); allSensors.add("sensor0"); SeriesReaderByTimestamp seriesReader = new SeriesReaderByTimestamp( new PartialPath(SERIES_READER_TEST_SG + ".device0.sensor0"), allSensors, TSDataType.INT32, new QueryContext(), dataSource, null); for (int time = 0; time < 500; time++) { Integer value = (Integer) seriesReader.getValueInTimestamp(time); if (time < 200) { Assert.assertEquals(time + 20000, value.intValue()); } else if (time < 260 || (time >= 300 && time < 380) || (time >= 400)) { Assert.assertEquals(time + 10000, value.intValue()); } else { Assert.assertEquals(time, value.intValue()); } } }