thanks!!! בתאריך יום ד׳, 10 ביולי 2019 ב-14:10 מאת Ivan Grgurina < [email protected]>:
> I wouldn't recommend traversing parsed SQL statements, but rather move it > into relational algebra - from there you can use RelVisitor to visit nodes, > extract information and build RelNode "sub-queries" that you then put > inside the unnamed list and then easily convert these "sub-queries" back to > the SQL string using RelToSqlConverter. > > > *Ivan Grgurina* > > Research Assistant (ZEMRIS) > ------------------------------ > > <https://www.linkedin.com/in/igrgurina/> > <https://www.fer.unizg.hr/ivan.grgurina> > > > ------------------------------ > *From:* אייל טרבלסי <[email protected]> > *Sent:* Wednesday, July 10, 2019 11:22 AM > *To:* [email protected] > *Subject:* How to traverse parsed SQL statements > > Hi, > > > Is there any tutorial teaching how to traverse parsed SQL statements (I > read > > https://github.com/michaelmior/calcite-notebooks/blob/master/query-parsing.ipynb > which > is a great intro). > > What I am trying to achieve is to create valid "sub-queries" from a single > query, by traversing the AST and saving the valid "sub-trees" and convert > them back to query by toString(), for example the following query "SELECT * > FROM foo WHERE country='USA' AND state='New York' " will return the > following sub-queries: > 1. "SELECT * FROM foo " > 2. "SELECT * FROM foo WHERE country='USA' " > 3. "SELECT * FROM foo WHERE state='New York' " > 4. "SELECT * FROM foo WHERE country='USA' AND state='New York' " > > I would love any advice/resource that can help me implement these. > > Thanks, > Eyal Trabelsi >
