You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "npawar (via GitHub)" <gi...@apache.org> on 2023/05/02 23:57:06 UTC

[GitHub] [pinot] npawar commented on a diff in pull request #10687: Implement mutable index using index SPI

npawar commented on code in PR #10687:
URL: https://github.com/apache/pinot/pull/10687#discussion_r1183110842


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/IndexType.java:
##########
@@ -105,4 +107,16 @@ IndexHandler createIndexHandler(SegmentDirectory segmentDirectory, Map<String, F
    * old format.
    */
   void convertToNewFormat(TableConfig tableConfig, Schema schema);
+

Review Comment:
   remove the TODO on top of this class now?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/recommender/realtime/provisioning/MemoryEstimator.java:
##########
@@ -387,9 +375,13 @@ private int getAvgMultiValues() {
   private long getMemoryForInvertedIndex(long totalMemoryForConsumingSegment) {
     // TODO: better way to estimate inverted indexes memory utilization
     long totalInvertedIndexSizeBytes = 0;
-    if (!_invertedIndexColumns.isEmpty()) {
+    Map<String, IndexConfig> invertedConfig = StandardIndexes.inverted().getConfig(_tableConfig, _schema);

Review Comment:
   this is a lot of code to check if invertedIndexColumns exist. SHould we put this into a util so it can be reused by others and not accidentally use the old way?



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/json/JsonIndexType.java:
##########
@@ -164,4 +167,16 @@ protected void handleIndexSpecificCleanup(TableConfig tableConfig) {
     tableConfig.getIndexingConfig().setJsonIndexColumns(null);
     tableConfig.getIndexingConfig().setJsonIndexConfigs(null);
   }
+
+  @Nullable
+  @Override
+  public MutableIndex createMutableIndex(MutableIndexContext context, JsonIndexConfig config) {
+    if (config.isDisabled()) {
+      return null;
+    }
+    if (!context.getFieldSpec().isSingleValueField()) {

Review Comment:
   is this check needed? (for all indexes that dont support MV). Shouldn't this be caught by validation itself? 



##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/mutable/MutableIndex.java:
##########
@@ -0,0 +1,48 @@
+/**
+ * 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.segment.spi.index.mutable;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.apache.pinot.segment.spi.index.IndexReader;
+
+
+public interface MutableIndex extends IndexReader {

Review Comment:
   I see this is extending IndexReader because the implementations  like RealtimeInvertedIndex are acting as Reader as well as Creator. 
   1. would it be a tall order to split that up and clean it up for all impls?
   2. If 1 is too much, can we take Saurabh's suggestion and have this extend IndexCreator too by unifying the signatures?
   Either way, please add javadocs to the interface, it is confusing to understand without that as to why this interface has add methods but is extending Reader 



-- 
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: commits-unsubscribe@pinot.apache.org

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