bojana-db commented on PR #57125:
URL: https://github.com/apache/spark/pull/57125#issuecomment-4935063456

   > ### Design question (non-blocking)
   > When `createIfMissing` is false, a type mismatch (e.g., object-key segment 
hitting a scalar) throws `VARIANT_PATH_TYPE_MISMATCH`. Should it instead leave 
the variant unchanged (same as missing-key behavior)?
   > 
   > PostgreSQL's `jsonb_set(target, path, new_value, create_missing := false)` 
returns `target` unchanged when a path is unreachable -- the docs state: "If 
these conditions are not met the target is returned unchanged." This covers 
both missing intermediates AND type mismatches.
   > 
   > The current behavior is internally consistent (`createIfMissing=true` also 
throws on type mismatch), but users migrating from PostgreSQL may expect silent 
passthrough when `create_if_missing` is false.
   > 
   > Not blocking - just flagging since it's a user-facing semantic difference 
from the ecosystem precedent.
   @shrirangmhalgi 
   
   Good point, however trying to override value of a different type like this 
seems either like mistake or genuine intention that should not be silent. 
Missing paths ("field doesn't exist yet") vs wrong-type paths ("your assumption 
about the shape is wrong") are semantically distinct signals.
   
   That said, we will support try version that will catch type mismatch, so we 
will have parity.
   
   Also, PostgreSQL is not really consistent with itself as it does error if 
intermediate path type is array where object is expected.


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