From 6a75a960da441df5a7dcc8f64f0f680b9fa050cc Mon Sep 17 00:00:00 2001 From: Kenny Daniel Date: Tue, 21 May 2024 22:02:08 -0700 Subject: [PATCH] Convert boolean column --- src/datapageV2.js | 1 + test/files/datapage_v2.snappy.json | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/datapageV2.js b/src/datapageV2.js index 7c8fb0e..7a008d0 100644 --- a/src/datapageV2.js +++ b/src/datapageV2.js @@ -53,6 +53,7 @@ export function readDataPageV2(compressedBytes, ph, schemaPath, columnMetadata, // assert(columnMetadata.type === 'BOOLEAN') dataPage = new Array(nValues) readRleBitPackedHybrid(pageReader, 1, 0, dataPage) + dataPage = dataPage.map(x => !!x) } else if ( daph2.encoding === 'PLAIN_DICTIONARY' || daph2.encoding === 'RLE_DICTIONARY' diff --git a/test/files/datapage_v2.snappy.json b/test/files/datapage_v2.snappy.json index 3d5427f..9e181e6 100644 --- a/test/files/datapage_v2.snappy.json +++ b/test/files/datapage_v2.snappy.json @@ -1,7 +1,7 @@ [ - ["abc", 1, 2, 1, [1, 2, 3]], - ["abc", 2, 3, 1, null], - ["abc", 3, 4, 1, null], - [null, 4, 5, 0, [1, 2, 3]], - ["abc", 5, 2, 1, [1, 2]] + ["abc", 1, 2, true, [1, 2, 3]], + ["abc", 2, 3, true, null], + ["abc", 3, 4, true, null], + [null, 4, 5, false, [1, 2, 3]], + ["abc", 5, 2, true, [1, 2]] ]