vinjai commented on code in PR #941:
URL: https://github.com/apache/iceberg-python/pull/941#discussion_r2162799415


##########
pyiceberg/table/__init__.py:
##########
@@ -774,12 +797,24 @@ def upsert(
         matched_predicate = upsert_util.create_match_filter(df, join_cols)
 
         # We must use Transaction.table_metadata for the scan. This includes 
all uncommitted - but relevant - changes.
-        matched_iceberg_table = DataScan(
-            table_metadata=self.table_metadata,
-            io=self._table.io,
-            row_filter=matched_predicate,
-            case_sensitive=case_sensitive,
-        ).to_arrow()
+        if branch is None:
+            matched_iceberg_table = DataScan(
+                table_metadata=self.table_metadata,
+                io=self._table.io,
+                row_filter=matched_predicate,
+                case_sensitive=case_sensitive,
+            ).to_arrow()
+        else:
+            matched_iceberg_table = (
+                DataScan(
+                    table_metadata=self.table_metadata,
+                    io=self._table.io,
+                    row_filter=matched_predicate,
+                    case_sensitive=case_sensitive,
+                )
+                .use_ref(branch)
+                .to_arrow()
+            )

Review Comment:
   Agreed. Will resolve it



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to