You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ChaomingZhangCN (via GitHub)" <gi...@apache.org> on 2026/09/09 02:56:10 UTC
[PR] [table-code-splitter] Allow splitting if blocks containing loops with jump statements [flink]
ChaomingZhangCN opened a new pull request, #29141:
URL: https://github.com/apache/flink/pull/29141
## What is the purpose of the change
Fix code splitting for large `if` blocks containing nested loops with `break` or `continue`.
Currently, `BlockStatementSplitter` skips a statement whenever its subtree contains any `return`, `break`, or `continue`. This is overly conservative for an enclosing block containing a self-contained loop: even a small loop with a jump can prevent the surrounding large block from being split, leaving generated methods that fail compilation with `Code grows beyond 64 KB`.
This change allows such enclosing blocks to be split while retaining conservative guards for return statements and loop-body extraction.
## Brief change log
- Track return statements separately from the combined return/jump count.
- Allow enclosing blocks containing self-contained loops with jumps to be extracted.
- Preserve the restrictions on extracting blocks containing returns and loop bodies containing jumps.
- Add rewrite fixtures and compilation/execution regression tests covering oversized branches, `break`, `continue`, labeled jumps, and early returns.
## Verifying this change
Added regression tests that generate an oversized `if` branch containing a short loop with either `break` or `continue`, run the complete `JavaCodeSplitter` pipeline, compile the output with Janino, and verify execution results.
Both oversized-branch test cases fail on the unmodified base commit with `Code grows beyond 64 KB` and pass with this change. The tests also verify that skipped branches remain unexecuted and that statements following a jump execute correctly.
Additional execution tests verify labeled `break`/`continue` and early-return behavior.
The complete code-splitter module test suite was run with its reactor dependencies using JDK 17 and the repository's Maven wrapper:
```bash
./mvnw -pl flink-table/flink-table-code-splitter -am \
-Drat.skip=true \
'-Dtest=org.apache.flink.table.codesplit.*Test' \
-Dsurefire.failIfNoSpecifiedTests=false \
test
```
Result: 54 tests, 0 failures, 0 errors, and 1 pre-existing skipped test.
Spotless and Checkstyle checks also passed. The reactor command skips the repository-wide RAT scan; a module-scoped RAT check was run separately and passed. The full repository test suite was not run.
## Does this pull request potentially affect one of the following parts:
- Dependencies: no.
- Public API: no.
- Serializers: no.
- Runtime per-record code paths: yes, generated code may be split into additional helper methods; no hand-written runtime operator changes.
- Deployment or recovery infrastructure: no.
- S3 file system connector: no.
## Documentation
- Does this pull request introduce a new feature? No, this is a code-splitting bug fix.
- How is the feature documented? Not applicable.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes.
Generated-by: Codex CLI 0.153.4
--
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-40605][table-code-splitter] Allow splitting if blocks containing loops with jump statements [flink]
Posted by "ChaomingZhangCN (via GitHub)" <gi...@apache.org>.
ChaomingZhangCN commented on PR #29141:
URL: https://github.com/apache/flink/pull/29141#issuecomment-5597418612
@JingsongLi Hi, could you please review this PR for FLINK-40605, which fixes a remaining 64 KB code-splitting issue in large if blocks containing loops with break or continue?
--
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-40605][table-code-splitter] Allow splitting if blocks containing loops with jump statements [flink]
Posted by "ChaomingZhangCN (via GitHub)" <gi...@apache.org>.
ChaomingZhangCN commented on PR #29141:
URL: https://github.com/apache/flink/pull/29141#issuecomment-5595435179
@flinkbot run azure
--
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] [table-code-splitter] Allow splitting if blocks containing loops with jump statements [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #29141:
URL: https://github.com/apache/flink/pull/29141#issuecomment-5595110841
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "12da06a50a0e7fe321560b28c9ab1b65f4fd9a53",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "12da06a50a0e7fe321560b28c9ab1b65f4fd9a53",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 12da06a50a0e7fe321560b28c9ab1b65f4fd9a53 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