slfan1989 commented on code in PR #4846: URL: https://github.com/apache/hadoop/pull/4846#discussion_r969998465
########## hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/MySQL/FederationStateStoreStoredProcs.sql: ########## @@ -122,10 +122,26 @@ BEGIN WHERE applicationId = applicationID_IN; END // -CREATE PROCEDURE sp_getApplicationsHomeSubCluster() -BEGIN - SELECT applicationId, homeSubCluster - FROM applicationsHomeSubCluster; +CREATE PROCEDURE sp_getApplicationsHomeSubCluster(IN limit_IN int, IN homeSubCluster_IN varchar(256)) +BEGIN + SELECT + applicationId, + homeSubCluster, + createTime + FROM + (SELECT + applicationId, + homeSubCluster, + createTime, + @app_rank := IF(@home_sc = homeSubCluster, @app_rank + 1, 1) AS app_rank, + @home_sc := homeSubCluster + FROM applicationshomesubcluster + ORDER BY createTime DESC + ) ranked + WHERE app_rank <= limit_IN + AND (CASE WHEN t.homeSubCluster_IN IS NULL THEN 1 = 1 Review Comment: For MySQL, I also tried to refactor this SQL using a simpler way of writing. -- 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: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org