While not a direct answer to your question, perhaps you will find this blog post on Calcite program representations useful:
https://www.feldera.com/blog/calcite-irs/ Mihai ________________________________ From: Hugh Pearse <[email protected]> Sent: Saturday, July 6, 2024 11:45 AM To: [email protected] <[email protected]> Subject: Getting SQL for virtual tables Hi team, silly question. I'm looking at calcite model files which contain entities like tables, lattices, views etc. Assume these entities represent a logical data model (not materialised into a physical table). Example: I have a virtual database. User sends an SQL query like select books.title, authors.first_name from myschema.mymodel Where my model view is: SELECT books.id, books.title, authors.first_name, authors.last_name FROM books INNER JOIN authors ON books.author_id = authors.id ORDER BY books.id; Observations: When I convert the input relnode to SQL and build it, calcite has a preference to output "myschema.mymodel". My question: How to correctly get the SQL for the physical backend? (Output SQL should include table names like "authors" and "books"). Notes: I am currently using a visitor class to replace, but not sure it's the correct way to implement.
