mirror of
https://github.com/asadbek064/hyparquet.git
synced 2025-12-05 22:41:55 +00:00
Fix page continuation issue #81
This commit is contained in:
parent
5d8f17903e
commit
5e846e6b13
@ -28,12 +28,13 @@ export function assembleLists(output, definitionLevels, repetitionLevels, values
|
||||
if (repetitionLevels[0]) {
|
||||
// continue previous row
|
||||
while (currentDepth < repetitionPath.length - 2 && currentRepLevel < repetitionLevels[0]) {
|
||||
if (!currentContainer) throw new Error('parquet cannot resume previous page')
|
||||
// go into last list
|
||||
currentContainer = currentContainer.at(-1)
|
||||
containerStack.push(currentContainer)
|
||||
currentDepth++
|
||||
if (repetitionPath[currentDepth] !== 'REQUIRED') currentDefLevel++
|
||||
if (repetitionPath[currentDepth] !== 'REQUIRED') {
|
||||
// go into last list
|
||||
currentContainer = currentContainer.at(-1)
|
||||
containerStack.push(currentContainer)
|
||||
currentDefLevel++
|
||||
}
|
||||
if (repetitionPath[currentDepth] === 'REPEATED') currentRepLevel++
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ describe('assembleLists', () => {
|
||||
expect(result).toEqual([[['a', 'b']], [], [['d', 'e']]])
|
||||
})
|
||||
|
||||
it('should handle continuing a row from the previous page', () => {
|
||||
it('should continue from the previous page', () => {
|
||||
const definitionLevels = [3, 3, 3, 1]
|
||||
const repetitionLevels = [1, 0, 1, 0]
|
||||
const values = ['b', 'c', 'd', 'e']
|
||||
@ -75,6 +75,14 @@ describe('assembleLists', () => {
|
||||
expect(result).toEqual([[['a', 'b']], [['c', 'd']], [[]]])
|
||||
})
|
||||
|
||||
it('should continue from the previous page (depth 2)', () => {
|
||||
const repetitionLevels = [2, 0, 2, 0]
|
||||
const values = ['b', 'c', 'd', 'e']
|
||||
const prev = [[['a']]]
|
||||
const result = assembleLists(prev, [], repetitionLevels, values, nestedRequired)
|
||||
expect(result).toEqual([[['a', 'b']], [['c', 'd']], [['e']]])
|
||||
})
|
||||
|
||||
it('should handle nested arrays', () => {
|
||||
// from nullable.impala.parquet
|
||||
const repetitionLevels = [0, 2, 1, 2]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user