turboFei commented on code in PR #6829:
URL: https://github.com/apache/kyuubi/pull/6829#discussion_r1866690901


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala:
##########
@@ -257,14 +257,15 @@ class JDBCMetadataStore(conf: KyuubiConf) extends 
MetadataStore with Logging {
       filter: MetadataFilter,
       from: Int,
       size: Int,
-      desc: Boolean = false): Seq[Metadata] = {
+      desc: Boolean = false,
+      orderByKeyId: Boolean = true): Seq[Metadata] = {
     val queryBuilder = new StringBuilder
     val params = ListBuffer[Any]()
     queryBuilder.append("SELECT ")
     queryBuilder.append(METADATA_COLUMNS)
     queryBuilder.append(s" FROM $METADATA_TABLE")
     queryBuilder.append(s" ${assembleWhereClause(filter, params)}")
-    queryBuilder.append(" ORDER BY key_id ")
+    queryBuilder.append(" ORDER BY ").append(if (orderByKeyId) "key_id " else 
"create_time ")

Review Comment:
   It is not guaranteed.
   
   <img width="921" alt="image" 
src="https://github.com/user-attachments/assets/e5f09198-c2e2-410a-b17a-a66794c00611";>
   
   



##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala:
##########
@@ -257,14 +257,15 @@ class JDBCMetadataStore(conf: KyuubiConf) extends 
MetadataStore with Logging {
       filter: MetadataFilter,
       from: Int,
       size: Int,
-      desc: Boolean = false): Seq[Metadata] = {
+      desc: Boolean = false,
+      orderByKeyId: Boolean = true): Seq[Metadata] = {
     val queryBuilder = new StringBuilder
     val params = ListBuffer[Any]()
     queryBuilder.append("SELECT ")
     queryBuilder.append(METADATA_COLUMNS)
     queryBuilder.append(s" FROM $METADATA_TABLE")
     queryBuilder.append(s" ${assembleWhereClause(filter, params)}")
-    queryBuilder.append(" ORDER BY key_id ")
+    queryBuilder.append(" ORDER BY ").append(if (orderByKeyId) "key_id " else 
"create_time ")

Review Comment:
   Looks good:
   <img width="1099" alt="image" 
src="https://github.com/user-attachments/assets/0d671de3-dae2-41f5-b5a8-f5a1df14959b";>
   



-- 
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: notifications-unsubscr...@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to