You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2012/04/19 18:19:56 UTC
svn commit: r1328030 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase:
client/coprocessor/AggregationClient.java
coprocessor/AggregateImplementation.java
Author: tedyu
Date: Thu Apr 19 16:19:56 2012
New Revision: 1328030
URL: http://svn.apache.org/viewvc?rev=1328030&view=rev
Log:
HBASE-5821 Incorrect handling of null value in Coprocessor aggregation function min() (Maryann Xue)
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java?rev=1328030&r1=1328029&r2=1328030&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java Thu Apr 19 16:19:56 2012
@@ -105,7 +105,7 @@ public class AggregationClient {
@Override
public synchronized void update(byte[] region, byte[] row, R result) {
- max = ci.compare(max, result) < 0 ? result : max;
+ max = (max == null || (result != null && ci.compare(max, result) < 0)) ? result : max;
}
}
MaxCallBack aMaxCallBack = new MaxCallBack();
@@ -155,7 +155,7 @@ public class AggregationClient {
@Override
public synchronized void update(byte[] region, byte[] row, R result) {
- min = (min == null || ci.compare(result, min) < 0) ? result : min;
+ min = (min == null || (result != null && ci.compare(result, min) < 0)) ? result : min;
}
}
HTable table = new HTable(conf, tableName);
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java?rev=1328030&r1=1328029&r2=1328030&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java Thu Apr 19 16:19:56 2012
@@ -72,7 +72,7 @@ public class AggregateImplementation ext
hasMoreRows = scanner.next(results);
for (KeyValue kv : results) {
temp = ci.getValue(colFamily, qualifier, kv);
- max = (max == null || ci.compare(temp, max) > 0) ? temp : max;
+ max = (max == null || (temp != null && ci.compare(temp, max) > 0)) ? temp : max;
}
results.clear();
} while (hasMoreRows);
@@ -101,7 +101,7 @@ public class AggregateImplementation ext
hasMoreRows = scanner.next(results);
for (KeyValue kv : results) {
temp = ci.getValue(colFamily, qualifier, kv);
- min = (min == null || ci.compare(temp, min) < 0) ? temp : min;
+ min = (min == null || (temp != null && ci.compare(temp, min) < 0)) ? temp : min;
}
results.clear();
} while (hasMoreRows);