siddharthteotia commented on a change in pull request #6710:
URL: https://github.com/apache/incubator-pinot/pull/6710#discussion_r606091546



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/utils/DataTable.java
##########
@@ -80,4 +82,76 @@
   double[] getDoubleArray(int rowId, int colId);
 
   String[] getStringArray(int rowId, int colId);
+
+  enum MetadataValueType {
+    INT, LONG, STRING
+  }
+
+  /* The MetadataKey is used in V3, where we present metadata as 
Map<MetadataKey, String>
+   * ATTENTION:
+   *  - Don't change existing keys.
+   *  - Don't remove existing keys.
+   *  - Always add new keys to the end.
+   *  Otherwise, backward compatibility will be broken.
+   */
+  enum MetadataKey {
+    UNKNOWN("unknown", MetadataValueType.STRING),
+    TABLE("table", MetadataValueType.STRING), // NOTE: this key is only used 
in PrioritySchedulerTest
+    NUM_DOCS_SCANNED("numDocsScanned", MetadataValueType.LONG),
+    NUM_ENTRIES_SCANNED_IN_FILTER("numEntriesScannedInFilter", 
MetadataValueType.LONG),
+    NUM_ENTRIES_SCANNED_POST_FILTER("numEntriesScannedPostFilter", 
MetadataValueType.LONG),
+    NUM_SEGMENTS_QUERIED("numSegmentsQueried", MetadataValueType.INT),
+    NUM_SEGMENTS_PROCESSED("numSegmentsProcessed", MetadataValueType.INT),
+    NUM_SEGMENTS_MATCHED("numSegmentsMatched", MetadataValueType.INT),
+    NUM_CONSUMING_SEGMENTS_PROCESSED("numConsumingSegmentsProcessed", 
MetadataValueType.INT),
+    MIN_CONSUMING_FRESHNESS_TIME_MS("minConsumingFreshnessTimeMs", 
MetadataValueType.LONG),
+    TOTAL_DOCS("totalDocs", MetadataValueType.LONG),
+    NUM_GROUPS_LIMIT_REACHED("numGroupsLimitReached", 
MetadataValueType.STRING),
+    TIME_USED_MS("timeUsedMs", MetadataValueType.LONG),
+    TRACE_INFO("traceInfo", MetadataValueType.STRING),
+    REQUEST_ID("requestId", MetadataValueType.LONG),
+    NUM_RESIZES("numResizes", MetadataValueType.INT),
+    RESIZE_TIME_MS("resizeTimeMs", MetadataValueType.LONG),
+    THREAD_CPU_TIME_NS("threadCpuTimeNs", MetadataValueType.LONG);
+
+    private static final Map<String, MetadataKey> _nameToEnumKeyMap = new 
HashMap<>();
+    private final String _name;
+    private final MetadataValueType _valueType;
+
+    MetadataKey(String name, MetadataValueType valueType) {
+      this._name = name;
+      this._valueType = valueType;
+    }
+
+    // getByOrdinal returns an optional enum key for a given ordinal or null 
if the key does not exist.
+    public static MetadataKey getByOrdinal(int ordinal) {
+      if (ordinal >= MetadataKey.values().length) {
+        return null;
+      }
+      return MetadataKey.values()[ordinal];
+    }
+
+    // getByName returns an enum key for a given name or null if the key does 
not exist.
+    public static MetadataKey getByName(String name) {
+      return _nameToEnumKeyMap.getOrDefault(name, null);
+    }

Review comment:
       @mqliang , can you please address this?




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to