Fokko commented on code in PR #1693: URL: https://github.com/apache/iceberg-python/pull/1693#discussion_r1965044541
########## pyiceberg/table/upsert_util.py: ########## @@ -36,7 +37,17 @@ def create_match_filter(df: pyarrow_table, join_cols: list[str]) -> BooleanExpre if len(join_cols) == 1: return In(join_cols[0], unique_keys[0].to_pylist()) else: - return Or(*[And(*[EqualTo(col, row[col]) for col in join_cols]) for row in unique_keys.to_pylist()]) + filters: List[BooleanExpression] = [ + cast(BooleanExpression, And(*[EqualTo(col, row[col]) for col in join_cols])) for row in unique_keys.to_pylist() + ] + + if not filters: + return In(join_cols[0], []) + + if len(filters) == 1: + return filters[0] + + return functools.reduce(lambda a, b: Or(a, b), filters) Review Comment: What do you think of the following: ```suggestion if len(filters) == 0: return AlwaysTrue() elif len(filters) == 1: return filters[0] else: return functools.reduce(lambda a, b: Or(a, b), filters) ``` -- 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