You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2022/01/14 05:49:16 UTC

[superset] branch master updated: fix: handle null values in time-series table (#18039)

This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 26dc600  fix: handle null values in time-series table (#18039)
26dc600 is described below

commit 26dc600aff9dac446c0458270a2e1dbde0736e21
Author: Grace Guo <gr...@airbnb.com>
AuthorDate: Thu Jan 13 21:47:07 2022 -0800

    fix: handle null values in time-series table (#18039)
---
 .../src/visualizations/TimeTable/TimeTable.jsx          | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx b/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
index b02eb98..adef183 100644
--- a/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
+++ b/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
@@ -192,14 +192,17 @@ const TimeTable = ({
         } else {
           v = reversedEntries[timeLag][valueField];
         }
-        if (column.comparisonType === 'diff') {
-          v = recent - v;
-        } else if (column.comparisonType === 'perc') {
-          v = recent / v;
-        } else if (column.comparisonType === 'perc_change') {
-          v = recent / v - 1;
+        if (typeof v === 'number' || typeof recent === 'number') {
+          if (column.comparisonType === 'diff') {
+            v = recent - v;
+          } else if (column.comparisonType === 'perc') {
+            v = recent / v;
+          } else if (column.comparisonType === 'perc_change') {
+            v = recent / v - 1;
+          }
+        } else {
+          v = 'N/A';
         }
-        v = v || 0;
       } else if (column.colType === 'contrib') {
         // contribution to column total
         v =