@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 >> >> >> >>