Copilot commented on code in PR #17590:
URL: https://github.com/apache/pinot/pull/17590#discussion_r2739502368
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MultiStageOperator.java:
##########
@@ -426,21 +423,67 @@ public void updateServerMetrics(StatMap<?> map,
ServerMetrics serverMetrics) {
}
}
},
- LOOKUP_JOIN(LookupJoinOperator.StatKey.class) {
+ LOOKUP_JOIN(14, LookupJoinOperator.StatKey.class) {
@Override
public void mergeInto(BrokerResponseNativeV2 response, StatMap<?> map) {
@SuppressWarnings("unchecked")
StatMap<LookupJoinOperator.StatKey> stats =
(StatMap<LookupJoinOperator.StatKey>) map;
response.mergeMaxRowsInOperator(stats.getLong(LookupJoinOperator.StatKey.EMITTED_ROWS));
}
+ },
+ UNNEST(15, UnnestOperator.StatKey.class) {
+ @Override
+ public void mergeInto(BrokerResponseNativeV2 response, StatMap<?> map) {
+ @SuppressWarnings("unchecked")
+ StatMap<UnnestOperator.StatKey> stats =
(StatMap<UnnestOperator.StatKey>) map;
+
response.mergeMaxRowsInOperator(stats.getLong(UnnestOperator.StatKey.EMITTED_ROWS));
+ }
};
+ private static final Map<Integer, Type> ID_TO_TYPE;
+
+ static {
+ Map<Integer, Type> map = new HashMap<>();
+ for (Type type : values()) {
+ int id = type._id;
+ if (id < 0 || id > Byte.MAX_VALUE) {
Review Comment:
The validation allows `id == Byte.MAX_VALUE` (127), but since the ID is
written using `output.writeByte()` and compared as a signed byte, negative
values are possible when reading back. Values from 128-255 would be interpreted
as negative when read. The upper bound should be 127 to match the signed byte
range used in serialization.
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MultiStageOperator.java:
##########
@@ -426,21 +423,67 @@ public void updateServerMetrics(StatMap<?> map,
ServerMetrics serverMetrics) {
}
}
},
- LOOKUP_JOIN(LookupJoinOperator.StatKey.class) {
+ LOOKUP_JOIN(14, LookupJoinOperator.StatKey.class) {
@Override
public void mergeInto(BrokerResponseNativeV2 response, StatMap<?> map) {
@SuppressWarnings("unchecked")
StatMap<LookupJoinOperator.StatKey> stats =
(StatMap<LookupJoinOperator.StatKey>) map;
response.mergeMaxRowsInOperator(stats.getLong(LookupJoinOperator.StatKey.EMITTED_ROWS));
}
+ },
+ UNNEST(15, UnnestOperator.StatKey.class) {
+ @Override
+ public void mergeInto(BrokerResponseNativeV2 response, StatMap<?> map) {
+ @SuppressWarnings("unchecked")
+ StatMap<UnnestOperator.StatKey> stats =
(StatMap<UnnestOperator.StatKey>) map;
+
response.mergeMaxRowsInOperator(stats.getLong(UnnestOperator.StatKey.EMITTED_ROWS));
+ }
};
+ private static final Map<Integer, Type> ID_TO_TYPE;
+
+ static {
+ Map<Integer, Type> map = new HashMap<>();
+ for (Type type : values()) {
+ int id = type._id;
+ if (id < 0 || id > Byte.MAX_VALUE) {
+ throw new IllegalStateException("Operator type id must fit in a
signed byte (0-127), but " + type
+ + " has id " + id);
+ }
+ Type existing = map.put(id, type);
+ if (existing != null) {
+ throw new IllegalStateException("Duplicate id " + id + " for types "
+ existing + " and " + type);
+ }
+ }
+ ID_TO_TYPE = Map.copyOf(map);
+ }
+
+ private final int _id;
private final Class _statKeyClass;
Review Comment:
The field `_statKeyClass` is missing a generic type parameter. It should be
declared as `Class<? extends StatMap.Key>` to maintain type safety and be
consistent with the constructor parameter type.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]