本文整理汇总了Java中org.apache.accumulo.core.util.Pair.getSecond方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getSecond方法的具体用法?Java Pair.getSecond怎么用?Java Pair.getSecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.util.Pair
的用法示例。
在下文中一共展示了Pair.getSecond方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
@Override
protected Double compute(List<Pair<Key, Double>> values) {
Iterator<Pair<Key, Double>> iter = values.iterator();
Pair<Key, Double> first = iter.next();
Long firstTs = first.getFirst().getTimestamp();
Double firstVal = first.getSecond();
LOG.trace("first ts:{}, value:{}", firstTs, firstVal);
Pair<Key, Double> second = iter.next();
Long secondTs = second.getFirst().getTimestamp();
Double secondVal = second.getSecond();
LOG.trace("second ts:{}, value:{}", secondTs, secondVal);
if (isCounter && (secondVal < firstVal)) {
if (maxCounter > 0) {
secondVal += maxCounter;
LOG.trace("second counter reset based on max:{} to ts:{}, value:{}", maxCounter, secondTs, secondVal);
} else {
secondVal += firstVal;
LOG.trace("second counter reset based on first:{} to ts:{}, value:{}", firstVal, secondTs, secondVal);
}
}
long timeDiff = secondTs - firstTs;
if (timeDiff == 0) {
return 0.0D;
}
Double result = ((secondVal - firstVal) / timeDiff);
LOG.trace("compute - result: {}", result);
if (isCounter && resetValue > 0 && result > resetValue) {
result = 0.0D;
LOG.trace("compute - reset result base on {} to {}", resetValue, result);
}
return result;
}
示例2: compute
import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
protected Double compute(List<Pair<Key, Double>> values) {
double result = 0D;
int i = 0;
for (Pair<Key, Double> e : values) {
LOG.trace("compute - key:{}, value: {}", e.getFirst(), e.getSecond());
result += (filters[i] * e.getSecond());
i++;
}
LOG.trace("compute - result: {}", result);
return result;
}
示例3: setFetchColumns
import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
private void setFetchColumns(Scanner scanner, String fields[]) {
fields = getFieldsToQuery(fields);
for (String field : fields) {
Pair<Text,Text> col = mapping.fieldMap.get(field);
if (col != null) {
if (col.getSecond() == null) {
scanner.fetchColumnFamily(col.getFirst());
} else {
scanner.fetchColumn(col.getFirst(), col.getSecond());
}
} else {
LOG.error("Mapping not found for field: " + field);
}
}
}
示例4: setFetchColumns
import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
private void setFetchColumns(Scanner scanner, String[] fields) {
fields = getFieldsToQuery(fields);
for (String field : fields) {
Pair<Text,Text> col = mapping.fieldMap.get(field);
if (col != null) {
if (col.getSecond() == null) {
scanner.fetchColumnFamily(col.getFirst());
} else {
scanner.fetchColumn(col.getFirst(), col.getSecond());
}
} else {
LOG.error("Mapping not found for field: {}", field);
}
}
}
示例5: setFetchColumns
import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
private void setFetchColumns(Scanner scanner, String fields[]) {
fields = getFieldsToQuery(fields);
for (String field : fields) {
Pair<Text,Text> col = mapping.fieldMap.get(field);
if (col.getSecond() == null) {
scanner.fetchColumnFamily(col.getFirst());
} else {
scanner.fetchColumn(col.getFirst(), col.getSecond());
}
}
}