FYI, it is not possible to skip validation because validated SqlNode can
only be converted to a RelNode. The engine will check and halt if you are
trying to convert Sql to Rel directly without passing validation.

On Thu, Oct 19, 2023 at 4:49 PM Soumyadeep Mukhopadhyay <
[email protected]> wrote:

> Hi Rajesh,
>
> I had a similar use case where I wanted to skip the validation too.
> Although I am new to Apache Calcite, my approach was to use AbstractTable
> <https://calcite.apache.org/javadocAggregate/org/apache/calcite/schema/impl/AbstractTable.html>
>  class.
> An example could be as follows:
>
> import org.apache.calcite.schema.impl.AbstractTable
>
> import org.apache.calcite.sql.`type`.SqlTypeName
>
> import org.apache.calcite.tools.Frameworks
>
> import org.apache.calcite.rel.`type`.{RelDataType, RelDataTypeFactory}
>
> val schema = Frameworks.createRootSchema(true)
> schema.add("movie", new AbstractTable() {
> override def getRowType(typeFactory: RelDataTypeFactory): RelDataType =
> typeFactory.builder
> .add("category_id", SqlTypeName.INTEGER)
> .add("year_released", SqlTypeName.VARCHAR)
> .build()
> })
>
>
> This is in Scala.
>
> With regards,
> Soumyadeep Mukhopadhyay.
>
> On Thu, 19 Oct 2023 at 4:35 PM, <[email protected]> wrote:
>
>> 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."
>>
>

Reply via email to