zeroshade commented on code in PR #721:
URL: https://github.com/apache/iceberg-go/pull/721#discussion_r2843340522
##########
table/arrow_scanner.go:
##########
@@ -189,6 +191,54 @@ func processPositionalDeletes(ctx context.Context, deletes
set[int64]) recProces
}
}
+// enrichRecordsWithPosDeleteFields enriches a RecordBatch with the columns
declared in the PositionalDeleteArrowSchema
+// so that during the pipeline filtering stages that sheds filtered out
records, we still have a way to
+// preserve the original position of those records.
+func enrichRecordsWithPosDeleteFields(ctx context.Context, filePath
iceberg.DataFile) recProcessFn {
+ nextIdx, mem := int64(0), compute.GetAllocator(ctx)
+
+ return func(inData arrow.RecordBatch) (outData arrow.RecordBatch, err
error) {
+ defer inData.Release()
+
+ schema := inData.Schema()
+ fieldIdx := schema.NumFields()
+ filePathField, ok :=
PositionalDeleteArrowSchema.FieldsByName("file_path")
+ if !ok {
+ panic("position delete schema should have required
field 'file_path'")
+ }
+ posField, ok := PositionalDeleteArrowSchema.FieldsByName("pos")
+ if !ok {
+ panic("position delete schema should have required
field 'pos'")
+ }
Review Comment:
You could pull these out of the function so we only have to do this once.
--
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]