hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1328027 - in /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase: client/coprocessor/AggregationClient.java coprocessor/AggregateImplementation.java
Date Thu, 19 Apr 2012 16:19:10 GMT
Author: tedyu
Date: Thu Apr 19 16:19:10 2012
New Revision: 1328027

URL: http://svn.apache.org/viewvc?rev=1328027&view=rev
Log:
HBASE-5821  Incorrect handling of null value in Coprocessor aggregation function min() (Maryann
Xue)

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java?rev=1328027&r1=1328026&r2=1328027&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
Thu Apr 19 16:19:10 2012
@@ -101,7 +101,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();
@@ -151,7 +151,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/branches/0.94/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java?rev=1328027&r1=1328026&r2=1328027&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java
Thu Apr 19 16:19:10 2012
@@ -68,7 +68,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);
@@ -97,7 +97,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);



Mime
View raw message