This is an automated email from the ASF dual-hosted git repository. srowen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 9717d74d072 [SPARK-44332][CORE][WEBUI] Fix the sorting error of Executor ID Column on Executors UI Page 9717d74d072 is described below commit 9717d74d0726bd177b8d0f0cc2c9b0404f82dafc Author: panbingkun <pbk1...@gmail.com> AuthorDate: Mon Jul 10 19:15:56 2023 -0500 [SPARK-44332][CORE][WEBUI] Fix the sorting error of Executor ID Column on Executors UI Page ### What changes were proposed in this pull request? The pr aims to fix the sorting error of `Executor ID` Column on `Executor Page`. ### Why are the changes needed? Fix UI Sort bug. PS: Can be reproduced using: sh bin/spark-shell --master "local-cluster[12,1,1024]" - Before patch Before - asc: <img width="1407" alt="image" src="https://github.com/apache/spark/assets/15246973/83648087-804a-4a62-8f3e-c748f46b95d7"> Before - desc: <img width="1405" alt="image" src="https://github.com/apache/spark/assets/15246973/b68547f3-af36-4e97-b922-7c3ffa3cbb30"> - After patch After - asc: <img width="1408" alt="image" src="https://github.com/apache/spark/assets/15246973/9fd40fc7-9b72-4a08-8e16-a89d9625a1a0"> After - desc: <img width="1408" alt="image" src="https://github.com/apache/spark/assets/15246973/11921083-30cc-46e9-a9f6-1fe9aecde1a7"> ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - Pass GA. - Manually test. Closes #41887 from panbingkun/align_executor_id. Authored-by: panbingkun <pbk1...@gmail.com> Signed-off-by: Sean Owen <sro...@gmail.com> --- .../org/apache/spark/ui/static/executorspage.js | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/core/src/main/resources/org/apache/spark/ui/static/executorspage.js b/core/src/main/resources/org/apache/spark/ui/static/executorspage.js index 520efbd6def..38dc446eaac 100644 --- a/core/src/main/resources/org/apache/spark/ui/static/executorspage.js +++ b/core/src/main/resources/org/apache/spark/ui/static/executorspage.js @@ -96,6 +96,32 @@ jQuery.extend(jQuery.fn.dataTableExt.oSort, { } }); +jQuery.extend( jQuery.fn.dataTableExt.oSort, { + "executor-id-asc": function ( a, b ) { + if ($.isNumeric(a) && $.isNumeric(b)) { + return parseFloat(a) - parseFloat(b); + } else if (!$.isNumeric(a) && $.isNumeric(b)) { + return -1; + } else if ($.isNumeric(a) && !$.isNumeric(b)) { + return 1; + } else { + return a.localeCompare(b); + } + }, + + "executor-id-desc": function ( a, b ) { + if ($.isNumeric(a) && $.isNumeric(b)) { + return parseFloat(b) - parseFloat(a); + } else if (!$.isNumeric(a) && $.isNumeric(b)) { + return 1; + } else if ($.isNumeric(a) && !$.isNumeric(b)) { + return -1; + } else { + return b.localeCompare(a); + } + } +}); + $(document).ajaxStop($.unblockUI); $(document).ajaxStart(function () { $.blockUI({message: '<h3>Loading Executors Page...</h3>'}); @@ -403,9 +429,8 @@ $(document).ready(function () { "data": response, "columns": [ { - data: function (row, type) { - return type !== 'display' ? (isNaN(row.id) ? 0 : row.id ) : row.id; - } + data: "id", + type: "executor-id" }, {data: 'hostPort'}, { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org