Comparing version 0.7.1 to 0.7.2
{ | ||
"name": "hyparquet", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "parquet file parser for javascript", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "20.11.29", | ||
"@types/node": "20.11.30", | ||
"@typescript-eslint/eslint-plugin": "7.3.1", | ||
@@ -33,0 +33,0 @@ "@vitest/coverage-v8": "1.4.0", |
@@ -6,3 +6,3 @@ /** | ||
* @param {number[]} repetitionLevels repetition levels, max 1 | ||
* @param {ArrayLike<any>} value values to process | ||
* @param {ArrayLike<any>} values values to process | ||
* @param {boolean} isNull can an entry be null? | ||
@@ -13,11 +13,11 @@ * @param {number} maxDefinitionLevel definition level that corresponds to non-null | ||
export function assembleObjects( | ||
definitionLevels, repetitionLevels, value, isNull, maxDefinitionLevel | ||
definitionLevels, repetitionLevels, values, isNull, maxDefinitionLevel | ||
) { | ||
let vali = 0 | ||
let valueIndex = 0 | ||
let started = false | ||
let haveNull = false | ||
let i = 0 | ||
let outputIndex = 0 | ||
let part = [] | ||
/** @type {any[]} */ | ||
const assign = [] | ||
const output = [] | ||
@@ -31,9 +31,9 @@ for (let counter = 0; counter < repetitionLevels.length; counter++) { | ||
if (started) { | ||
assign[i] = haveNull ? undefined : part | ||
output[outputIndex] = haveNull ? undefined : part | ||
part = [] | ||
i++ | ||
outputIndex++ | ||
} else { | ||
// first time: no row to save yet, unless it's a row continued from previous page | ||
if (vali > 0) { | ||
assign[i - 1] = assign[i - 1]?.concat(part) // add items to previous row | ||
if (valueIndex > 0) { | ||
output[outputIndex - 1] = output[outputIndex - 1]?.concat(part) // add items to previous row | ||
part = [] | ||
@@ -48,4 +48,4 @@ // don't increment i since we only filled i-1 | ||
// append real value to current item | ||
part.push(value[vali]) | ||
vali++ | ||
part.push(values[valueIndex]) | ||
valueIndex++ | ||
} else if (def > 0) { | ||
@@ -60,6 +60,6 @@ // append null to current item | ||
if (started) { | ||
assign[i] = haveNull ? undefined : part | ||
output[outputIndex] = haveNull ? undefined : part | ||
} | ||
return assign | ||
return output | ||
} |
@@ -174,8 +174,14 @@ | ||
for (let i = 0; i < keys.length; i++) { | ||
/** @type {Record<string, any>} */ | ||
const obj = {} | ||
for (let j = 0; j < keys[i].length; j++) { | ||
obj[keys[i][j]] = values[i][j] | ||
// keys will be empty for {} and undefined for null | ||
if (keys[i] !== undefined) { | ||
/** @type {Record<string, any>} */ | ||
const obj = {} | ||
for (let j = 0; j < keys[i].length; j++) { | ||
if (keys[i][j] === undefined) continue | ||
obj[keys[i][j]] = values[i][j] === undefined ? null : values[i][j] | ||
} | ||
out.push(obj) | ||
} else { | ||
out.push(undefined) | ||
} | ||
out.push(obj) | ||
} | ||
@@ -182,0 +188,0 @@ columnData = out |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93140
2486