mdwint commented on code in PR #2429:
URL: https://github.com/apache/iceberg-python/pull/2429#discussion_r2375784099
##########
pyiceberg/table/upsert_util.py:
##########
@@ -14,38 +14,61 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import functools
-import operator
+from math import isnan
+from typing import Any
import pyarrow as pa
from pyarrow import Table as pyarrow_table
from pyarrow import compute as pc
from pyiceberg.expressions import (
AlwaysFalse,
+ And,
BooleanExpression,
EqualTo,
In,
+ IsNaN,
+ IsNull,
Or,
)
def create_match_filter(df: pyarrow_table, join_cols: list[str]) ->
BooleanExpression:
Review Comment:
Would that mean it's impossible to update rows with null in the join
columns, since they are filtered out?
If so, that's not what I was going for. I'd like the solution to pass this
test:
https://github.com/mdwint/iceberg-python/blob/f818016e5c198581b7d7b11dba2b9ebd414e19bc/tests/table/test_upsert.py#L784-L831
This would be equivalent to the following Spark SQL (using the [null-safe
equality operator
`<=>`](https://spark.apache.org/docs/latest/sql-ref-null-semantics.html)):
```sql
MERGE INTO target_table AS t
USING source_table AS s
ON (t.foo <=> s.foo AND t.bar <=> s.bar)
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *
```
--
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]