parquet/file: a panic recovered in WriteBatch is not kept, so Close writes a footer for rows with no values

オープン
#1,693 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@EdwardShen125 がすでに取り組んでいます。

2026年11月27日 から。

  • #1694 @EdwardShen125 による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
go
領域
backend, databases

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Assembly
スター
423
フォーク
188
平均マージ
1日 7時間
マージ済み PR(30日)
164

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/arrow-go のほかの issue

apache/arrow-go の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。