From b6bba1650562486bf20667caeec40c4cc65b5cfe Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Tue, 18 Aug 2020 00:31:40 -0400 Subject: [PATCH] fsck: fix error in reporting row number for timestamp errors Since we process in chunks, we need to add "start" to the row number; however, we don't need to use this when accessing data['timestamp'] (aka ts) --- nilmdb/fsck/fsck.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nilmdb/fsck/fsck.py b/nilmdb/fsck/fsck.py index b4bc0db..d8ecb1a 100644 --- a/nilmdb/fsck/fsck.py +++ b/nilmdb/fsck/fsck.py @@ -511,18 +511,20 @@ class Fsck(object): # Verify that all timestamps are in range. match = (ts < stime) | (ts >= etime) if match.any(): - row = start + numpy.argmax(match) + row = numpy.argmax(match) raise FsckError("%s: data timestamp %d at row %d " "outside interval range [%d,%d)", - path, data['timestamp'][row], row, + path, ts[row], row + start, stime, etime) # Verify that timestamps are monotonic match = numpy.diff(ts) <= 0 if match.any(): - row = start + numpy.argmax(match) - raise FsckError("%s: non-monotonic timestamp (%d -> %d) " - "at row %d", path, ts[row], ts[row+1], row) + row = numpy.argmax(match) + raise FsckError("%s: non-monotonic timestamp (%d -> %d)" + " at row %d", path, ts[row], ts[row+1], + row + start) + first_ts = ts[0] if last_ts is not None and first_ts <= last_ts: raise FsckError("%s: first interval timestamp %d is not "