pranavbhole commented on code in PR #16029:
URL: https://github.com/apache/druid/pull/16029#discussion_r1536245348
##########
processing/src/main/java/org/apache/druid/collections/spatial/search/RadiusBound.java:
##########
@@ -23,37 +23,60 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
-import org.apache.druid.collections.spatial.ImmutablePoint;
+import org.apache.druid.collections.spatial.ImmutableFloatPoint;
+import org.apache.druid.collections.spatial.RTreeUtils;
import java.nio.ByteBuffer;
/**
+ *
*/
public class RadiusBound extends RectangularBound
{
private static final byte CACHE_TYPE_ID = 0x01;
private final float[] coords;
private final float radius;
+ private final RadiusUnit radiusUnit;
@JsonCreator
public RadiusBound(
@JsonProperty("coords") float[] coords,
@JsonProperty("radius") float radius,
- @JsonProperty("limit") int limit
+ @JsonProperty("limit") int limit,
+ @JsonProperty("radiusUnit") RadiusUnit radiusUnit
Review Comment:
added more tests for nullable
##########
processing/src/test/java/org/apache/druid/collections/spatial/search/RectangularBoundTest.java:
##########
@@ -48,6 +50,57 @@ public void testCacheKey()
));
}
+ @Test
+ public void testRectangularBound()
+ {
+ float[][] insidePoints = new float[][]{
+ {37.795717853074635f, -122.40906979480418f},
+ {37.79625791859653f, -122.39638788940042f},
+ {37.79685798676811f, -122.39335030726777f},
+ {37.7966179600844f, -122.39798262002006f}
+ };
+ float[][] outsidePoints = new float[][]{
+ {37.79805810848854f, -122.39236309307468f},
+ {37.78197485768925f, -122.41886599718191f},
+ {37.798298130492945f, -122.39608413118715f},
+ {37.783595343766216f, -122.41932163450181f}
+ };
+ RectangularBound rectangularBound = new RectangularBound(
+ new float[]{37.78185482027019f, -122.41795472254213f},
+ new float[]{37.797638168104185f, -122.39228715352137f},
+ 10
+ );
+ for (float[] insidePoint : insidePoints) {
+ Assert.assertTrue(rectangularBound.contains(insidePoint));
+ }
+ for (float[] outsidePoint : outsidePoints) {
+ Assert.assertFalse(rectangularBound.contains(outsidePoint));
+ }
+ }
+
+ @Test
+ public void testDeSerForDoubleArrays() throws JsonProcessingException
Review Comment:
modified test
--
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]