[ 
https://issues.apache.org/jira/browse/FLINK-41448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148274#comment-18148274
 ] 

Yuepeng Pan commented on FLINK-41448:
-------------------------------------

Merged into master(2.5.0) via: ddc060f0fbf0f5b7d94a83f77e72fd2550d2f9c3

> UDF metric group name follows how the function is spelled in the query, so 
> one function can get several groups
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41448
>                 URL: https://issues.apache.org/jira/browse/FLINK-41448
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 2.4.0
>            Reporter: Weiqing Yang
>            Assignee: Weiqing Yang
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 2.4.0
>
>
> *What happens*
> Function names are case-insensitive in SQL, but the UDF metric group is named 
> after the spelling used at each call site. The same function written in two 
> spellings in one query gets two metric groups, each with half of the data.
> *How to reproduce* (SQL Client, any scalar UDF)
> {code:sql}
> SET 'table.exec.udf-metric-enabled' = 'true';
> CREATE TEMPORARY SYSTEM FUNCTION MyUpper AS 'repro.Upper';
> CREATE TEMPORARY TABLE src (s STRING) WITH ('connector' = 'datagen', 
> 'rows-per-second' = '10');
> CREATE TEMPORARY TABLE sink (a STRING, b STRING) WITH ('connector' = 
> 'blackhole');
> INSERT INTO sink SELECT myupper(s), MYUPPER(s) FROM src;
> {code}
> The Calc operator reports two groups, {{udf.myupper}} and {{udf.MYUPPER}}. 
> The docs describe one group per function, and a dashboard built for one 
> spelling misses calls made with another.
> *Cause*
> The metric group name is {{BridgingSqlFunction#getName}}. For a temporary 
> system function, {{FunctionCatalog}} looks the function up by its normalized 
> name but builds the identifier from the name as written in the query 
> ({{FunctionIdentifier.of(funcName)}}), so the operator name, and with it the 
> metric group, follows the call-site spelling.
> *Proposed fix*
> Name the metric group after the normalized function name 
> ({{FunctionIdentifier#normalizeName}}), so every spelling of one function 
> maps to one group, and state in the docs that group names are lower-case. 
> This only changes the metric name, not how the planner names the function 
> anywhere else.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to