AmatyaAvadhanula commented on code in PR #16389:
URL: https://github.com/apache/druid/pull/16389#discussion_r1589854400


##########
processing/src/test/java/org/apache/druid/collections/spatial/ImmutableRTreeTest.java:
##########
@@ -702,4 +703,37 @@ public void testPreciseRadiusBoundFilter()
     ImmutableBitmap finalSet = bf.union(points);
     Assert.assertTrue(finalSet.size() == 100);
   }
+
+  @Test
+  public void testForImmutableRTreeImmutability()
+  {
+    BitmapFactory bf = new RoaringBitmapFactory();
+    RTree tree = new RTree(2, new LinearGutmanSplitStrategy(0, 50, bf), bf);
+    float centerLat = 37.4133961f;
+    float centerLong = -122.1224665f;
+    float[][] insidePoints = 
SpatialUtils.generateGeoCoordinatesAroundCircle(centerLat, centerLong, 100, 
100, true);
+    for (int i = 0; i < insidePoints.length; i++) {
+      tree.insert(insidePoints[i], i);
+    }
+    float[][] outsidePoints = 
SpatialUtils.generateGeoCoordinatesAroundCircle(centerLat, centerLong, 100, 
100, false);
+    for (int i = 0; i < outsidePoints.length; i++) {
+      tree.insert(outsidePoints[i], i);
+    }
+    final ImmutableRTree searchTree = 
ImmutableRTree.newImmutableFromMutable(tree);
+    ByteBuffer buffer = ByteBuffer.wrap(searchTree.toBytes());
+    ImmutableRTreeObjectStrategy objectStrategy = new 
ImmutableRTreeObjectStrategy(bf);
+    ImmutableRTree builtTree = objectStrategy.fromByteBuffer(buffer, 
searchTree.toBytes().length);
+    buffer.position(10);

Review Comment:
   Thanks for the clarification!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to