Hi Yogendra,

ALTER TABLE is not part of the standard and differs from one system to the
other so it's difficult to come up with something that covers every
use-case.
Most often users choose to add the ALTER TABLE via the FreeMarker template
extensions in their codebase.
As mentioned previously [1], if somebody wants to contribute to the parser,
probably the babel module is the best place for this.

Best,
Stamatis

[1] https://lists.apache.org/thread/lo5v3t6rk2htptr7v62r91s7vstnngj2

On Thu, Jan 6, 2022 at 7:32 PM Yogendra Sharma <[email protected]> wrote:

> I did supply is DDL parser factory but it's able to parse other DDL
> statements such as DELETE, UPDATE, INSERT but not ALTER.
>
> Sample code as below-
>
> SqlParser.Config config = SqlParser.config()
>
> .withParserFactory(SqlDdlParserImpl.FACTORY)
>
> .withConformance(SqlConformanceEnum.STRICT_2003);
> SqlParser parser = SqlParser.create("alter table tab1 drop column col1",
> config);
> SqlNode node = parser.parse();
>
>
> ________________________________
> From: Jacques Nadeau <[email protected]>
> Sent: Thursday, January 6, 2022 11:19 PM
> To: [email protected] <[email protected]>
> Subject: Re: Parsing ALTER TABLE Statements
>
> I believe this is a feature that is off by default. Try creating your
> parser with an alternative parser factory. I think it is something like
> this:
>
> SqlParser.Config.DEFAULT.withParserFactory(SqlDdlParserImpl.FACTORY)
>
> On Thu, Jan 6, 2022 at 6:10 AM Yogendra Sharma <[email protected]> wrote:
>
> > Wondering why does calcite DDL parser fail to parse ALTER TABLE
> stayements?
> >
> > In the code I see that we support ALTER SESSION and ALTER SYSTEM but not
> > ALTER Table.
> >
> > -Yogi
> >
> >
> >
> > Get Outlook for Android<https://aka.ms/ghei36>
> >
>

Reply via email to