xuyangzhong opened a new pull request, #25699:
URL: https://github.com/apache/flink/pull/25699

   ## What is the purpose of the change
   
   When `SqlOrderBy` and `SqlSelect` are validated together, `SqlSelect` gets 
rewritten and updated in place (as seen in 
`SqlValidatorImpl#performUnconditionalRewrites`). 
   This bug was caused by validation of `SqlOrderBy` and `SqlSelect` multi 
times, which led to `SqlSelect` being incorrectly updated to a pattern like:
   ```
   SELECT `V`.`b`, `V`.`c`, `V`.`d`
   FROM (VALUES ROW(1, 1, 2, 'd1'),
   ROW(2, 2, 4, 'd2')) AS `V` (`a`, `b`, `c`, `d`)
   ORDER BY `V`.`a`
   ORDER BY `a`
   ``` 
   
   This pull request aims to prevent the multiple validations of `SqlOrderBy` 
and `SqlSelect`.
   
   ## Brief change log
   
     - *Update logic in SqlCreateTableConverter to avoid validating SqlOrderBy 
and SqlSelect multi times*
     - *Add tests to verify this bug*
   
   
   ## Verifying this change
   
   Some tests in batch mode are added to verify this fix. (Sort in streaming 
mode is not supported yet).
   
   ## 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? 
   


-- 
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