Fix early page termination for non-flat columns (#119)

This commit is contained in:
Kenny Daniel 2025-09-06 17:52:12 -07:00 committed by GitHub
parent 709d6b41fc
commit 06a2c79123
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -16,7 +16,8 @@ import { deserializeTCompactProtocol } from './thrift.js'
* @returns {DecodedArray[]}
*/
export function readColumn(reader, { groupStart, selectStart, selectEnd }, columnDecoder, onPage) {
const { columnName } = columnDecoder
const { columnName, schemaPath } = columnDecoder
const isFlat = isFlatColumn(schemaPath)
/** @type {DecodedArray[]} */
const chunks = []
/** @type {DecodedArray | undefined} */
@ -34,7 +35,7 @@ export function readColumn(reader, { groupStart, selectStart, selectEnd }, colum
})
})
while (rowCount < selectEnd) {
while (isFlat ? rowCount < selectEnd : reader.offset < reader.view.byteLength - 1) {
if (reader.offset >= reader.view.byteLength - 1) break // end of reader
// read page header