-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jialin Qiao
committed
Feb 27, 2020
1 parent
32c6fb0
commit 907176c
Showing
4 changed files
with
90 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
tsfile/src/test/java/org/apache/iotdb/tsfile/read/reader/FakedBatchReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.iotdb.tsfile.read.reader; | ||
|
||
import java.io.IOException; | ||
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType; | ||
import org.apache.iotdb.tsfile.read.common.BatchData; | ||
|
||
public class FakedBatchReader implements IBatchReader { | ||
|
||
private BatchData data; | ||
private boolean hasCached = false; | ||
|
||
public FakedBatchReader(long[] timestamps) { | ||
data = new BatchData(TSDataType.INT32); | ||
for (long time : timestamps) { | ||
data.putInt(time, 1); | ||
hasCached = true; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean hasNextBatch() { | ||
return hasCached; | ||
} | ||
|
||
@Override | ||
public BatchData nextBatch() throws IOException { | ||
if (data == null || !data.hasCurrent()) { | ||
throw new IOException("no next batch"); | ||
} | ||
hasCached = false; | ||
return data; | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
} |