[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16879760#comment-16879760 ]
Muhammad Gelbana commented on CALCITE-2843: ------------------------------------------- [~danny0405], I have a couple of questions regarding your comemnts on the PR. I've already asked those questions on the PR page but since you marked the PR as "discussiong-in-jira", we can discuss those questions here. (I personally prefer github in this case because the discussion can easily be associated with a selected piece of code) # [Here|https://github.com/apache/calcite/pull/1066#discussion_r300819535] You asked me to inherit {{SqlSpecialOperator}} instead of {{SqlBinaryOperator}}, why is that ? I'm confused because the operator is binary with no special syntax. # [Here|https://github.com/apache/calcite/pull/1066#discussion_r300819432] and [here|https://github.com/apache/calcite/pull/1066#discussion_r300819435], you asked me to add enough tests. I added tests for parsing {{INTEGER}}, {{VARCHAR}}, {{BOOLEAN}}, {{DOUBLE}}, {{BIGINT}}, if that's not enough, would you kindly suggest a way to go through all the possible types with valid castable data ? Has this been done somewhere in the current test framework ? # Regarding using the {{SqlStdOperatorTable.CAST}} instead of {{SqlStdOperatorTable.PG_CAST}}, I remember facing difficulties producing a function instead of a binary expression at that point in the parser but I'll try that again. Thanks a lot for your time so far. Hopefully we can get done with this soon inshallah. > Babel parser should parse PostgreSQL-style '::' cast operator > ------------------------------------------------------------- > > Key: CALCITE-2843 > URL: https://issues.apache.org/jira/browse/CALCITE-2843 > Project: Calcite > Issue Type: Bug > Components: babel > Affects Versions: 1.18.0 > Reporter: Muhammad Gelbana > Assignee: Muhammad Gelbana > Priority: Major > Labels: postgresql, pull-request-available > Time Spent: 4h > Remaining Estimate: 0h > > *Code to reproduce the problem* > {code:java} > public static void main(String[] args) throws Exception { > Config parserConfig = > configBuilder().setConformance(SqlConformanceEnum.BABEL).setParserFactory(SqlBabelParserImpl.FACTORY).build(); > FrameworkConfig frameworkConfig = > Frameworks.newConfigBuilder().parserConfig(parserConfig).build(); > Planner planner = Frameworks.getPlanner(frameworkConfig); > String pg = "SELECT 'array_in'::regproc, typtype FROM pg_catalog.pg_type"; > planner.parse(pg); > }{code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered ":" at line 1, column 18. > Was expecting one of: > <EOF> > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > <IDENTIFIER> ... > <QUOTED_IDENTIFIER> ... > <BACK_QUOTED_IDENTIFIER> ... > <BRACKET_QUOTED_IDENTIFIER> ... > <UNICODE_QUOTED_IDENTIFIER> ... > <QUOTED_STRING> ... > "." ... > "IN" ... > "<" ... > "<=" ... > ">" ... > ">=" ... > "=" ... > "<>" ... > "!=" ... > "+" ... > "-" ... > "*" ... > "/" ... > "%" ... > "||" ... > "[" ... > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > "MINUS" ... > > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:354) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:142) > at > org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:156) > at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:181) > at org.apache.calcite.prepare.PlannerImpl.parse(PlannerImpl.java:174) > at org.apache.calcite.tools.Planner.parse(Planner.java:50) > at com.lab.calcite.App2.main(App2.java:23) > Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered > ":" at line 1, column 18. > Was expecting one of: > <EOF> > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > <IDENTIFIER> ... > <QUOTED_IDENTIFIER> ... > <BACK_QUOTED_IDENTIFIER> ... > <BRACKET_QUOTED_IDENTIFIER> ... > <UNICODE_QUOTED_IDENTIFIER> ... > <QUOTED_STRING> ... > "." ... > "IN" ... > "<" ... > "<=" ... > ">" ... > ">=" ... > "=" ... > "<>" ... > "!=" ... > "+" ... > "-" ... > "*" ... > "/" ... > "%" ... > "||" ... > "[" ... > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > "MINUS" ... > > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.generateParseException(SqlBabelParserImpl.java:31191) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.jj_consume_token(SqlBabelParserImpl.java:31008) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.SqlStmtEof(SqlBabelParserImpl.java:877) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.parseSqlStmtEof(SqlBabelParserImpl.java:198) > at > org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:148) > ... 4 more > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)