Fix handling of boolean rle

This commit is contained in:
Kenny Daniel 2025-02-21 14:27:17 -08:00
parent 312557a83a
commit 2a302702d4
No known key found for this signature in database
GPG Key ID: FDF16101AF5AFD3A
3 changed files with 18 additions and 14 deletions

@ -32,9 +32,9 @@
"test": "vitest run"
},
"devDependencies": {
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@vitest/coverage-v8": "3.0.6",
"eslint": "9.20.1",
"eslint": "9.21.0",
"eslint-plugin-jsdoc": "50.6.3",
"hyparquet-compressors": "1.0.0",
"typescript": "5.7.3",

@ -38,8 +38,12 @@ export function readDataPage(bytes, daph, schemaPath, { type }) {
const bitWidth = type === 'BOOLEAN' ? 1 : view.getUint8(reader.offset++)
if (bitWidth) {
dataPage = new Array(nValues)
const encodedLength = type === 'BOOLEAN' ? 0 : view.byteLength - reader.offset
readRleBitPackedHybrid(reader, bitWidth, encodedLength, dataPage)
if (type === 'BOOLEAN') {
readRleBitPackedHybrid(reader, bitWidth, 0, dataPage)
dataPage = dataPage.map(x => !!x) // convert to boolean
} else {
readRleBitPackedHybrid(reader, bitWidth, view.byteLength - reader.offset, dataPage)
}
} else {
dataPage = new Uint8Array(nValues) // nValue zeroes
}

@ -1,17 +1,17 @@
[
[1],
[1],
[1],
[1],
[1],
[true],
[true],
[true],
[true],
[true],
[null],
[null],
[null],
[null],
[null],
[0],
[0],
[0],
[0],
[0]
[false],
[false],
[false],
[false],
[false]
]