xumingming commented on PR #58229:
URL: https://github.com/apache/spark/pull/58229#issuecomment-5775428658

   @cloud-fan @peter-toth Thanks for the thorough review, really helpful. I 
have made the following changes:
   
   - Use view identifier to group and then check whether all the canonicalized 
view body in the same group are the same, so it refuses views with different 
view bodies.
   - For the View with inner CTE case, I added logic to normalize the cte 
id/refIds, so views with CTEs can be converted too.
   - Fix a Subquery related bug: make the rule only fire when the plan root is 
NOT a subquery, otherwise the optimization would throw.
   - Added a conservative check: if the views contains a top level 'ORDER BY', 
the rule will not fire, because it would change the result if the view is used 
like 'SELECT * FROM view LIMIT 10'. Note that this is not strictly a 
correctness bug, there is no guarantee about the order of the result when no 
outer 'ORDER BY' is specified, but let's be conservative to not surprise users.
   - Added checks that the view body is computed only once when materialized.
   - Added more tests for the corresponding changes.
   - Also fixed outdated docs, removed trivial nits like tests count.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to