flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-33792] Generate the same code for the same logic

Open zoudan opened this issue 2 years ago • 16 comments

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 CodeGeneratorContext and 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)

zoudan avatar Dec 22 '23 07:12 zoudan

CI report:

  • 54241498133bd357809227329506d590570bac5c Azure: SUCCESS
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Dec 22 '23 07:12 flinkbot

@libenchao Thanks for reviewing, I have remove the configuration, please take a look when you have time.

zoudan avatar Dec 25 '23 02:12 zoudan

@zoudan The PR looks good to me, except that the CI is failing, could you fix that?

libenchao avatar Dec 25 '23 09:12 libenchao

@flinkbot run azure

zoudan avatar Dec 28 '23 09:12 zoudan

@flinkbot run azure

zoudan avatar Dec 29 '23 02:12 zoudan

@libenchao CI is passed, please take a look when you have time.

zoudan avatar Dec 29 '23 08:12 zoudan

@flinkbot run azure

zoudan avatar Jan 02 '24 11:01 zoudan

@flinkbot run azure

zoudan avatar Jan 03 '24 02:01 zoudan

@flinkbot run azure

zoudan avatar Jan 09 '24 03:01 zoudan

@flinkbot run azure

zoudan avatar Jan 09 '24 09:01 zoudan

@flinkbot run azure

zoudan avatar Jan 09 '24 11:01 zoudan

@flinkbot run azure

zoudan avatar Jan 10 '24 02:01 zoudan

@flinkbot run azure

zoudan avatar Jan 11 '24 11:01 zoudan

@flinkbot run azure

zoudan avatar Jan 11 '24 11:01 zoudan

@flinkbot run azure

zoudan avatar Jan 12 '24 02:01 zoudan

@lsyldliu I have updated my code, please have a took when you have time.

zoudan avatar Jan 12 '24 03:01 zoudan