zeroshade commented on code in PR #762:
URL: https://github.com/apache/iceberg-go/pull/762#discussion_r2884588950


##########
table/arrow_scanner.go:
##########
@@ -219,20 +221,21 @@ func enrichRecordsWithPosDeleteFields(ctx 
context.Context, filePath iceberg.Data
                        return nil, err
                }
 
-               filePathBuilder := array.NewStringBuilder(mem)
-               defer filePathBuilder.Release()
-               posBuilder := array.NewInt64Builder(mem)
-               defer posBuilder.Release()
+               rb := array.NewRecordBuilder(mem, newColsSchema)
+               defer rb.Release()
 
                startPos := nextIdx
                nextIdx += inData.NumRows()
 
                for i := startPos; i < nextIdx; i++ {
-                       filePathBuilder.Append(filePath.FilePath())
-                       posBuilder.Append(i)
+                       
rb.Field(0).(*array.StringBuilder).Append(filePath.FilePath())
+                       rb.Field(1).(*array.Int64Builder).Append(i)

Review Comment:
   raise these outside the loop so that we aren't doing the type assertion 
check on every iteration



##########
table/arrow_scanner_test.go:
##########
@@ -109,7 +110,10 @@ func TestEnrichRecordsWithPosDeleteFields(t *testing.T) {
                                require.NoError(t, err)
 
                                assert.Equal(t, string(expectedOutputJSON), 
string(outAsJSON))
+                               out.Release()
                        }
+
+                       mem.AssertSize(t, 0)

Review Comment:
   make this a defer at the top of the function instead



-- 
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]

Reply via email to