I??m implementing the materialized feature for Spark. I have built a customized listener that logs the logical plan and physical plan of each sql query. After some analysis, I can get the most valuable subtree that needs to be materialized. Then I need to restore the subtree of the plan back to sql to recommend to the user. I??m wondering is there any function that converts a logical plan back to SQL text?