kishoreg commented on a change in pull request #6376: URL: https://github.com/apache/incubator-pinot/pull/6376#discussion_r547709207
########## File path: pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/geospatial/H3IndexCreator.java ########## @@ -0,0 +1,344 @@ +/** + * 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.pinot.core.segment.creator.impl.geospatial; + +import com.uber.h3core.H3Core; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.PriorityQueue; +import java.util.Random; +import java.util.TreeMap; +import org.apache.commons.io.FileUtils; +import org.apache.pinot.core.geospatial.GeometryUtils; +import org.apache.pinot.core.geospatial.transform.function.StDistanceFunction; +import org.apache.pinot.core.segment.creator.GeoSpatialIndexCreator; +import org.apache.pinot.core.segment.index.readers.geospatial.H3IndexReader; +import org.apache.pinot.core.segment.memory.PinotDataBuffer; +import org.apache.pinot.spi.data.DimensionFieldSpec; +import org.apache.pinot.spi.data.FieldSpec; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.Point; +import org.roaringbitmap.buffer.ImmutableRoaringBitmap; +import org.roaringbitmap.buffer.MutableRoaringBitmap; + +import static org.apache.pinot.core.segment.creator.impl.V1Constants.Indexes.H3_INDEX_FILE_EXTENSION; + + +public class H3IndexCreator implements GeoSpatialIndexCreator { + + private static final int VERSION = 1; + private static final int FLUSH_THRESHOLD = 100_000; + private final H3Core _h3Core; + private File _indexDir; + private FieldSpec _fieldSpec; + private int _resolution; + + TreeMap<Long, MutableRoaringBitmap> _h3IndexMap; + + int numChunks = 0; + List<Integer> chunkLengths = new ArrayList<>(); + + public H3IndexCreator(File indexDir, FieldSpec fieldSpec, int resolution) + throws IOException { + + _indexDir = indexDir; + _fieldSpec = fieldSpec; + _resolution = resolution; Review comment: we should have that as part of the indexconfig. May be support multiple resolutions. No need to extend this class. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org