lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject [23/41] lucene-solr:feature/autoscaling: SOLR-10796: fix long overflow in testLongPointFieldRangeFacet()
Date Thu, 13 Jul 2017 07:18:31 GMT
SOLR-10796: fix long overflow in testLongPointFieldRangeFacet()


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6188c8ce
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6188c8ce
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6188c8ce

Branch: refs/heads/feature/autoscaling
Commit: 6188c8ce389d187e49453668bc194074cac72842
Parents: d65cbac
Author: Steve Rowe <sarowe@apache.org>
Authored: Wed Jul 12 11:55:50 2017 -0400
Committer: Steve Rowe <sarowe@apache.org>
Committed: Wed Jul 12 11:56:21 2017 -0400

----------------------------------------------------------------------
 .../src/test/org/apache/solr/schema/TestPointFields.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6188c8ce/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
index b6e00b2..83eaebd 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
@@ -1187,15 +1187,20 @@ public class TestPointFields extends SolrTestCaseJ4 {
       sortedValues = values.stream().sorted().collect(Collectors.toList());
     } while ((max = sortedValues.get(sortedValues.size() - 1)) >= Long.MAX_VALUE - numValues);
// leave room for rounding 
     long min = sortedValues.get(0);
-    long gap = BigInteger.valueOf(max + numValues).subtract(BigInteger.valueOf(min))
-        .divide(BigInteger.valueOf(numBuckets)).longValueExact();
+    BigInteger bigIntGap =  BigInteger.valueOf(max + numValues).subtract(BigInteger.valueOf(min))
+        .divide(BigInteger.valueOf(numBuckets));
+    long gap = bigIntGap.longValueExact();
     int[] bucketCount = new int[numBuckets];
     int bucketNum = 0;
     long minBucketVal = min;
+    System.err.println("min:" + min + "   max: " + max + "   gap: " + gap);
+    System.err.println("bucketNum: " + bucketNum + "   minBucketVal: " + minBucketVal);
     for (Long value : sortedValues) {
-      while (value - minBucketVal >= gap) {
+      System.err.println("value: " + value);
+      while (BigInteger.valueOf(value).subtract(BigInteger.valueOf(minBucketVal)).compareTo(bigIntGap)
> 0) {
         ++bucketNum;
         minBucketVal += gap;
+        System.err.println("bucketNum: " + bucketNum + "   minBucketVal: " + minBucketVal);
       }
       ++bucketCount[bucketNum];
     }


Mime
View raw message