zeroshade commented on code in PR #894:
URL: https://github.com/apache/iceberg-go/pull/894#discussion_r3082152735
##########
table/transaction.go:
##########
@@ -1057,6 +1058,24 @@ func (t *Transaction) Overwrite(ctx context.Context, rdr
array.RecordReader, sna
updater.appendDataFile(df)
}
+ // Diagnostic: warn when an overwrite writes fewer rows than it deletes.
+ // This is not always a bug (the caller may intentionally reduce data),
+ // but it surfaces silent row loss from broken RecordReader adapters
+ // or iterator issues that would otherwise go unnoticed (#860).
+ var addedRows, deletedRows int64
+ for _, df := range updater.addedFiles {
+ addedRows += df.Count()
+ }
+ for _, df := range updater.deletedFiles {
+ deletedRows += df.Count()
+ }
+ if deletedRows > 0 && addedRows < deletedRows {
+ slog.Warn("Overwrite produced fewer rows than deleted",
+ "added_rows", addedRows,
+ "deleted_rows", deletedRows,
+ "delta", addedRows-deletedRows)
+ }
Review Comment:
should we add a test for this? We can use an slog adapter so that we can
capture the slog output etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]