Fokko commented on code in PR #1830:
URL: https://github.com/apache/iceberg-python/pull/1830#discussion_r2009782531


##########
pyiceberg/table/upsert_util.py:
##########
@@ -39,7 +77,7 @@ def create_match_filter(df: pyarrow_table, join_cols: 
list[str]) -> BooleanExpre
             functools.reduce(operator.and_, [EqualTo(col, row[col]) for col in 
join_cols]) for row in unique_keys.to_pylist()
         ]
 
-        return AlwaysFalse() if len(filters) == 0 else 
functools.reduce(operator.or_, filters)
+        return AlwaysFalse() if len(filters) == 0 else 
build_balanced_tree(operator.or_, filters)

Review Comment:
   I'm thinking out loud to maybe bring this logic into the `Or` operation:
   
   
https://github.com/apache/iceberg-python/blob/71cb2473bee8161372b057207c82f73d42ae3092/pyiceberg/expressions/__init__.py#L260
   
   We could pass it in like:
   ```suggestion
           return AlwaysFalse() if len(filters) == 0 else Or(*filters)
   ```
   
   By bringing this into the `Op` operation, then this is much more structured. 
Thoughts/opinions?



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