paleolimbot commented on code in PR #2027:
URL: https://github.com/apache/sedona/pull/2027#discussion_r2183097972


##########
common/src/main/java/org/apache/sedona/common/S2Geography/GeographyIndex.java:
##########
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sedona.common.S2Geography;
+
+import com.google.common.geometry.S2CellId;
+import com.google.common.geometry.S2Iterator;
+import com.google.common.geometry.S2ShapeIndex;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+public class GeographyIndex {
+  private final S2ShapeIndex index;
+  private int[] values;
+
+  public GeographyIndex() {
+    this(new S2ShapeIndex.Options());
+  }
+
+  public GeographyIndex(S2ShapeIndex.Options options) {
+    this.index = new S2ShapeIndex(options);
+    this.values = new int[0];
+  }
+
+  public void add(S2Geography geog, int value) {
+    // Determine total slots needed in the array
+    int currentLength = (values == null ? 0 : values.length);
+    int needed = currentLength + geog.numShapes();
+    values = expand(values, needed);

Review Comment:
   While this particular bit of code has done the trick for the sizes of 
geography vectors that we usually see in R, I would say that it is a particular 
weak point in the implementation because it indexes every single edge for ever 
single member. Ideally it would only store a covering per item.



-- 
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: issues-unsubscr...@sedona.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to