You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "Vrushali C (JIRA)" <ji...@apache.org> on 2016/06/16 04:36:05 UTC
[jira] [Created] (YARN-5260) Review / Recommendations for hbase
writer code
Vrushali C created YARN-5260:
--------------------------------
Summary: Review / Recommendations for hbase writer code
Key: YARN-5260
URL: https://issues.apache.org/jira/browse/YARN-5260
Project: Hadoop YARN
Issue Type: Sub-task
Reporter: Vrushali C
[~ted_yu] is graciously reviewing the hbase writer related code and has some recommendations. (more to come as review progresses). I will keep track of those in this jira and perhaps spin off other jira(s) depending on the scope of changes.
For FlowRunCoprocessor.java :
- private HRegion region;
Try to declare as Region - the interface. This way, you are to call methods that are stable across future releases.
- private long getCellTimestamp(long timestamp, List<Tag> tags) {
tags is not used, remove the parameter.
For FlowScanner:
- private final InternalScanner flowRunScanner;
Currently InternalScanner is Private. If you must use it, try surfacing your case to hbase so that it can be marked:
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
w.r.t. regionScanner :
{code}
if (internalScanner instanceof RegionScanner) {
this.regionScanner = (RegionScanner) internalScanner;
}
{code}
I see IllegalStateException being thrown in some methods when regionScanner is null. Better bail out early in the ctor.
{code}
public static AggregationOperation getAggregationOperationFromTagsList(
List<Tag> tags) {
for (AggregationOperation aggOp : AggregationOperation.values()) {
for (Tag tag : tags) {
if (tag.getType() == aggOp.getTagType()) {
return aggOp;
{code}
The above nested loop can be improved (a lot):
values() returns an array. If you pre-generate a Set (https://docs.oracle.com/javase/7/docs/api/java/util/EnumSet.html) containing all the values, the outer loop can be omitted.
You iterate through tags and see if tag.getType() is in the Set.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org