hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1328030 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase: client/coprocessor/AggregationClient.java coprocessor/AggregateImplementation.java
Date Thu, 19 Apr 2012 16:19:56 GMT
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);



Mime
View raw message