From reviews-return-1542-archive-asf-public=cust-asf.ponee.io@iotdb.apache.org Mon May 6 07:01:58 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2414B1807BD for ; Mon, 6 May 2019 09:01:57 +0200 (CEST) Received: (qmail 44750 invoked by uid 500); 6 May 2019 07:01:56 -0000 Mailing-List: contact reviews-help@iotdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@iotdb.apache.org Delivered-To: mailing list reviews@iotdb.apache.org Received: (qmail 44684 invoked by uid 99); 6 May 2019 07:01:56 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 May 2019 07:01:56 +0000 From: GitBox To: reviews@iotdb.apache.org Subject: [GitHub] [incubator-iotdb] mdf369 commented on a change in pull request #152: Cluster read Message-ID: <155712611639.32105.13351876079836084265.gitbox@gitbox.apache.org> Date: Mon, 06 May 2019 07:01:56 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit mdf369 commented on a change in pull request #152: Cluster read URL: https://github.com/apache/incubator-iotdb/pull/152#discussion_r281050860 ########## File path: cluster/src/main/java/org/apache/iotdb/cluster/query/reader/querynode/ClusterBatchReaderWithoutTimeGenerator.java ########## @@ -0,0 +1,88 @@ +/** + * 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.cluster.query.reader.querynode; + +import java.io.IOException; +import java.util.List; +import org.apache.iotdb.cluster.config.ClusterConstant; +import org.apache.iotdb.db.query.reader.IPointReader; +import org.apache.iotdb.db.utils.TimeValuePair; +import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType; +import org.apache.iotdb.tsfile.read.common.BatchData; + +/** + * BatchReader without time generator for cluster which is used in query node. + */ +public class ClusterBatchReaderWithoutTimeGenerator extends IClusterBatchReader { + + /** + * Data type + */ + private TSDataType dataType; + + /** + * Point reader + */ + private IPointReader reader; + + public ClusterBatchReaderWithoutTimeGenerator( + TSDataType dataType, IPointReader reader) { + this.dataType = dataType; + this.reader = reader; + } + + @Override + public boolean hasNext() throws IOException { + return reader.hasNext(); + } + + @Override + public BatchData nextBatch() throws IOException { + BatchData batchData = new BatchData(dataType, true); + for (int i = 0; i < ClusterConstant.BATCH_READ_SIZE; i++) { + if (hasNext()) { + TimeValuePair pair = reader.next(); + batchData.putTime(pair.getTimestamp()); + batchData.putAnObject(pair.getValue().getValue()); + } else { + break; + } + } + return batchData; + } + + @Override + public void close() throws IOException { Review comment: No need to close reader? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services