weiqingy opened a new pull request, #30059:
URL: https://github.com/apache/flink/pull/30059

   ## What is the purpose of the change
   
   This pull request keeps calls to catalog functions with the same name in 
different databases apart. For example, `SELECT db1.f(s), db2.f(s) FROM t` now 
returns the result of `db1.f` and `db2.f` in their own columns. 
`BridgingSqlFunction` and `BridgingSqlAggFunction` used Calcite's 
`SqlOperator#equals`, which compares only the class, the simple name and the 
kind, so the two calls were merged into one expression. The same applies to a 
temporary system function and a catalog function with the same name, e.g. 
`g(s)` and `db1.g(s)`.
   
   ## Brief change log
   
     - `BridgingSqlFunction` and `BridgingSqlAggFunction` also compare the 
function identifier in `equals` and `hashCode`.
     - Calls to the same function still compare equal and are evaluated once, 
whether written as `db1.f`, `default_catalog.db1.f` or `f` with `db1` as the 
current database. Inline functions have no identifier and are compared as 
before.
     - Plan branches that differ only in such a function (UNION ALL, OVER, 
process table functions with sub-plan reuse) are compared by their digest text 
and are tracked separately in FLINK-41597.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - 
`FunctionITCase#testCatalogScalarFunctionsWithSameNameInDifferentDatabases` and 
`#testCatalogAggregateFunctionsWithSameNameInDifferentDatabases`: two same-name 
functions from different databases in one query return their own results. Both 
tests fail without the change.
     - The planner unit tests, including the plan, JSON plan and restore tests, 
pass with no plan changes. EXPLAIN output and compiled plans are unchanged.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code 2.1.330 (Claude Opus 5.5)
   


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

Reply via email to