I’ve added comments to the JIRA case.

> On Feb 15, 2019, at 5:22 AM, Muhammad Gelbana <m.gelb...@gmail.com> wrote:
> 
> Here is what I've done so far for CALCITE-2843
> <https://issues.apache.org/jira/browse/CALCITE-2843>:
> https://github.com/MGelbana/calcite/pull/1/files
> I appreciate a quick overview and guidance if I'm going in the wrong
> direction.
> 
> Thanks,
> Gelbana
> 
> 
> On Thu, Feb 14, 2019 at 5:57 PM Muhammad Gelbana <m.gelb...@gmail.com>
> wrote:
> 
>> @Stamatis, I very appreciate you taking the time to comment on the issues
>> I opened basd on this thread. I'm currently going through Babel's Parser.jj
>> file and JavaCC documentations trying to understand what I need to do and
>> where.
>> 
>> Considering you're probably more acquainted than I am. I'll gladly work
>> with you on a branch to fix this, based on your instructions of course.
>> Otherwise, I'll continue working on my own.
>> 
>> Thanks,
>> Gelbana
>> 
>> 
>> On Mon, Feb 11, 2019 at 11:31 PM Muhammad Gelbana <m.gelb...@gmail.com>
>> wrote:
>> 
>>> Your replies are very much appreciated. I'll see what I can do.
>>> 
>>> @Julian, I believe '=' acts as a boolean operator here because the query
>>> returns boolean results for that part of the selection.
>>> 
>>> Thanks,
>>> Gelbana
>>> 
>>> 
>>> On Mon, Feb 11, 2019 at 8:38 PM Julian Hyde <jh...@apache.org> wrote:
>>> 
>>>> There are a few Postgres-isms in that SQL:
>>>> The “::” (as a shorthand for cast) in 'typinput='array_in'::regproc
>>>> The ‘=‘ (as a shorthand for alias) in 'typinput='array_in'::regproc’
>>>> Use of a table function without the ’TABLE’ keyword, in 'from
>>>> generate_series(1, array_upper(current_schemas(false), 1))’
>>>> 
>>>> Babel does not handle any of those right now, but it could.
>>>> Contributions welcome.
>>>> 
>>>> Julian
>>>> 
>>>> 
>>>>> On Feb 11, 2019, at 6:14 AM, Stamatis Zampetakis <zabe...@gmail.com>
>>>> wrote:
>>>>> 
>>>>> Hi Gelbana,
>>>>> 
>>>>> In order to use the Babel parser you need to also set an appropriate
>>>>> factory to your parser configuration since
>>>>> setting only the conformance is not enough.
>>>>> 
>>>>> Try adding the following:
>>>>> ...
>>>>> configBuilder().setParserFactory(SqlBabelParserImpl.FACTORY);
>>>>> 
>>>>> Having said that I am not sure if Babel can handle the syntax you
>>>> provided.
>>>>> 
>>>>> Best,
>>>>> Stamatis
>>>>> 
>>>>> 
>>>>> 
>>>>> Στις Σάβ, 9 Φεβ 2019 στις 10:46 μ.μ., ο/η Muhammad Gelbana <
>>>>> m.gelb...@gmail.com> έγραψε:
>>>>> 
>>>>>> I'm trying to parse a PostgreSQL metadata query but a parsing
>>>> exception is
>>>>>> thrown.
>>>>>> 
>>>>>> Here is my code:
>>>>>> 
>>>>>> Config parserConfig =
>>>>>> configBuilder().setConformance(SqlConformanceEnum.BABEL).build();
>>>>>> FrameworkConfig frameworkConfig =
>>>>>> Frameworks.newConfigBuilder().parserConfig(parserConfig).build();
>>>>>> Planner planner = Frameworks.getPlanner(frameworkConfig);
>>>>>> planner.parse("SELECT typinput='array_in'::regproc, typtype FROM
>>>>>> pg_catalog.pg_type LEFT JOIN (select ns.oid as nspoid, ns.nspname,
>>>> r.r from
>>>>>> pg_namespace as ns join ( select s.r, (current_schemas(false))[s.r] as
>>>>>> nspname from generate_series(1, array_upper(current_schemas(false),
>>>> 1)) as
>>>>>> s(r) ) as r using ( nspname )) as sp ON sp.nspoid = typnamespace WHERE
>>>>>> typname = $1 ORDER BY sp.r, pg_type.oid DESC LIMIT 1");
>>>>>> 
>>>>>> *The exception title is* "Exception in thread "main"
>>>>>> org.apache.calcite.sql.parser.SqlParseException: Encountered ":" at
>>>> line 1,
>>>>>> column 27."
>>>>>> 
>>>>>> Am I doing something wrong or is the parser still not ready for such
>>>> syntax
>>>>>> ?
>>>>>> 
>>>>>> Thanks,
>>>>>> Gelbana
>>>>>> 
>>>> 
>>>> 

Reply via email to