pan3793 commented on code in PR #5352:
URL: https://github.com/apache/kyuubi/pull/5352#discussion_r1349994164


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala:
##########
@@ -190,15 +193,21 @@ class JDBCMetadataStore(conf: KyuubiConf) extends 
MetadataStore with Logging {
         valueAsString(metadata.requestArgs),
         metadata.createTime,
         Option(metadata.engineType).map(_.toUpperCase(Locale.ROOT)).orNull,
-        metadata.clusterManager.orNull)
+        metadata.clusterManager.orNull,
+        metadata.priority)
     }
   }
 
   override def pickMetadata(kyuubiInstance: String): Option[Metadata] = 
synchronized {
+    val orderByCondition = if (priorityEnabled) {
+      "priority DESC, create_time ASC"
+    } else {
+      "create_time ASC"
+    }
     JdbcUtils.executeQueryWithRowMapper(
       s"""SELECT identifier FROM $METADATA_TABLE
          |WHERE state=?
-         |ORDER BY create_time ASC LIMIT 1
+         |ORDER BY $orderByCondition LIMIT 1

Review Comment:
   ```suggestion
            |ORDER BY ${if (priorityEnabled) "priority DESC," else ""} 
create_time ASC LIMIT 1
   ```



-- 
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]

Reply via email to