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

   ## What is the purpose of the change
   
   With UDF metrics enabled, a `table.exec.udf-metric.sample-interval` below 1 
was accepted when the query was submitted. The value was only checked in 
`UdfMetrics#register`, which runs when the operator opens, so the job failed on 
every open and restarted in a loop. This pull request rejects such a query at 
submission.
   
   ## Brief change log
   
     - `BridgingFunctionGenUtil#udfMetricsTermIfEnabled` throws a 
`ValidationException` when metrics are enabled and the interval is below 1. The 
message names the option: `UDF metric sample interval must be >= 1, but was 0. 
Set 'table.exec.udf-metric.sample-interval' to 1 or more.`
     - Every metered call path (sync and async, scalar and table functions) 
gets its metrics handle through this method, so one check covers all of them.
     - The runtime check in `UdfMetrics` is unchanged and stays as a safeguard.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `UdfMetricsITCase#testInvalidSampleIntervalRejectedAtSubmission`: 
metrics on and interval 0, `executeSql` throws a `ValidationException` with the 
message above. Without the fix it does not throw.
     - `UdfMetricsITCase#testInvalidSampleIntervalIgnoredWhenDisabled`: metrics 
off and interval 0, the job still runs. This fails if the check is applied 
regardless of the metrics switch.
     - `UdfMetricsITCase` passes (16 tests).
   
   ## 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.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