parquet/file: a panic recovered in WriteBatch is not kept, so Close writes a footer for rows with no values
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by reading the WriteBatch error recovery and Close paths for column chunk writers, then compare how FlushCurrentPage errors are saved, as referenced in issues #1597 and #1621. Reproduce the supplied example and check the resulting row count and footer behavior; done means Close returns the recovered error and no footer is written.
Written by the indexing model from the issue text.
Description
Describe the bug, including details regarding any error messages, version, and platform.
WriteBatch returns an error when it recovers a panic, but the error is not kept on the column, so every Close after it returns nil and the file ends up with a footer for rows that have no values. FlushCurrentPage errors are kept (#1597, #1621), recovered panics are not. This is the case @zeroshade noted in the #1621 review. On main:
root, _ := schema.NewGroupNode("schema", parquet.Repetitions.Required, schema.FieldList{
schema.NewInt32Node("col", parquet.Repetitions.Optional, -1),
}, -1)
var buf bytes.Buffer
props := parquet.NewWriterProperties(parquet.WithDictionaryDefault(false))
w := file.NewParquetWriter(&buf, root, file.WithWriterProps(props))
rg := w.AppendRowGroup()
col, _ := rg.NextColumn()
_, err := col.(*file.Int32ColumnChunkWriter).WriteBatch([]int32{1}, []int16{1, 1, 1}, nil)
fmt.Println(err) // unknown error type: runtime error: slice bounds out of range [:3] with capacity 1
fmt.Println(col.Close(), rg.Close(), w.Close()) // <nil> <nil> <nil>
r, _ := file.NewParquetReader(bytes.NewReader(buf.Bytes()))
fmt.Println(r.MetaData().NumRows()) // 3; reading the column back gives 0 rows and no error
Expected: Close returns the saved error and no footer is written, same as for a FlushCurrentPage error.
Component(s)
Parquet
- Dominant language
- Assembly
- Stars
- 423
- Forks
- 188
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 164
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/arrow-go
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/arrow-go#1591 · 2 comments ·
Maintainers usually reply within 1 day
-
arrow/compute: safe float to integer cast skips the truncation check in sliced arrays with nullsPossibly taken @mansur-akhmadi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 1/100
Maintainers usually reply within 1 day
-
Type: bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
ipc: stream reader accepts an invalid flatbuffer schema and decimal precision 0Possibly taken @AynSiddiqui claimed this 7 days ago. Open
apache/arrow-go#1676 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Battery "top up once" ends immediately when UPower reports fully-charged below 100%Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omacom/omarchy#21286 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Rejected regionUrl errors don't say how to recover when an agent passes the organization's web URLOpenmcp-feedback-pattern
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
getsentry/toolkit#2777 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
libsndfile/libsndfile#1239 ·