One of the main differences between SqlNode and RelNode is that RelNode can only represent valid programs. This is ensured by the validator. Most, if not all, optimizations rely on the program being a legal program in order to manipulate it. The validator also adds additional information to your program, like types for all intermediate nodes. In the absence of types the optimizer cannot work.
So what you ask is essentially impossible. Why would you want to forgo the validator? The type inference in a SQL query must start from the types of the inputs, which are either literals in your SQL queries or tables and their schemas. Calcite can infer types without actually having a storage engine for the data in the tables, but it must know the schema. The schema can be obtained either from the real database which holds the data, or from some other "Catalog". In our project we process Calcite DDL statements and create just a catalog storing the schema for the tables produced by CREATE TABLE statements. This enables Calcite's validator to validate the queries. That's all you need. Mihai -----Original Message----- From: [email protected] Sent: Thursday, October 19, 2023 4:02 AM To: [email protected] Subject: is there a way to skip validation steps... I am using Apache Calcite to develop my project.My target is to simply provide an SQL string to Calcite and mainly using its optimizer to optimize it and output a optimized SQL string, which means that i don't have concrete tables or fields. But as far as I know for now, after the parse process, I must go through a validation process and then I can turn validated SqlNodes to RelNodes. As the problem above said. Are there any methods I can use to avoid validation process and directly turn the parsed SqlNode to a RelNode? -- Thanks, Rajesh Agarwal "Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s). are confidential and may be privileged. If you are not the intended recipient. you are hereby notified that any review. re-transmission. conversion to hard copy. copying. circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient. please notify the sender immediately by return email. and delete this message and any attachments from your system. Virus Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email. The company cannot accept responsibility for any loss or damage arising from the use of this email or attachment."
