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


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -768,115 +679,28 @@ private void addNewRow(int docId, GenericRow row) {
             }
           }
         }
-
-        // Update text index
-        MutableTextIndex textIndex = indexContainer._textIndex;
-        if (textIndex != null) {
-          try {
-            textIndex.add((String) value);
-          } catch (Exception e) {
-            recordIndexingError(FieldConfig.IndexType.TEXT, e);
-          }
-        }
-
-        // Update json index
-        MutableJsonIndex jsonIndex = indexContainer._jsonIndex;
-        if (jsonIndex != null) {
-          try {
-            jsonIndex.add((String) value);
-          } catch (Exception e) {
-            recordIndexingError(FieldConfig.IndexType.JSON, e);
-          }
-        }
-
-        // Update H3 index
-        MutableH3Index h3Index = indexContainer._h3Index;
-        if (h3Index != null) {
-          try {
-            h3Index.add(GeometrySerializer.deserialize((byte[]) value));
-          } catch (Exception e) {
-            recordIndexingError(FieldConfig.IndexType.H3, e);
-          }
-        }
       } else {
         // Multi-value column
 
         int[] dictIds = indexContainer._dictIds;
-
         indexContainer._valuesInfo.updateVarByteMVMaxRowLengthInBytes(value, 
dataType.getStoredType());
-
-        if (dictIds != null) {
-          // Dictionary encoded
-          // Update numValues info
-          indexContainer._valuesInfo.updateMVNumValues(dictIds.length);
-
-          // Update forward index
-          indexContainer._forwardIndex.setDictIdMV(docId, dictIds);
-
-          // Update inverted index
-          MutableInvertedIndex invertedIndex = indexContainer._invertedIndex;
-          if (invertedIndex != null) {
-            for (int dictId : dictIds) {
-              try {
-                invertedIndex.add(dictId, docId);
-              } catch (Exception e) {
-                recordIndexingError(FieldConfig.IndexType.INVERTED, e);
-              }
-            }
-          }
-        } else {
-          // Raw MV columns
-
-          switch (dataType.getStoredType()) {
-            case INT:
-              Object[] values = (Object[]) value;
-              int[] intValues = new int[values.length];
-              for (int i = 0; i < values.length; i++) {
-                intValues[i] = (Integer) values[i];
-              }
-              indexContainer._forwardIndex.setIntMV(docId, intValues);
-              indexContainer._valuesInfo.updateMVNumValues(intValues.length);
-              break;
-            case LONG:
-              values = (Object[]) value;
-              long[] longValues = new long[values.length];
-              for (int i = 0; i < values.length; i++) {
-                longValues[i] = (Long) values[i];
-              }
-              indexContainer._forwardIndex.setLongMV(docId, longValues);
-              indexContainer._valuesInfo.updateMVNumValues(longValues.length);
-              break;
-            case FLOAT:
-              values = (Object[]) value;
-              float[] floatValues = new float[values.length];
-              for (int i = 0; i < values.length; i++) {
-                floatValues[i] = (Float) values[i];
-              }
-              indexContainer._forwardIndex.setFloatMV(docId, floatValues);
-              indexContainer._valuesInfo.updateMVNumValues(floatValues.length);
-              break;
-            case DOUBLE:
-              values = (Object[]) value;
-              double[] doubleValues = new double[values.length];
-              for (int i = 0; i < values.length; i++) {
-                doubleValues[i] = (Double) values[i];
-              }
-              indexContainer._forwardIndex.setDoubleMV(docId, doubleValues);
-              
indexContainer._valuesInfo.updateMVNumValues(doubleValues.length);
-              break;
-            default:
-              throw new UnsupportedOperationException(
-                  "Unsupported data type: " + dataType + " for MV 
no-dictionary column: " + column);
+        Object[] values = (Object[]) value;
+        for (Map.Entry<IndexType, MutableIndex> indexEntry : 
indexContainer._mutableIndexes.entrySet()) {
+          try {
+            indexEntry.getValue().add(values, dictIds, docId);
+          } catch (Exception e) {
+            recordIndexingError(indexEntry.getKey(), e);
           }
         }
+        indexContainer._valuesInfo.updateMVNumValues(values.length);
       }
     }
   }
 
-  private void recordIndexingError(FieldConfig.IndexType indexType, Exception 
exception) {
+  private void recordIndexingError(IndexType<?, ?, ?> indexType, Exception 
exception) {
     _logger.error("failed to index value with {}", indexType, exception);
     if (_serverMetrics != null) {
-      String metricKeyName = _realtimeTableName + "-" + indexType + 
"-indexingError";
+      String metricKeyName = _realtimeTableName + "-" + 
indexType.getPrettyName() + "-indexingError";

Review Comment:
   This is where I say metric names may be different. I think `prettyName` is 
the same text, but in lowercase.



-- 
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-unsubscr...@pinot.apache.org

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

Reply via email to