wuchong opened a new pull request #7982: [FLINK-11788][table-planner-blink] 
Support Code Generation for RexNode
URL: https://github.com/apache/flink/pull/7982
 
 
   
   ## What is the purpose of the change
   
   This is the basic implementation to support code generation for RexNodes.
   
   ## Brief change log
   
   Flink/Blink's code generation is not clean and the `generate....` methods is 
existed in various util class (e.g. `CodeGenUtils`, `BinaryStringCallGen`, 
`CallGenerator`, `ScalarOperators` ...). This pull request does some code 
cleanup to put the generations into a new structure.
   
   All the `generate....` methods are split and placed into these 3 util 
classes.
   
   - `GeneratorUtils`: generate code for general purpose, e.g. 
`generateCallIfArgsNotNull`, `generateFieldAccess`, `generateLiteral`
   - `SqlOperatorGens`: generate code for SQL scalar operators, e.g. arithmetic 
operator
   - `SqlFunctionGens`: generate code for SQL scalar functions, e.g. 
CHAR_LENGTH. (no introduced yet)
   
   Some other classes are:
   
   - `CallGenerator` interface: generate a call, usually used when the 
generation depends on some additional parameters.
   - `CodeGenUtils`: a utility for codegen, e.g. `newName`, 
`primitiveTypeTermForType`, but not include `generate...` methods.
   - `ExprCodeGenerator`:  responsible for generating codes for a given calcite 
`RexNode`.
   - `CodeGeneratorContext`: context for code generator, maintaining various 
reusable statements
   
   ## Verifying this change
   
   Add a `ExpressionTestBase` base class to check the code generation for 
expressions(RexNode). 
   
   We introduce 5 expression validation test class and 9 expression test class. 
   
   ## 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, Yarn/Mesos, 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)
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to