[
https://issues.apache.org/jira/browse/APEXMALHAR-1957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15328481#comment-15328481
]
ASF GitHub Bot commented on APEXMALHAR-1957:
--------------------------------------------
Github user chinmaykolhatkar commented on a diff in the pull request:
https://github.com/apache/apex-malhar/pull/292#discussion_r66884332
--- Diff:
contrib/src/main/java/com/datatorrent/contrib/hbase/HBaseFieldValueGenerator.java
---
@@ -0,0 +1,65 @@
+/**
+ * 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 com.datatorrent.contrib.hbase;
+
+import java.util.List;
+
+import com.datatorrent.lib.util.FieldValueGenerator;
+import com.datatorrent.lib.util.PojoUtils;
+
+/**
+ * A {@link FieldValueGenerator} implementation for {@link HBaseFieldInfo}
+ */
+public class HBaseFieldValueGenerator extends
FieldValueGenerator<HBaseFieldInfo>
+{
+ public static final String COLON = ":";
+
+ public static HBaseFieldValueGenerator getHBaseFieldValueGenerator(final
Class<?> clazz, List<HBaseFieldInfo>
+ fieldInfos)
+ {
+ return new HBaseFieldValueGenerator(clazz, fieldInfos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected HBaseFieldValueGenerator(final Class<?> clazz,
List<HBaseFieldInfo> fieldInfos)
+ {
+ for (HBaseFieldInfo fieldInfo : fieldInfos) {
+ fieldInfoMap.put(fieldInfo.getFamilyName() + COLON +
fieldInfo.getColumnName(), fieldInfo);
+
+ PojoUtils.Getter<Object, Object> getter =
+ PojoUtils.createGetter(clazz,
fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType());
+ fieldGetterMap.put(fieldInfo, getter);
+ }
+
+ for (HBaseFieldInfo fieldInfo : fieldInfos) {
+ PojoUtils.Setter<Object, Object> setter =
+ PojoUtils.createSetter(clazz,
fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType());
+ fieldSetterMap.put(fieldInfo, setter);
--- End diff --
Would it be more efficient if the key of fieldSetterMap is made as
familyName:columnName instead of any object?
> Improve HBasePOJOInputOperator with support for threaded read
> -------------------------------------------------------------
>
> Key: APEXMALHAR-1957
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-1957
> Project: Apache Apex Malhar
> Issue Type: Task
> Reporter: Bhupesh Chawda
> Assignee: Bhupesh Chawda
>
> Add the following support to Hbase POJO Input Operator:
> * Add support for threaded read
> * Allow to specify a set of "column family: column" and fetch data only for
> these columns
> * Allow to specify an end row key to stop scanning
> * Add metrics
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)