### Question:
ReadOnlyTsFile { public QueryDataSet query(QueryExpression queryExpression) throws IOException { return tsFileExecutor.execute(queryExpression); } ReadOnlyTsFile(TsFileSequenceReader fileReader); QueryDataSet query(QueryExpression queryExpression); void close();  }### Answer:
@Test public void queryTest() throws IOException { Filter filter = TimeFilter.lt(1480562618100L); Filter filter2 = ValueFilter.gt(new Binary("dog")); Filter filter3 = FilterFactory .and(TimeFilter.gtEq(1480562618000L), TimeFilter.ltEq(1480562618100L)); IExpression IExpression = BinaryExpression .or(BinaryExpression.and(new SingleSeriesExpression(new Path("d1.s1"), filter), new SingleSeriesExpression(new Path("d1.s4"), filter2)), new GlobalTimeExpression(filter3)); QueryExpression queryExpression = QueryExpression.create().addSelectedPath(new Path("d1.s1")) .addSelectedPath(new Path("d1.s4")).setExpression(IExpression); QueryDataSet queryDataSet = tsFile.query(queryExpression); long aimedTimestamp = 1480562618000L; while (queryDataSet.hasNext()) { RowRecord rowRecord = queryDataSet.next(); Assert.assertEquals(aimedTimestamp, rowRecord.getTimestamp()); aimedTimestamp++; } queryExpression = QueryExpression.create().addSelectedPath(new Path("d1.s1")) .addSelectedPath(new Path("d1.s4")); queryDataSet = tsFile.query(queryExpression); aimedTimestamp = 1480562618000L; int count = 0; while (queryDataSet.hasNext()) { RowRecord rowRecord = queryDataSet.next(); Assert.assertEquals(aimedTimestamp, rowRecord.getTimestamp()); aimedTimestamp++; count++; } Assert.assertEquals(rowCount, count); queryExpression = QueryExpression.create().addSelectedPath(new Path("d1.s1")) .addSelectedPath(new Path("d1.s4")) .setExpression(new GlobalTimeExpression(filter3)); queryDataSet = tsFile.query(queryExpression); aimedTimestamp = 1480562618000L; count = 0; while (queryDataSet.hasNext()) { RowRecord rowRecord = queryDataSet.next(); Assert.assertEquals(aimedTimestamp, rowRecord.getTimestamp()); aimedTimestamp++; count++; } Assert.assertEquals(101, count); }