[FLINK-33792] Generate the same code for the same logic
What is the purpose of the change
This pull request ensure that we generate the same code for the same logic, it is a precondition for sharing generated classes between different jobs.
Brief change log
- add a name counter in each
CodeGeneratorContextand use it when we generate names for variables.
Verifying this change
Please make sure both new and modified tests in this PR follows the conventions defined in our code quality guide: https://flink.apache.org/contributing/code-style-and-quality-common.html#testing
This change added tests and can be verified as follows:
- Add a new test: CodeGenUtilsTest#testNewName
- Add tests in existing class: HashCodeGeneratorTest#testHashWithIndependentNameCounter and ProjectionCodeGeneratorTest#testHashWithIndependentNameCounter
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? (yes)
- If yes, how is the feature documented? (docs)
CI report:
- 54241498133bd357809227329506d590570bac5c Azure: SUCCESS
Bot commands
The @flinkbot bot supports the following commands:-
@flinkbot run azurere-run the last Azure build
@libenchao Thanks for reviewing, I have remove the configuration, please take a look when you have time.
@zoudan The PR looks good to me, except that the CI is failing, could you fix that?
@flinkbot run azure
@flinkbot run azure
@libenchao CI is passed, please take a look when you have time.
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@flinkbot run azure
@lsyldliu I have updated my code, please have a took when you have time.