yaooqinn commented on code in PR #12114:
URL: https://github.com/apache/gluten/pull/12114#discussion_r3265060815
##########
gluten-arrow/src/main/java/org/apache/gluten/vectorized/GlutenSplitResult.java:
##########
@@ -122,4 +139,32 @@ public double getAvgDictionaryFields() {
public long getDictionarySize() {
return dictionarySize;
}
+
+ /**
+ * Backend-specific shuffle writer metrics, keyed by
`<Backend>.<Family>.<Stat>`. The map
+ * preserves the iteration order JNI marshalled, but callers should treat
the map as unordered.
+ * Returns an empty map if the native side did not populate any custom
metrics (e.g. older Gluten
+ * libs, or backends that don't yet emit any). The returned map is
unmodifiable.
+ */
+ public Map<String, Long> getCustomMetrics() {
+ Map<String, Long> cached = customMetricsCache;
+ if (cached != null) {
+ return cached;
+ }
+ synchronized (this) {
+ if (customMetricsCache != null) {
+ return customMetricsCache;
+ }
+ if (customMetricsKeys == null || customMetricsKeys.length == 0) {
Review Comment:
`getCustomMetrics()` trusts `customMetricsValues.length ==
customMetricsKeys.length`. If a future producer ships mismatched arrays, the
AIOOBE inside the synchronized block leaves the volatile cache field unassigned
— subsequent calls re-enter and AIOOBE again. Suggest a
`Preconditions.checkArgument(...)` at the top + one suite case.
--
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]