You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/12/26 17:28:11 UTC

[GitHub] [incubator-pinot] kishoreg commented on a change in pull request #6387: Allow multiple H3 index resolutions

kishoreg commented on a change in pull request #6387:
URL: https://github.com/apache/incubator-pinot/pull/6387#discussion_r549013279



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/geospatial/H3IndexResolution.java
##########
@@ -0,0 +1,53 @@
+package org.apache.pinot.core.segment.creator.impl.geospatial;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Stores the resolutions for an index. There are in total of H3 resolutions https://h3geo.org/#/documentation/core-library/resolution-table
+ * To efficiently serialize the resolutions, we use two bytes for encoding th enabled resolutions. The resolution level
+ * maps to the corresponding bit.
+ */
+public class H3IndexResolution {
+  private short _resolutions;
+
+  public H3IndexResolution(List<Integer> resolutions) {
+    for (int resolution : resolutions) {
+      _resolutions |= 1 << resolution;
+    }
+  }
+
+  /**
+   * Creates the resolutions with the serialized short value
+   * @param resolutions
+   */
+  public H3IndexResolution(short resolutions) {
+    _resolutions = resolutions;
+  }
+
+  /**
+   * @return the encoding of the resolutions into a short value (two bytes)
+   */
+  public short serialize() {

Review comment:
       make it int




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org