Skip to content

Commit 0bab6f2

Browse files
authored
[patch] Avoid Null entries in DB2
[patch] Avoid Null entries in DB2
2 parents e7d8e54 + 7d6fb1c commit 0bab6f2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

iotfunctions/stages.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,14 @@ def store_derived_metrics(self, dataFrame):
202202
rowVals.append(None)
203203

204204
if metric_type[1]:
205-
myFloat = float(derivedMetricVal)
206-
rowVals.append(myFloat if np.isfinite(myFloat) else None)
205+
float_value = float(derivedMetricVal)
206+
if np.isfinite(float_value):
207+
rowVals.append(float_value)
208+
else:
209+
# Metric is infinite (np.inf). This can happen after a division by zero in the
210+
# calculation. We handle infinite values as None. Consequently, nothing to write to
211+
# db2.
212+
continue
207213
else:
208214
rowVals.append(None)
209215

0 commit comments

Comments
 (0)