sliftutils 1.4.20 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -97,12 +97,18 @@ export function streamReaderFromEntries(entries: StreamEntry[], totalBytes: numb
|
|
|
97
97
|
// Per-key tombstone times for the join's delete resolution.
|
|
98
98
|
let deleteTimes = new Map<string, number>();
|
|
99
99
|
for (let key of deletedKeys) deleteTimes.set(key, times.get(key) || 0);
|
|
100
|
-
|
|
100
|
+
// Iterate to find min/max — NOT Math.min(...times)/Math.max(...times): spreading a large array as call
|
|
101
|
+
// arguments overflows the stack ("Maximum call stack size exceeded") once a stream has many keys.
|
|
102
|
+
let minTime = Infinity, maxTime = -Infinity;
|
|
103
|
+
for (let t of times.values()) {
|
|
104
|
+
if (t < minTime) minTime = t;
|
|
105
|
+
if (t > maxTime) maxTime = t;
|
|
106
|
+
}
|
|
101
107
|
let reader: BaseBulkDatabaseReader = {
|
|
102
108
|
totalBytes,
|
|
103
109
|
rowCount: keys.length,
|
|
104
|
-
minTime:
|
|
105
|
-
maxTime:
|
|
110
|
+
minTime: times.size ? minTime : 0,
|
|
111
|
+
maxTime: times.size ? maxTime : 0,
|
|
106
112
|
keys,
|
|
107
113
|
keyTimes: new Map(keys.map(key => [key, times.get(key) || 0])),
|
|
108
114
|
columns,
|