From d70783541626f1cc9fc45eabc8b0b1fc4e47145a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Fri, 11 Oct 2024 12:53:28 +0200 Subject: [PATCH] fix handling of null values in arrow vectors (#2195) * closes #2194 --- src/options.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/options.js b/src/options.js index ac9caca472..144fd3b37b 100644 --- a/src/options.js +++ b/src/options.js @@ -68,8 +68,12 @@ function maybeTypedArrowify(vector, type) { return vector == null ? vector : (type === undefined || type === Array) && isArrowDateType(vector.type) - ? coerceDates(vector.toArray()) - : maybeTypedArrayify(vector.toArray(), type); + ? coerceDates(vectorToArray(vector)) + : maybeTypedArrayify(vectorToArray(vector), type); +} + +function vectorToArray(vector) { + return vector.nullCount ? vector.toJSON() : vector.toArray(); } export const singleton = [null]; // for data-less decoration marks, e.g. frame