You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2017/01/23 09:14:26 UTC

[1/2] lucene-solr:master: LUCENE-7640: Fix test failure.

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 52f3b7b93 -> cf6c73432
  refs/heads/master 9571d0f3a -> c7fdd1097


LUCENE-7640: Fix test failure.


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

Branch: refs/heads/master
Commit: c7fdd10971410944b586e6166f4cf95036c7a148
Parents: 9571d0f
Author: Adrien Grand <jp...@gmail.com>
Authored: Mon Jan 23 10:08:19 2017 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Mon Jan 23 10:08:19 2017 +0100

----------------------------------------------------------------------
 .../lucene60/TestLucene60PointsFormat.java      | 37 +++++++++++---------
 .../org/apache/lucene/util/bkd/TestBKD.java     | 37 +++++++++++---------
 2 files changed, 40 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c7fdd109/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
index 08dc6c6..8f0be3a 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
@@ -253,25 +253,28 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
         }));
 
     // If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
-    assertEquals((actualMaxPointsInLeafNode + 1) / 2,
-        points.estimatePointCount(new IntersectVisitor() {
-          @Override
-          public void visit(int docID, byte[] packedValue) throws IOException {}
-          
-          @Override
-          public void visit(int docID) throws IOException {}
-          
-          @Override
-          public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-            for (int dim = 0; dim < 2; ++dim) {
-              if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
-                  StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
-                return Relation.CELL_OUTSIDE_QUERY;
-              }
+    // in general, or maybe 2x that if the point is a split value
+    final long pointCount = points.estimatePointCount(new IntersectVisitor() {
+        @Override
+        public void visit(int docID, byte[] packedValue) throws IOException {}
+        
+        @Override
+        public void visit(int docID) throws IOException {}
+        
+        @Override
+        public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+          for (int dim = 0; dim < 2; ++dim) {
+            if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
+                StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
+              return Relation.CELL_OUTSIDE_QUERY;
             }
-            return Relation.CELL_CROSSES_QUERY;
           }
-        }));
+          return Relation.CELL_CROSSES_QUERY;
+        }
+      });
+    assertTrue(""+pointCount,
+        pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
+        pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
 
     r.close();
     dir.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c7fdd109/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
index fecdaa5..b9dad6f 100644
--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
@@ -1173,23 +1173,26 @@ public class TestBKD extends LuceneTestCase {
         }));
 
     // If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
-    assertEquals((actualMaxPointsInLeafNode + 1) / 2,
-        points.estimatePointCount(new IntersectVisitor() {
-          @Override
-          public void visit(int docID, byte[] packedValue) throws IOException {}
-          
-          @Override
-          public void visit(int docID) throws IOException {}
-          
-          @Override
-          public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-            if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
-                StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
-              return Relation.CELL_OUTSIDE_QUERY;
-            }
-            return Relation.CELL_CROSSES_QUERY;
-          }
-        }));
+    // in general, or maybe 2x that if the point is a split value
+    final long pointCount = points.estimatePointCount(new IntersectVisitor() {
+      @Override
+      public void visit(int docID, byte[] packedValue) throws IOException {}
+
+      @Override
+      public void visit(int docID) throws IOException {}
+
+      @Override
+      public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+        if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
+            StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
+          return Relation.CELL_OUTSIDE_QUERY;
+        }
+        return Relation.CELL_CROSSES_QUERY;
+      }
+    });
+    assertTrue(""+pointCount,
+        pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
+        pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
 
     pointsIn.close();
     dir.close();


[2/2] lucene-solr:branch_6x: LUCENE-7640: Fix test failure.

Posted by jp...@apache.org.
LUCENE-7640: Fix test failure.


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

Branch: refs/heads/branch_6x
Commit: cf6c73432bbd2e2791b49a7853c530f799179b87
Parents: 52f3b7b
Author: Adrien Grand <jp...@gmail.com>
Authored: Mon Jan 23 10:08:19 2017 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Mon Jan 23 10:10:57 2017 +0100

----------------------------------------------------------------------
 .../lucene60/TestLucene60PointsFormat.java      | 39 +++++++++++---------
 .../org/apache/lucene/util/bkd/TestBKD.java     | 37 ++++++++++---------
 2 files changed, 41 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cf6c7343/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
index b5ee2ca..37d0b8e 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
@@ -253,25 +253,28 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
         }));
 
     // If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
-    assertEquals((actualMaxPointsInLeafNode + 1) / 2,
-        points.estimatePointCount("f", new IntersectVisitor() {
-          @Override
-          public void visit(int docID, byte[] packedValue) throws IOException {}
-          
-          @Override
-          public void visit(int docID) throws IOException {}
-          
-          @Override
-          public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-            for (int dim = 0; dim < 2; ++dim) {
-              if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
-                  StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
-                return Relation.CELL_OUTSIDE_QUERY;
-              }
-            }
-            return Relation.CELL_CROSSES_QUERY;
+    // in general, or maybe 2x that if the point is a split value
+    final long pointCount = points.estimatePointCount("f", new IntersectVisitor() {
+      @Override
+      public void visit(int docID, byte[] packedValue) throws IOException {}
+
+      @Override
+      public void visit(int docID) throws IOException {}
+
+      @Override
+      public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+        for (int dim = 0; dim < 2; ++dim) {
+          if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
+              StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
+            return Relation.CELL_OUTSIDE_QUERY;
           }
-        }));
+        }
+        return Relation.CELL_CROSSES_QUERY;
+      }
+    });
+    assertTrue(""+pointCount,
+        pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
+        pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
 
     r.close();
     dir.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cf6c7343/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
index fecdaa5..b9dad6f 100644
--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
@@ -1173,23 +1173,26 @@ public class TestBKD extends LuceneTestCase {
         }));
 
     // If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
-    assertEquals((actualMaxPointsInLeafNode + 1) / 2,
-        points.estimatePointCount(new IntersectVisitor() {
-          @Override
-          public void visit(int docID, byte[] packedValue) throws IOException {}
-          
-          @Override
-          public void visit(int docID) throws IOException {}
-          
-          @Override
-          public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-            if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
-                StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
-              return Relation.CELL_OUTSIDE_QUERY;
-            }
-            return Relation.CELL_CROSSES_QUERY;
-          }
-        }));
+    // in general, or maybe 2x that if the point is a split value
+    final long pointCount = points.estimatePointCount(new IntersectVisitor() {
+      @Override
+      public void visit(int docID, byte[] packedValue) throws IOException {}
+
+      @Override
+      public void visit(int docID) throws IOException {}
+
+      @Override
+      public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+        if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
+            StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
+          return Relation.CELL_OUTSIDE_QUERY;
+        }
+        return Relation.CELL_CROSSES_QUERY;
+      }
+    });
+    assertTrue(""+pointCount,
+        pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
+        pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
 
     pointsIn.close();
     dir.close();