I'm currently working on a project in which I want to parse an SQL-Query and create the tree of relational expressions for it. The main goal is to identify the join partners in the Queries. So I'd like to push the join-expressions down to the leafs of the tree. To achieve this, I decided to use Apache Calcite. My code looks roughly like this at the moment:
Planner planner = Frameworks.getPlanner(Frameworks.newConfigBuilder().defaultSchema(Frameworks.createRootSchema(false)).build());
SqlNode parsed = planner.parse("SELECT s.dnasamplename, e.Total_expression_level, e.Soluble_expression_level, s.id " +
"FROM table1 e" +
"JOIN table2 s on s.constructname = e.Clone_name" +
"WHERE e.Total_expression_level like '0:%'");
planner.validate(parsed);
RelRoot relRoot = planner.rel(parsed);
If I try to execute the rel-Method of Planner directly, I get the error that I have to validate the query first. And that`s the point where I face troubles. I don't have a valid Schema. I just want to convert the query to a relational query plan. Is there a way to kind of skip the validation process?