You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "snuyanzin (via GitHub)" <gi...@apache.org> on 2026/10/02 13:07:33 UTC
[PR] [FLINK-40895][table] Use cache in code splitter [flink]
snuyanzin opened a new pull request, #29363:
URL: https://github.com/apache/flink/pull/29363
## What is the purpose of the change
Use cache in code splitter between code rewrites
## Brief change log
After FLINK-40876 it code splitter produces deterministic result which allows to use caches
## Verifying this change
existing 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?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change the checkbox below to `[X]` and replace the placeholder in the "Generated-by"
line with the tool name and version. Otherwise remove the "Generated-by" line.
See the ASF Generative Tooling Guidance for details:
https://www.apache.org/legal/generative-tooling.html
You are responsible for the quality and correctness of every change in this PR
regardless of the tooling used. Low-effort AI-generated PRs will be closed. See
AGENTS.md for the full guidance.
-->
- [ ] Yes (please specify the tool below)
Generated-by: [Tool Name and Version]
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40895][table] Use cache in code splitter [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #29363:
URL: https://github.com/apache/flink/pull/29363#issuecomment-5961301312
squashed before merge
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40895][table] Use cache in code splitter [flink]
Posted by "AHeise (via GitHub)" <gi...@apache.org>.
AHeise commented on code in PR #29363:
URL: https://github.com/apache/flink/pull/29363#discussion_r4169198120
##########
flink-table/flink-table-code-splitter/src/main/java/org/apache/flink/table/codesplit/JavaCodeSplitter.java:
##########
@@ -30,16 +36,31 @@
@Internal
public class JavaCodeSplitter {
+ private static final Cache<SplitKey, String> SPLIT_CACHE =
+ CacheBuilder.newBuilder()
+ .expireAfterAccess(Duration.ofMinutes(5))
+ .maximumSize(300)
+ .softValues()
+ .build();
+
public static String split(String code, int maxMethodLength, int maxClassMemberCount) {
+ SplitKey key = new SplitKey(code, maxMethodLength, maxClassMemberCount);
+ String cached = SPLIT_CACHE.getIfPresent(key);
Review Comment:
Nit: you can use computeIfAbsent since you handle checked exceptions anyways.
##########
flink-table/flink-table-code-splitter/src/main/java/org/apache/flink/table/codesplit/JavaCodeSplitter.java:
##########
@@ -30,16 +36,31 @@
@Internal
public class JavaCodeSplitter {
+ private static final Cache<SplitKey, String> SPLIT_CACHE =
+ CacheBuilder.newBuilder()
+ .expireAfterAccess(Duration.ofMinutes(5))
+ .maximumSize(300)
+ .softValues()
+ .build();
+
public static String split(String code, int maxMethodLength, int maxClassMemberCount) {
+ SplitKey key = new SplitKey(code, maxMethodLength, maxClassMemberCount);
+ String cached = SPLIT_CACHE.getIfPresent(key);
+ if (cached != null) {
+ return cached;
+ }
try {
- return splitImpl(code, maxMethodLength, maxClassMemberCount);
+ String result = splitImpl(code, maxMethodLength, maxClassMemberCount);
+ SPLIT_CACHE.put(key, result);
+ return result;
} catch (Throwable t) {
throw new RuntimeException(
Review Comment:
A bit unrelated to this PR but I wouldn't handle Error here. If OOM is coming along, this redirects users to file a bug report.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40895][table] Use cache in code splitter [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #29363:
URL: https://github.com/apache/flink/pull/29363
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-40895][table] Use cache in code splitter [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #29363:
URL: https://github.com/apache/flink/pull/29363#issuecomment-5953239234
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "e935c32f59948d7d8660361e1f1b900479a8f91d",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "e935c32f59948d7d8660361e1f1b900479a8f91d",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* e935c32f59948d7d8660361e1f1b900479a8f91d UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org