wirybeaver commented on issue #22393:
URL: https://github.com/apache/datafusion/issues/22393#issuecomment-5324348546

   Could we please land #24429 before publishing DataFusion 55.0.0?
   
   #22988 intentionally shipped with two planner limitations around an aliased 
MERGE target:
   
   1. target-correlated subqueries are rejected; and
   2. a source qualifier cannot equal the target table's real name when the 
target has another alias.
   
   Both come from canonicalizing the target's SQL-visible alias (for example, 
`t`) to its catalog table name (`target`). We chose to add `target_qualifier` 
to `MergeIntoOp` and `MergeIntoOpNode` because the logical plan needs to 
preserve two different facts: the provider/catalog identity used to find the 
target table, and the scope-visible qualifier used to resolve expressions.
   
   A recursive qualifier rewrite is not a safe substitute: qualifier text is 
scope-local, so an inner relation can legally shadow `t`; rewriting by string 
can change which relation an `OuterReferenceColumn` means. It also cannot solve 
the source collision, because rewriting target `t.id` to `target.id` would make 
it indistinguishable from source alias `target.id`. Persisting the qualifier 
keeps the binding selected by SQL planning intact through analyzer/optimizer 
passes, protobuf round trips, and provider dispatch.
   
   The protobuf field is optional for reading existing payloads: when absent, 
new readers fall back to `DmlNode.table_name`, matching the current 
canonicalized representation. However, an older reader does not understand a 
new alias-preserving payload. Since MERGE INTO and these proto types have not 
yet appeared in a release, landing #24429 before 55.0.0 avoids publishing a 
representation that immediately needs a compatibility-breaking correction.
   
   #24429 should therefore take precedence over #24195. The MemTable 
implementation in #24195 consumes the MERGE expression schema and 
representation, so it should rebase on the corrected target-qualifier model 
rather than land against the temporary canonicalized form. #24195 remains 
valuable as the follow-up execution feature, but #24429 fixes the 
logical/protobuf contract that providers build on.


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