mqliang commented on a change in pull request #6710:
URL: https://github.com/apache/incubator-pinot/pull/6710#discussion_r603667157
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/utils/DataTable.java
##########
@@ -80,4 +85,88 @@
double[] getDoubleArray(int rowId, int colId);
String[] getStringArray(int rowId, int colId);
+
+ /* The MetadataKeys is used in V3, where we present metadata as
Map<MetadataKeys, String>
+ * ATTENTION:
+ * - Don't add new key which has same id/name with existing keys. Duplicate
name is not allowed.
+ * - Don't change name of existing keys.
+ * - Don't remove existing keys.
+ * - Always add new keys to the end.
+ * Otherwise, backward compatibility will be broken.
+ */
+ enum MetadataKeys {
+ UNKNOWN("unknown"),
+ TABLE("table"), // NOTE: this key is only used in PrioritySchedulerTest
+ EXCEPTION("Exception"),
+ NUM_DOCS_SCANNED("numDocsScanned"),
+ NUM_ENTRIES_SCANNED_IN_FILTER("numEntriesScannedInFilter"),
+ NUM_ENTRIES_SCANNED_POST_FILTER("numEntriesScannedPostFilter"),
+ NUM_SEGMENTS_QUERIED("numSegmentsQueried"),
+ NUM_SEGMENTS_PROCESSED("numSegmentsProcessed"),
+ NUM_SEGMENTS_MATCHED("numSegmentsMatched"),
+ NUM_CONSUMING_SEGMENTS_PROCESSED("numConsumingSegmentsProcessed"),
+ MIN_CONSUMING_FRESHNESS_TIME_MS("minConsumingFreshnessTimeMs"),
+ TOTAL_DOCS("totalDocs"),
+ NUM_GROUPS_LIMIT_REACHED("numGroupsLimitReached"),
+ TIME_USED_MS("timeUsedMs"),
+ TRACE_INFO("traceInfo"),
+ REQUEST_ID("requestId"),
+ NUM_RESIZES("numResizes"),
+ RESIZE_TIME_MS("resizeTimeMs"),
+ EXECUTION_THREAD_CPU_TIME_NS("executionThreadCpuTimeNs"),
+ ;
+
+ private static final Map<String, MetadataKeys> _nameToEnumKeyMap = new
HashMap<>();
+ // _intValueMetadataKeys contains all metadata keys which has value of int
type.
+ private static final Set<MetadataKeys> _intValueMetadataKeys = ImmutableSet
+ .of(MetadataKeys.NUM_SEGMENTS_QUERIED,
MetadataKeys.NUM_SEGMENTS_PROCESSED, MetadataKeys.NUM_SEGMENTS_MATCHED,
+ MetadataKeys.NUM_RESIZES,
MetadataKeys.NUM_CONSUMING_SEGMENTS_PROCESSED, MetadataKeys.NUM_RESIZES);
+ // _longValueMetadataKeys contains all metadata keys which has value of
long type.
+ private static final Set<MetadataKeys> _longValueMetadataKeys =
ImmutableSet
+ .of(MetadataKeys.NUM_DOCS_SCANNED,
MetadataKeys.NUM_ENTRIES_SCANNED_IN_FILTER,
+ MetadataKeys.NUM_ENTRIES_SCANNED_POST_FILTER,
MetadataKeys.MIN_CONSUMING_FRESHNESS_TIME_MS,
+ MetadataKeys.TOTAL_DOCS, MetadataKeys.TIME_USED_MS,
MetadataKeys.REQUEST_ID, MetadataKeys.RESIZE_TIME_MS,
+ MetadataKeys.EXECUTION_THREAD_CPU_TIME_NS);
+ private final String _name;
+
+ MetadataKeys(String name) {
Review comment:
The build-in `enumKey.name()` will return a string exactly the same as
the constant:
For example:
```
System.out.println(MetadataKeys.TOTAL_DOCS.name());
```
will output:
```
TOTAL_DOCS
```
However, the corresponding string should be "totalDocs". If we wanner use
the build-in `enumKey.name()`, we should define the metadata key constant as
`totalDocs`. I am fine with that.
--
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]