[SPARK-33132][WEBUI] Make formatBytes
return 0.0 B
for negative input instead of NaN
### What changes were proposed in this pull request? when bytesRead metric was negative, `formatBytes` in `ui.js` should just return `0.0 B` to avoid `NaN Undefined` result. ### Why are the changes needed? Strengthen the parameter validataion to improve metric display on Summary Metrics of Spark Stage UI. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? It's a small change, just manual test. Closes #30030 from akiyamaneko/formatBytes_NaN. Authored-by: neko <echohlne@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
This commit is contained in:
parent
304ca1ec93
commit
1bfcb51eeb
|
@ -39,7 +39,7 @@ function formatDuration(milliseconds) {
|
|||
|
||||
function formatBytes(bytes, type) {
|
||||
if (type !== 'display') return bytes;
|
||||
if (bytes == 0) return '0.0 B';
|
||||
if (bytes <= 0) return '0.0 B';
|
||||
var k = 1024;
|
||||
var dm = 1;
|
||||
var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
||||
|
|
Loading…
Reference in a new issue