qvdjs 2.2.1 → 2.2.2
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/dist/index.cjs +26 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5129,12 +5129,14 @@ var init_QvdFileReader = __esm({
|
|
|
5129
5129
|
* viewer scrolls to - and the header is already in hand. `parseHeaderOnly` has to have run.
|
|
5130
5130
|
*
|
|
5131
5131
|
* @param {QvdRowWindow} window The rows the read would cover, normalised.
|
|
5132
|
-
* @param {{chunkSize?: number|null, fields?: Array<string>|null, materialisesRows?: boolean
|
|
5133
|
-
* `chunkSize` for an `iterate()`; `fields` and `materialisesRows` to ask
|
|
5134
|
-
* one this reader was built for, which is what a `QvdFile` does per call
|
|
5132
|
+
* @param {{chunkSize?: number|null, fields?: Array<string>|null, materialisesRows?: boolean,
|
|
5133
|
+
* paging?: boolean}} [options] `chunkSize` for an `iterate()`; `fields` and `materialisesRows` to ask
|
|
5134
|
+
* about a read other than the one this reader was built for, which is what a `QvdFile` does per call;
|
|
5135
|
+
* `paging` to say whether the read being asked about is a paging read, which defaults to whether this
|
|
5136
|
+
* reader is one.
|
|
5135
5137
|
* @return {any} The answer - see `checkMemory`.
|
|
5136
5138
|
*/
|
|
5137
|
-
checkParsed(window, { chunkSize = null, fields = void 0, materialisesRows = void 0 } = {}) {
|
|
5139
|
+
checkParsed(window, { chunkSize = null, fields = void 0, materialisesRows = void 0, paging = this._symbolCache !== null } = {}) {
|
|
5138
5140
|
assert4(this._header && this._allFields, "The QVD file header has not been parsed.");
|
|
5139
5141
|
const header = this._header["QvdTableHeader"];
|
|
5140
5142
|
const totalRows = headerInteger(header["NoOfRecords"]);
|
|
@@ -5145,15 +5147,13 @@ var init_QvdFileReader = __esm({
|
|
|
5145
5147
|
const resolved = resolveWindow(window, totalRows);
|
|
5146
5148
|
const windowRows = resolved.limit;
|
|
5147
5149
|
const liveRows = chunkSize === null ? null : { rows: chunkSize * 2, perChunk: 2 };
|
|
5148
|
-
const analysisAhead = this.
|
|
5150
|
+
const analysisAhead = paging ? false : this._analysisWouldRun(window, resolved, totalRows, symbolTableLength);
|
|
5149
5151
|
const measured = getMemoryBudget();
|
|
5150
5152
|
const ask = /* @__PURE__ */ __name((asked, rows) => {
|
|
5151
|
-
const
|
|
5152
|
-
const
|
|
5153
|
-
const
|
|
5154
|
-
|
|
5155
|
-
symbolTableLength
|
|
5156
|
-
);
|
|
5153
|
+
const held = paging ? this._fieldsHeldAfter(asked, this._allFields) : asked;
|
|
5154
|
+
const bytes = symbolBytesOf(held, symbolTableLength);
|
|
5155
|
+
const read = symbolBytesOf(paging ? this._fieldsReadBy(asked) : asked, symbolTableLength);
|
|
5156
|
+
const retained = paging ? symbolBytesOf(held.slice(asked.length), symbolTableLength) : 0;
|
|
5157
5157
|
return checkMemory({
|
|
5158
5158
|
measured,
|
|
5159
5159
|
symbolTableSize: bytes,
|
|
@@ -5164,7 +5164,7 @@ var init_QvdFileReader = __esm({
|
|
|
5164
5164
|
materialisesRows: builds,
|
|
5165
5165
|
live: liveRows,
|
|
5166
5166
|
// A paging read keeps whole columns, so it is charged for whole columns - see `estimateMemoryUsage`.
|
|
5167
|
-
wholeSymbols:
|
|
5167
|
+
wholeSymbols: paging,
|
|
5168
5168
|
retainedBytes: retained,
|
|
5169
5169
|
bytesHeld: this._bytesHeld(read, rows, recordSize, liveRows, analysisAhead, bytes - retained),
|
|
5170
5170
|
// What it reads from the file, which is not what it holds: the symbol areas it has still to read,
|
|
@@ -5499,12 +5499,16 @@ var init_QvdFile = __esm({
|
|
|
5499
5499
|
/**
|
|
5500
5500
|
* What a read of this file would cost, and whether it fits - with no I/O at all.
|
|
5501
5501
|
*
|
|
5502
|
-
*
|
|
5503
|
-
*
|
|
5502
|
+
* Without `chunkSize` it asks about a page, and answers for the page this file would read next: the
|
|
5503
|
+
* columns it names plus the ones earlier pages decoded and kept, since those are part of what the page
|
|
5504
|
+
* costs. With `chunkSize` it asks about an `iterate()` of the file instead - which this object cannot
|
|
5505
|
+
* make, but a caller holding it may want to weigh - and answers exactly as `QvdDataFrame.checkRead()`
|
|
5506
|
+
* would, from the header this file already holds rather than by reading it again.
|
|
5504
5507
|
*
|
|
5505
5508
|
* @param {{offset?: number, limit?: number|null, maxRows?: number|null, fields?: Array<string>|null,
|
|
5506
5509
|
* as?: 'rows'|'columns', chunkSize?: number|null}} [options] The read being asked about - the same
|
|
5507
|
-
* bag `rows()` takes, plus `as`
|
|
5510
|
+
* bag `rows()` takes, plus `as` to say which shape of page, and `chunkSize` to ask about an
|
|
5511
|
+
* `iterate()` of the file rather than a page.
|
|
5508
5512
|
* @return {any} The answer - `fits`, `reason`, `estimate`, `budget`, `exact`, `suggestions`.
|
|
5509
5513
|
* @throws {QvdValidationError} If the file is closed, or an option's value is not valid.
|
|
5510
5514
|
*/
|
|
@@ -5523,7 +5527,7 @@ var init_QvdFile = __esm({
|
|
|
5523
5527
|
if (chunkSize !== null) {
|
|
5524
5528
|
requireChunkSize(chunkSize, this._options.path);
|
|
5525
5529
|
}
|
|
5526
|
-
const reader = this._readers[as] ?? this._reader;
|
|
5530
|
+
const reader = chunkSize !== null ? this._reader : this._readers[as] ?? this._reader;
|
|
5527
5531
|
return reader.checkParsed(normaliseWindow(windowFrom(options), this._options.path), {
|
|
5528
5532
|
chunkSize,
|
|
5529
5533
|
// Resolved here rather than left to the reader, exactly as `_page` resolves it. A warm reader is
|
|
@@ -5532,7 +5536,12 @@ var init_QvdFile = __esm({
|
|
|
5532
5536
|
// file after a page naming one of them, it reported 27,490 bytes for a read that costs 108,160:
|
|
5533
5537
|
// understating, which is the direction that approves a read the read then refuses.
|
|
5534
5538
|
fields: options.fields === void 0 ? this._options.fields ?? null : options.fields,
|
|
5535
|
-
materialisesRows: as === "rows"
|
|
5539
|
+
materialisesRows: as === "rows",
|
|
5540
|
+
// Said outright rather than read off the reader. The header reader has paging on, because a check
|
|
5541
|
+
// made before the first page has to be priced as that page will be - so it cannot tell an `iterate()`
|
|
5542
|
+
// question from a page one by its own mode, and routing to it alone still priced the iterate as a
|
|
5543
|
+
// page wherever a bounded window would have been filtered.
|
|
5544
|
+
...chunkSize === null ? {} : { paging: false }
|
|
5536
5545
|
});
|
|
5537
5546
|
}
|
|
5538
5547
|
/**
|