Oliverwqcwrw commented on code in PR #398:
URL: https://github.com/apache/rocketmq-connect/pull/398#discussion_r1095250372


##########
connectors/rocketmq-connect-iotdb/src/main/java/org/apache/rocketmq/connect/iotdb/replicator/source/IotdbQuery.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.rocketmq.connect.iotdb.replicator.source;
+
+import io.openmessaging.KeyValue;
+import io.openmessaging.connector.api.data.RecordOffset;
+import java.util.List;
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.session.SessionDataSet;
+import org.apache.rocketmq.connect.iotdb.config.IotdbConfig;
+import org.apache.rocketmq.connect.iotdb.config.IotdbConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class IotdbQuery {
+
+    private static final Logger log = 
LoggerFactory.getLogger(IotdbQuery.class);
+
+    private IotdbReplicator replicator;
+
+    private IotdbConfig config;
+
+    private Session session;
+
+    public IotdbQuery(IotdbReplicator replicator) {
+        this.replicator = replicator;
+        this.config = replicator.getConfig();
+        session =
+            new Session.Builder()
+                .host(config.getIotdbHost())
+                .port(config.getIotdbPort())
+                .build();
+        try {
+            session.open();
+        } catch (IoTDBConnectionException e) {
+            log.error("iotdb session open failed", e);
+        }
+
+    }
+
+    public void start(RecordOffset recordOffset, KeyValue keyValue) {
+
+
+        String path = null;
+        try {
+            path = keyValue.getString(IotdbConstant.IOTDB_PATH);
+            if (path == null || path.trim().equals("")) {
+                log.warn("the path is empty,please check config");
+                return;
+            }
+            long time = 0;
+            if (recordOffset != null && recordOffset.getOffset() != null && 
recordOffset.getOffset().size() > 0) {
+                final Long offsetValue = (Long) 
recordOffset.getOffset().get(keyValue.getString(IotdbConstant.IOTDB_PARTITION) 
+ path);
+                time = offsetValue;
+            }
+            int limit = 500;
+            long offset = 1;
+            String sql = "select * from " + path + " where time > " + time + " 
limit " + limit + " offset " + offset;

Review Comment:
   In my opinion, data reporting in the Internet of Things scenario pays more 
attention to the data at a certain point in time and the trend change of the 
data over time. The uniqueness of the data mainly refers to the data at a 
certain point in time, such as the temperature of the computer reported per 
second. Even if the data is repeatedly reported, the change trend of the data 
will not be affected, so the data at all points in time is mainly pulled
   
   Please let me know if i am missing something



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to