raminqaf commented on code in PR #29375:
URL: https://github.com/apache/flink/pull/29375#discussion_r4250385448
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java:
##########
@@ -624,8 +627,7 @@ public static String parseUrl(String urlStr, String
partToExtract, String key) {
return null;
}
- Pattern p = Pattern.compile("(&|^)" + Pattern.quote(key) + "=([^&]*)");
- Matcher m = p.matcher(query);
+ Matcher m = QUERY_PARAM_PATTERN_CACHE.get(key).matcher(query);
Review Comment:
How about re-using the `REGEXP_PATTERN_CACHE`?
```suggestion
final String s = "(&|^)" + Pattern.quote(key) + "=([^&]*)";
Matcher m = REGEXP_PATTERN_CACHE.get(s).matcher(query);
```
This would still remove the compiling of the regex on the hot path but also
doesn't introduce a new field
--
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]