You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by devjyoti patra <dj...@gmail.com> on 2019/10/29 06:14:03 UTC

Need help in adding keywords to Babel parser

Hi,

I am writing a SQL statement (ANSI SQL or HiveQL) analyzer which will parse
a given SQL statement into equivalent AST and I am using Babel for this use
case. But when I try to parse statements such as  “lateral view explode”,
which is a valid HiveQL syntax, Babel is throwing ParseException. Adding
these as keywords to the default list of keywords for Babel also did not
help. Can someone point me to an example where something similar has been
done.

Thanks,
Devjyoti

Re: Need help in adding keywords to Babel parser

Posted by Danny Chan <yu...@gmail.com>.
Here is a syntax extension from MGelbana to support PostgreSQL cast “::” [1]

[1] https://github.com/apache/calcite/commit/e8baf4f4720e07cdce1aa2baabf20042b9353bbb

Best,
Danny Chan
在 2019年10月29日 +0800 PM6:58,devjyoti patra <dj...@gmail.com>,写道:
> Hi,
>
> I am writing a SQL statement (ANSI SQL or HiveQL) analyzer which will parse
> a given SQL statement into equivalent AST and I am using Babel for this use
> case. But when I try to parse statements such as “lateral view explode”,
> which is a valid HiveQL syntax, Babel is throwing ParseException. Adding
> these as keywords to the default list of keywords for Babel also did not
> help. Can someone point me to an example where something similar has been
> done.
>
> Thanks,
> Devjyoti

Re: Need help in adding keywords to Babel parser

Posted by Michael Mior <mm...@apache.org>.
Adding to the list of keywords is a start, but you'll also have to
modify the parser to indicate where those keywords are valid to be
used. You'll also need to modify some of the data structures to store
information about what has been parsed.
--
Michael Mior
mmior@apache.org

Le mar. 29 oct. 2019 à 06:58, devjyoti patra <dj...@gmail.com> a écrit :
>
> Hi,
>
> I am writing a SQL statement (ANSI SQL or HiveQL) analyzer which will parse
> a given SQL statement into equivalent AST and I am using Babel for this use
> case. But when I try to parse statements such as  “lateral view explode”,
> which is a valid HiveQL syntax, Babel is throwing ParseException. Adding
> these as keywords to the default list of keywords for Babel also did not
> help. Can someone point me to an example where something similar has been
> done.
>
> Thanks,
> Devjyoti