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

   ## What is the purpose of the change
   
   `REGEXP_EXTRACT` does not validate literal regex patterns at planning time. 
When the regex is a string literal that fails `Pattern.compile`, every record 
produces an `ERROR`-level log line and a wasted compile attempt on the hot 
path. This PR surfaces the failure as a `ValidationException` during type 
inference and removes the per-record log spam.
   
   ## Brief change log
   
   - Add `RegexpExtractInputTypeStrategy` which compiles literal regex 
arguments during `inferInputTypes` and fails via `callContext.fail(...)` on 
`PatternSyntaxException`.
   - Wire the strategy into `BuiltInFunctionDefinitions.REGEXP_EXTRACT`.
   - Rewrite `SqlFunctionUtils.regexpExtract` to use the cached 
`REGEXP_PATTERN_CACHE` and silently return `null` on `PatternSyntaxException`. 
No `LOG.error` on the hot path.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - New `RegexpExtractInputTypeStrategyTest` covers the four branches of 
literal-regex validation: non-literal regex, valid literal, null literal, 
invalid literal.
   - Existing `RegexpFunctionsITCase` and `ScalarFunctionsTest` regress the 
runtime behavior.
   
   ## 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): **yes** 
(removes per-record `Pattern.compile` and `LOG.error` in `regexpExtract`)
   - **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: Opus 4.7


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