Fix duckdb empty block (#91)

This commit is contained in:
Kenny Daniel 2025-06-13 00:39:01 -07:00 committed by GitHub
parent f8ecf52bed
commit 1f4e1f2f0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6203 additions and 3 deletions

@ -22,9 +22,10 @@ export function bitWidth(value) {
*/
export function readRleBitPackedHybrid(reader, width, length, output) {
if (!length) {
// length = reader.view.getUint32(reader.offset, true)
length = reader.view.getUint32(reader.offset, true)
reader.offset += 4
}
const startOffset = reader.offset
let seen = 0
while (seen < output.length) {
const header = readVarInt(reader)
@ -38,7 +39,7 @@ export function readRleBitPackedHybrid(reader, width, length, output) {
seen += count
}
}
// assert(reader.offset - startOffset === length)
reader.offset = startOffset + length // duckdb writes an empty block
}
/**

@ -110,7 +110,7 @@ describe('readBitPacked', () => {
const reader = { view, offset: 0 }
const values = new Array(72)
readRleBitPackedHybrid(reader, 17, 72, values)
readRleBitPackedHybrid(reader, 17, 154, values)
expect(reader.offset).toBe(154)
expect(values).toEqual([
131071, 0, 0, 0, 0, 0, 0, 0,

6146
test/files/issue90.json Normal file

File diff suppressed because it is too large Load Diff

@ -0,0 +1,53 @@
{
"version": 1,
"schema": [
{
"repetition_type": "REQUIRED",
"name": "duckdb_schema",
"num_children": 1
},
{
"type": "DOUBLE",
"repetition_type": "OPTIONAL",
"name": "elb_01yr_imp_val"
}
],
"num_rows": 6144,
"row_groups": [
{
"columns": [
{
"file_offset": 0,
"meta_data": {
"type": "DOUBLE",
"encodings": [
"PLAIN"
],
"path_in_schema": [
"elb_01yr_imp_val"
],
"codec": "SNAPPY",
"num_values": 6144,
"total_uncompressed_size": 45059,
"total_compressed_size": 44650,
"data_page_offset": 4,
"statistics": {
"max": 449097851.5197593,
"min": 0,
"null_count": 610,
"max_value": 449097851.5197593,
"min_value": 0,
"is_max_value_exact": true,
"is_min_value_exact": true
}
}
}
],
"total_byte_size": 45059,
"num_rows": 6144,
"file_offset": 4
}
],
"created_by": "DuckDB version v1.3.0 (build 71c5c07cdd)",
"metadata_length": 198
}

BIN
test/files/issue90.parquet Normal file

Binary file not shown.