This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit cc5205f6d13081c0d9b3f2654bd7b16ca54930eb
Author: Tiewei Fang <43782773+bepppo...@users.noreply.github.com>
AuthorDate: Wed Jan 31 20:52:18 2024 +0800

    [fix](JDK17) The objects stored in `PriorityQueue` must implement the 
`Comparable` interface (#30050) (#30625)
    
    Issue Number:  #30484
    
    The objects stored in PriorityQueue must implement the Comparable interface 
or passed into the customized `Comparator`.
    
    If we don't do this, run the program in the JDK17 environment will report 
an exception:
    ```java
    Caused by: java.lang.AssertionError: Expect exception msg contains 'query 
wait timeout', but meet
    'java.sql.SQLException: ClassCastException,
    msg: class org.apache.doris.resource.workloadgroup.QueueToken cannot be 
cast to class java.lang.Comparable
    (org.apache.doris.resource.workloadgroup.QueueToken is in unnamed module of 
loader 'app'; java.lang.Comparable is in module java.base of loader 
'bootstrap')'
    ```
---
 .../org/apache/doris/resource/workloadgroup/QueueToken.java    | 10 +++++++++-
 .../array_functions/test_array_zip_array_enumerate_uniq.groovy |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueueToken.java
 
b/fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueueToken.java
index 17299d3ea3b..189ba77e8de 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueueToken.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueueToken.java
@@ -28,9 +28,14 @@ import java.util.concurrent.locks.ReentrantLock;
 // used to mark QueryQueue offer result
 // if offer failed, then need to cancel query
 // and return failed reason to user client
-public class QueueToken {
+public class QueueToken implements Comparable<QueueToken> {
     private static final Logger LOG = LogManager.getLogger(QueueToken.class);
 
+    @Override
+    public int compareTo(QueueToken other) {
+        return Long.compare(this.tokenId, other.getTokenId());
+    }
+
     enum TokenState {
         ENQUEUE_SUCCESS,
         READY_TO_RUN
@@ -136,4 +141,7 @@ public class QueueToken {
         return tokenId == other.tokenId;
     }
 
+    public long getTokenId() {
+        return tokenId;
+    }
 }
diff --git 
a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy
 
b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy
index b8207c1ee76..38772921ece 100644
--- 
a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy
+++ 
b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy
@@ -25,7 +25,7 @@ suite("test_array_zip_array_enumerate_uniq", "p0") {
                SELECT array_zip();
                 """
     } catch (Exception ex) {
-        assertTrue(ex.getMessage().contains("errCode = 2, detailMessage = 
Unexpected exception: 0"))
+        assertTrue(ex.getMessage().contains("errCode = 2, detailMessage = 
Unexpected exception: "))
     }
 
     try {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to