From a8c2b60fd2520f1ea3dc01714000fd452df29981 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Tue, 10 Feb 2026 15:48:11 -0800 Subject: [PATCH] fix vsf load wait metric in ChannelCounters snapshot --- .../druid/msq/counters/ChannelCounters.java | 5 ++- .../msq/counters/ChannelCountersTest.java | 32 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 multi-stage-query/src/test/java/org/apache/druid/msq/counters/ChannelCountersTest.java diff --git a/multi-stage-query/src/main/java/org/apache/druid/msq/counters/ChannelCounters.java b/multi-stage-query/src/main/java/org/apache/druid/msq/counters/ChannelCounters.java index becd4552a952..29e7290ca3f3 100644 --- a/multi-stage-query/src/main/java/org/apache/druid/msq/counters/ChannelCounters.java +++ b/multi-stage-query/src/main/java/org/apache/druid/msq/counters/ChannelCounters.java @@ -365,7 +365,7 @@ public long[] getLoadTime() @JsonInclude(JsonInclude.Include.NON_NULL) public long[] getLoadWait() { - return loadTime; + return loadWait; } @JsonProperty @@ -392,6 +392,7 @@ public boolean equals(Object o) && Arrays.equals(totalFiles, snapshot.totalFiles) && Arrays.equals(loadBytes, snapshot.loadBytes) && Arrays.equals(loadTime, snapshot.loadTime) + && Arrays.equals(loadWait, snapshot.loadWait) && Arrays.equals(loadFiles, snapshot.loadFiles); } @@ -405,6 +406,7 @@ public int hashCode() result = 31 * result + Arrays.hashCode(totalFiles); result = 31 * result + Arrays.hashCode(loadBytes); result = 31 * result + Arrays.hashCode(loadTime); + result = 31 * result + Arrays.hashCode(loadWait); result = 31 * result + Arrays.hashCode(loadFiles); return result; } @@ -420,6 +422,7 @@ public String toString() ", totalFiles=" + Arrays.toString(totalFiles) + ", loadBytes=" + Arrays.toString(loadBytes) + ", loadTime=" + Arrays.toString(loadTime) + + ", loadWait=" + Arrays.toString(loadWait) + ", loadFiles=" + Arrays.toString(loadFiles) + '}'; } diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/counters/ChannelCountersTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/counters/ChannelCountersTest.java new file mode 100644 index 000000000000..6ca406b2272a --- /dev/null +++ b/multi-stage-query/src/test/java/org/apache/druid/msq/counters/ChannelCountersTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.msq.counters; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.junit.jupiter.api.Test; + +class ChannelCountersTest +{ + @Test + void testSnapshotEqualsAndHashcode() + { + EqualsVerifier.forClass(ChannelCounters.Snapshot.class).usingGetClass().verify(); + } +}