Airblader opened a new pull request #16956:
URL: https://github.com/apache/flink/pull/16956


   ## What is the purpose of the change
   
   Suppose we have a source which supports both SupportsProjectionPushDown and 
SupportsReadingMetadata. Now we create a table with a declared schema 
containing some metadata columns.
   
   If we select from this table including at least one metadata column, 
`#applyReadableMetadata` will be called with exactly the metadata keys 
remaining after the projection. If we select from the table without selecting 
any metadata column, however, `#applyReadableMetadata` is called with _all_ 
declared metadata columns instead of an empty list. This causes the source to 
perform unnecessary work.
   
   This PR fixes this behavior by ensuring that even if no metadata keys remain 
after projection, we apply the metadata spec to inform the source properly.
   
   As a smaller side fix we also emphasize in the documentation that 
`applyReadableMetadata` must be idempotent since the planner always calls it 
once initially with all declared metadata columns.
   
   ## Verifying this change
   
   This change is largely covered by 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
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to