Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-36319: [Go][Parquet] Improved row group writer error messages #36320

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions go/parquet/file/file_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ func (t *SerializeTestSuite) unequalNumRows(maxRows int64, rowsPerCol []int64) {
t.WriteBatchSubset(int(rowsPerCol[col]), 0, cw, t.DefLevels[:rowsPerCol[col]], nil)
cw.Close()
}
t.Error(rgw.Close())
err := rgw.Close()
t.Error(err)
t.ErrorContains(err, "row mismatch for unbuffered row group")
}

func (t *SerializeTestSuite) unequalNumRowsBuffered(maxRows int64, rowsPerCol []int64) {
Expand All @@ -154,7 +156,9 @@ func (t *SerializeTestSuite) unequalNumRowsBuffered(maxRows int64, rowsPerCol []
t.WriteBatchSubset(int(rowsPerCol[col]), 0, cw, t.DefLevels[:rowsPerCol[col]], nil)
cw.Close()
}
t.Error(rgw.Close())
err := rgw.Close()
t.Error(err)
t.ErrorContains(err, "row mismatch for buffered row group")
}

func (t *SerializeTestSuite) TestZeroRows() {
Expand Down
8 changes: 4 additions & 4 deletions go/parquet/file/row_group_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ func (rg *rowGroupWriter) checkRowsWritten() error {
if rg.nrows == 0 {
rg.nrows = current
} else if rg.nrows != current {
return xerrors.New("row mismatch")
return xerrors.Errorf("row mismatch for unbuffered row group: %d, count expected: %d, actual: %d", rg.ordinal, current, rg.nrows)
}
} else if rg.buffered {
current := rg.columnWriters[0].RowsWritten()
for _, wr := range rg.columnWriters[1:] {
for i, wr := range rg.columnWriters[1:] {
if current != wr.RowsWritten() {
return xerrors.New("row mismatch error")
return xerrors.Errorf("row mismatch for buffered row group: %d, column: %d, count expected: %d, actual: %d", rg.ordinal, i+1, current, wr.RowsWritten())
}
}
rg.nrows = current
Expand Down Expand Up @@ -182,7 +182,7 @@ func (rg *rowGroupWriter) Column(i int) (ColumnChunkWriter, error) {
if i >= 0 && i < len(rg.columnWriters) {
return rg.columnWriters[i], nil
}
return nil, xerrors.New("invalid column number requested")
return nil, xerrors.Errorf("invalid column number requested: %d", i)
}

func (rg *rowGroupWriter) CurrentColumn() int { return rg.metadata.CurrentColumn() }
Expand Down