jihoonson commented on a change in pull request #9057: [new feature] Add HBase2 
Indexer
URL: https://github.com/apache/druid/pull/9057#discussion_r381110100
 
 

 ##########
 File path: 
extensions-contrib/druid-hbase2-indexing/src/main/java/org/apache/druid/indexer/hbase2/HBaseFirehose.java
 ##########
 @@ -0,0 +1,161 @@
+/*
+ * 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.druid.indexer.hbase2;
+
+import org.apache.druid.data.input.Firehose;
+import org.apache.druid.data.input.InputRow;
+import org.apache.druid.data.input.InputRowListPlusRawValues;
+import org.apache.druid.data.input.impl.InputRowParser;
+import org.apache.druid.java.util.common.parsers.ParseException;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+public abstract class HBaseFirehose implements Firehose
+{
+
+  protected final Logger log = LogManager.getLogger(getClass());
+
+  protected final Iterator<Scan> scanIterator;
+  protected final InputRowParser<Result> parser;
+
+  protected ResultScanner scanner;
+  protected Result result;
+  protected long readRows;
+  private boolean initialized;
+
+  public HBaseFirehose(Iterator<Scan> scanIterator, InputRowParser<Result> 
parser)
+  {
+    this.scanIterator = scanIterator;
+    this.parser = parser;
+  }
+
+  @Override
+  public boolean hasMore()
+  {
+    if (!initialized) {
+      nextResult();
+      initialized = true;
+    }
+
+    boolean more = result != null;
+    if (!more) {
+      if (log.isInfoEnabled()) {
+        log.info("Total read rows: {}", readRows);
 
 Review comment:
   This will be printed per line.. Should be debug. Or is this log useful? I 
think the validity should be checked in the tests rather than by looking at the 
logs.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to