Hello, Dev! I am a contributor to Apache Flink. As you know, Flink SQL uses Apache Calcite as a framework for SQL parsing and optimization. For a SQL, Calcite will go through the transformation of SQL Text -> SqlNode -> RelNode. Now I have a requirement to reverse parse RelNode to SQL Text. By digging into the Calcite code, I found a tool RelToSqlConverter that can convert RelNode to SQL Text. Since Calcite may generate some unreadable intermediate variables during the process of converting SQL text to RelNode, I have the following concern when using RelToSqlConverter to reverse parse RelNode to SQL: 1. Can the SQL text parsed by RelToSqlConverter be equal to the original input SQL text? 2. Does RelToSqlConverter support parsing all RelNodes to SQL text?
To summarize, my key question is whether using RelToSqlConverter to unparse a RelNode into SQL text is a production-ready solution? Since I don't know much about Calcite, I came to the community to ask for help. Other input: I found that the Coral[1] project is using RelToSqlConverter to unparsing RelNode into SQL text, which looks like a viable solution. 1. https://github.com/linkedin/coral Best, Ron