mdwint commented on code in PR #2429:
URL: https://github.com/apache/iceberg-python/pull/2429#discussion_r2375985658


##########
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:
   Thinking through this some more, I ask myself: What _should_ the semantics 
of `upsert` be? Should it use `=` or `<=>` to test equality? For my use case 
`<=>` is right, and I also find it most intuitive, but does that mean it should 
be the default?
   
   I see several options:
   
   - Make `<=>` the default. Users who don't want to update nulls can filter 
them out themselves before calling `upsert`. The status quo is crashing, so 
there are no existing users expecting a different behaviour.
   - Make `=` the default. This means I can't achieve my goal, and I'll need to 
reimplement `upsert` myself. It also means new rows will be inserted for every 
row containing null in the join columns. This is unintuitive to me, but who 
knows someone might want it?
   - Add an argument to `upsert` to select the comparison operator. Maximum 
flexibility, more work to implement.



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