From b1c8a1dd8bf3958cfdc011f106ccf539a22a7e57 Mon Sep 17 00:00:00 2001 From: Kenny Daniel Date: Wed, 14 Aug 2024 21:51:33 -0700 Subject: [PATCH] Revert onComplete type signature change from #25 The type change caused a lot of downstream type errors. If you pass rowFormat: 'object' then it will return Record[] instead of any[][]. This means the types are not aligned with behavior. Will figure out how to fix it later, for now don't want break downstream projects. --- demo/demo.js | 2 +- src/hyparquet.d.ts | 2 +- src/read.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/demo.js b/demo/demo.js index d68d911..1430145 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -112,7 +112,7 @@ async function render(asyncBuffer, metadata, name) { compressors, file: asyncBuffer, rowEnd: 1000, - onComplete(/** @type {any[][] | Record[]} */ data) { + onComplete(/** @type {any[][]} */ data) { const ms = performance.now() - startTime console.log(`parsed ${name} in ${ms.toFixed(0)} ms`) content.appendChild(renderTable(header, data)) diff --git a/src/hyparquet.d.ts b/src/hyparquet.d.ts index 2ae394c..cc31ebe 100644 --- a/src/hyparquet.d.ts +++ b/src/hyparquet.d.ts @@ -116,7 +116,7 @@ export interface ParquetReadOptions { rowStart?: number // inclusive rowEnd?: number // exclusive onChunk?: (chunk: ColumnData) => void // called when a column chunk is parsed. chunks may be outside the requested range. - onComplete?: (rows: any[][] | Record[]) => void // called when all requested rows and columns are parsed + onComplete?: (rows: any[][]) => void // called when all requested rows and columns are parsed compressors?: Compressors // custom decompressors utf8?: boolean // decode byte arrays as utf8 strings (default true) } diff --git a/src/read.js b/src/read.js index 166b4d0..81b7308 100644 --- a/src/read.js +++ b/src/read.js @@ -27,7 +27,7 @@ import { concat } from './utils.js' * @param {number} [options.rowStart] first requested row index (inclusive) * @param {number} [options.rowEnd] last requested row index (exclusive) * @param {(chunk: ColumnData) => void} [options.onChunk] called when a column chunk is parsed. chunks may include row data outside the requested range. - * @param {(rows: any[][] | Record[]) => void} [options.onComplete] called when all requested rows and columns are parsed + * @param {(rows: any[][]) => void} [options.onComplete] called when all requested rows and columns are parsed * @param {Compressors} [options.compressors] custom decompressors * @returns {Promise} resolves when all requested rows and columns are parsed */ @@ -76,7 +76,7 @@ export async function parquetRead(options) { * @param {string[]} [options.columns] columns to read, all columns if undefined * @param {string} [options.rowFormat] format of each row passed to the onComplete function * @param {(chunk: ColumnData) => void} [options.onChunk] called when a column chunk is parsed. chunks may include row data outside the requested range. - * @param {(rows: any[][] | Record[]) => void} [options.onComplete] called when all requested rows and columns are parsed + * @param {(rows: any[][]) => void} [options.onComplete] called when all requested rows and columns are parsed * @param {Compressors} [options.compressors] * @param {RowGroup} rowGroup row group to read * @param {number} groupStart row index of the first row in the group