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

   ## What is the purpose of the change
   
   Function names are case-insensitive in SQL, but the UDF metric group 
(`udf.<udf_name>`) was named after the spelling used at the call site. Calling 
one function as `myUdf(x)` and `MYUDF(x)` in a query produced two groups, 
`udf.myUdf` and `udf.MYUDF`, each with part of the samples, and a dashboard 
built for one spelling missed the calls made with another. This pull request 
names the group after the normalized (lower-case) function name, so every 
spelling reports under one group. UDF metrics are new in 2.4.0, so changing the 
name now does not affect existing dashboards.
   
   ## Brief change log
   
     - Added `BridgingFunctionGenUtil#udfMetricNameOf`, which returns 
`FunctionIdentifier#normalizeName` of the function name for a function resolved 
by name, and the unchanged generated name for an inline function.
     - Both places that produce a UDF metric name use it: 
`BridgingSqlFunctionCallGen` (sync scalar and table functions, async scalar 
functions) and the async table function correlate entry in 
`BridgingFunctionGenUtil`.
     - An inline Table API function (for example `call(new MyUdf(), $("x"))`) 
is not looked up by name, so it cannot be split by spelling. It keeps its 
class-based name, since lower-casing it would only make the class harder to 
recognize.
     - Only the metric name changes. Operator names, EXPLAIN output and plan 
digests are unaffected.
     - The metrics docs (English and Chinese) state that the group name is the 
lower-case function name and describe the inline case.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `UdfMetricsITCase#testFunctionNameSpellingsShareOneLowerCaseGroup`: 
`mixedCaseUdf(id), MIXEDCASEUDF(id)` registers exactly one group, 
`udf.mixedcaseudf`, which receives the samples of both calls.
     - `UdfMetricsITCase#testAsyncTableGroupNameIsLowerCase`: an async table 
function called as `ASYNCTABLEUDF(id)` reports under `udf.asynctableudf`. This 
covers the second place that produces a metric name.
     - `UdfMetricsITCase#testInlineFunctionKeepsClassBasedGroupName`: an inline 
Table API call keeps its class-based group name.
     - Each new test fails when its part of the change is reverted. 
`UdfMetricsITCase`, `AsyncCalcITCase` and `AsyncCorrelateITCase` pass.
   
   ## 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? docs
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code 2.1.322 (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