You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Jonathan Sternberg <jo...@bodo.ai> on 2023/04/04 16:20:45 UTC

How to utilize parser hooks such as SqlInsertKeywords

Hi,

We're utilizing Calcite's parser and need to customize it for a certain
dialect. In the past, we've just been keeping a fork of the parser and
making changes to the core template file. We wanted to try utilizing some
of the hooks that Calcite provides to ease the maintenance burden when
modifying the parser.

We've noticed hooks such as this one:
https://github.com/apache/calcite/blob/2d0b3acb11169b307dc165c1fae8b7c92b888ae9/core/src/main/codegen/templates/Parser.jj#L326-L333

If we wanted to customize that production to add support for a keyword, how
would we go about doing it? We've seen the configuration file for
freemarker and have seen how to add new productions for new statements, but
we haven't found a way to hook into the methods like these ones for
modifying existing statements.

Thanks.

--Jonathan Sternberg

Re: How to utilize parser hooks such as SqlInsertKeywords

Posted by Julian Hyde <jh...@apache.org>.
To research this, I would use 'git annotate' and identify the commits
and Jira cases that added those particular hooks.

On Tue, Apr 4, 2023 at 9:22 AM Jonathan Sternberg <jo...@bodo.ai> wrote:
>
> Hi,
>
> We're utilizing Calcite's parser and need to customize it for a certain
> dialect. In the past, we've just been keeping a fork of the parser and
> making changes to the core template file. We wanted to try utilizing some
> of the hooks that Calcite provides to ease the maintenance burden when
> modifying the parser.
>
> We've noticed hooks such as this one:
> https://github.com/apache/calcite/blob/2d0b3acb11169b307dc165c1fae8b7c92b888ae9/core/src/main/codegen/templates/Parser.jj#L326-L333
>
> If we wanted to customize that production to add support for a keyword, how
> would we go about doing it? We've seen the configuration file for
> freemarker and have seen how to add new productions for new statements, but
> we haven't found a way to hook into the methods like these ones for
> modifying existing statements.
>
> Thanks.
>
> --Jonathan Sternberg