[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16904009#comment-16904009 ] Muhammad Gelbana commented on CALCITE-2843: --- Never mind [~danny0405], thanks for all the time you spent reviewing this :) > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16903694#comment-16903694 ] Muhammad Gelbana commented on CALCITE-2843: --- It looks great. Thanks for the effort. > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16903331#comment-16903331 ] Muhammad Gelbana commented on CALCITE-2843: --- I updated the PR with your changes and it's passing all checks and ready to be merged. But frankly, I don't like what we did here. We bent the parser - produced a function call out of parsing a binary operator - and declared the operator as a function instead of an operator, which it is. > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16902008#comment-16902008 ] Muhammad Gelbana commented on CALCITE-2843: --- I created a [PR using your branch|https://github.com/apache/calcite/pull/1361] but it's failing the checks. Those are the same failure reasons I'm seeing locally on my machine. If you're OK with my current branch, it's reading to be merged as all checks are passing. > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16900420#comment-16900420 ] Muhammad Gelbana commented on CALCITE-2843: --- You mean after applying the changes you suggested ? If yes, would you please share that branch on Github ? > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16899893#comment-16899893 ] Muhammad Gelbana commented on CALCITE-2843: --- The documentation test might pass but the operator won't be avaialble for lookup because. Other tests fail and throws the following error {noformat}org.apache.calcite.sql.validate.SqlValidatorException: No match found for function signature ::(, ){noformat} > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16898798#comment-16898798 ] Muhammad Gelbana commented on CALCITE-2843: --- [~danny0405], I pushed some changes that would fix the whole thing by modifying the test method to use the operator's {{Sqldentifier}} instead of name, which makes more sense to me since we're looking for the operators representation within an SQL query. Please tell me if I should squash all those WIP commits so the PR would be ready for merging. > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16897911#comment-16897911 ] Muhammad Gelbana commented on CALCITE-2843: --- I pushed the changes you asked me to do but I didn't need to implement a new {{unparseWithSqlDialect}} method because I override the {{unparse}} method in the inner class instead. I still can't figure out how to fix the {{DocumentationTest.testAllFunctionsAreDocumented()}} method. It still sees my PostgreSQL operator and tries to find it in the docs as {{CAST}} instead of a {{::}} because the {{::}} operator's {{getName}} method must return {{CAST}}. If I return {{::}} instead, other unparsing methods break ! I feel like we'll have to modify the test method but I'm not sure how can we do that neatly. > 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 > Fix For: 1.21.0 > > Time Spent: 4h 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Comment Edited] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16895175#comment-16895175 ] Muhammad Gelbana edited comment on CALCITE-2843 at 8/1/19 7:40 AM: --- I made the changes you asked for as closely as possible but a single test case is failing now, that is {{DocumentationTest.testAllFunctionsAreDocumented()}} because the PostgreSQL casting operator is now exposed as another {{CAST}} function and it's not documented. It shouldn't be documented of course because it exposes the same syntax as {{CAST}}. The {{::}} operator is already documented of course. So how do you think I can bypass the documentation testing for this specific instance of the {{CAST}} function ? was (Author: mgelbana): I made the changes you asked for as closely as possible but a single test case is failing now, that is {{DocumentationTest.testAllFunctionsAreDocumented()}} because the PostgreSQL casting operator is no exposed as another {{CAST}} function and it's not documented. It shouldn't be documented of course because it's syntax isn't unique. The {{::}} operator is already documented of course. So how do you think I can bypass the documentation testing for this specific instance of the {{CAST}} function ? > 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 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16895252#comment-16895252 ] Muhammad Gelbana commented on CALCITE-2843: --- But we'll be modifying the original query this way. This won't work for me and I doubt it will for the majority of Calcite's users. What do you think ? > 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 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Comment Edited] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16895175#comment-16895175 ] Muhammad Gelbana edited comment on CALCITE-2843 at 7/29/19 11:58 AM: - I made the changes you asked for as closely as possible but a single test case is failing now, that is {{DocumentationTest.testAllFunctionsAreDocumented()}} because the PostgreSQL casting operator is no exposed as another {{CAST}} function and it's not documented. It shouldn't be documented of course because it's syntax isn't unique. The {{::}} operator is already documented of course. So how do you think I can bypass the documentation testing for this specific instance of the {{CAST}} function ? was (Author: mgelbana): I made the changes you asked for as closely as possible but a single test case is failing now, that is \{{DocumentationTest.testAllFunctionsAreDocumented()}} because the PostgreSQL casting operator is no exposed as another \{{CAST}} function and it's not documented. It shouldn't be documented of course because it's syntax isn't unique. The \{{::}} operator is already documented of course. So how do you think I can bypass the documentation testing for this specific operator ? > 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 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16895175#comment-16895175 ] Muhammad Gelbana commented on CALCITE-2843: --- I made the changes you asked for as closely as possible but a single test case is failing now, that is \{{DocumentationTest.testAllFunctionsAreDocumented()}} because the PostgreSQL casting operator is no exposed as another \{{CAST}} function and it's not documented. It shouldn't be documented of course because it's syntax isn't unique. The \{{::}} operator is already documented of course. So how do you think I can bypass the documentation testing for this specific operator ? > 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 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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.14#76016)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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 >
[jira] [Closed] (CALCITE-3164) Averaging an all-nulls values after grouping produce NaN instead of NULL
[ https://issues.apache.org/jira/browse/CALCITE-3164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana closed CALCITE-3164. - Resolution: Not A Bug > Averaging an all-nulls values after grouping produce NaN instead of NULL > > > Key: CALCITE-3164 > URL: https://issues.apache.org/jira/browse/CALCITE-3164 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.20.0 >Reporter: Muhammad Gelbana >Priority: Major > > {code:sql} > -- Values are a single tuple > SELECT C1, avg(C2) > FROM (VALUES('X', NULL::INT)) T (C1, C2) > GROUP BY C1 > -- Values are more than a single tuple > SELECT C1, avg(C2) > FROM (VALUES('X', NULL::INT), ('X', NULL::INT)) T (C1, C2) > GROUP BY C1 > {code} > Those queries return {{NaN}} while it's expected to return {{NULL}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3164) Averaging an all-nulls values after grouping produce NaN instead of NULL
[ https://issues.apache.org/jira/browse/CALCITE-3164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16878138#comment-16878138 ] Muhammad Gelbana commented on CALCITE-3164: --- You're correct. It turned out that my type-system is causing this. I overrode {{deriveSumType}} and {{deriveAvgAggType}} to return non nullable {{BIGINT}} and {{DOUBLE}} types respectively. After fixing those overrides tp return nullable types instead, the query started returning {{NULL}} as expected. > Averaging an all-nulls values after grouping produce NaN instead of NULL > > > Key: CALCITE-3164 > URL: https://issues.apache.org/jira/browse/CALCITE-3164 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.20.0 >Reporter: Muhammad Gelbana >Priority: Major > > {code:sql} > -- Values are a single tuple > SELECT C1, avg(C2) > FROM (VALUES('X', NULL::INT)) T (C1, C2) > GROUP BY C1 > -- Values are more than a single tuple > SELECT C1, avg(C2) > FROM (VALUES('X', NULL::INT), ('X', NULL::INT)) T (C1, C2) > GROUP BY C1 > {code} > Those queries return {{NaN}} while it's expected to return {{NULL}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
[ https://issues.apache.org/jira/browse/CALCITE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16877336#comment-16877336 ] Muhammad Gelbana commented on CALCITE-3063: --- Understood. Sorry I didn't know that. Thanks :) > Babel parse should parse PostgreSQL posix regular expressions > - > > Key: CALCITE-3063 > URL: https://issues.apache.org/jira/browse/CALCITE-3063 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Major > Labels: pull-request-available > Fix For: 1.21.0 > > Time Spent: 1h > Remaining Estimate: 0h > > Quoting from the referenced link below, posix operators are: > ||Operator||Description||Example|| > |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| > |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* > '.*Thomas.*'}}| > |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ > '.*Thomas.*'}}| > |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* > '.*vadim.*'}}| > > +Reference:+ > https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
[ https://issues.apache.org/jira/browse/CALCITE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana closed CALCITE-3063. - > Babel parse should parse PostgreSQL posix regular expressions > - > > Key: CALCITE-3063 > URL: https://issues.apache.org/jira/browse/CALCITE-3063 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Major > Labels: pull-request-available > Fix For: 1.21.0 > > Time Spent: 1h > Remaining Estimate: 0h > > Quoting from the referenced link below, posix operators are: > ||Operator||Description||Example|| > |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| > |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* > '.*Thomas.*'}}| > |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ > '.*Thomas.*'}}| > |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* > '.*vadim.*'}}| > > +Reference:+ > https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3164) Averaging an all-nulls values after grouping produce NaN instead of NULL
Muhammad Gelbana created CALCITE-3164: - Summary: Averaging an all-nulls values after grouping produce NaN instead of NULL Key: CALCITE-3164 URL: https://issues.apache.org/jira/browse/CALCITE-3164 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.20.0 Reporter: Muhammad Gelbana {code:sql} -- Values are a single tuple SELECT C1, avg(C2) FROM (VALUES('X', NULL::INT)) T (C1, C2) GROUP BY C1 -- Values are more than a single tuple SELECT C1, avg(C2) FROM (VALUES('X', NULL::INT), ('X', NULL::INT)) T (C1, C2) GROUP BY C1 {code} Those queries return {{NaN}} while it's expected to return {{NULL}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3128) Joining two tables producing only NULLs will return 0 rows
[ https://issues.apache.org/jira/browse/CALCITE-3128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16864265#comment-16864265 ] Muhammad Gelbana edited comment on CALCITE-3128 at 6/24/19 9:00 AM: My analysis so far is that {{leftKeys}} and {{rightKeys}} for EnumerableHashJoin (Previously named EnumerableJoin) are blank, which illudes {{PhysTypeImpl.generateAccessor(List)}} to return an expression of an empty list. {{leftKeys}} and {{rightKeys}} are blank because while constructing a Join node, {{JoinInfo.of(RelNode, RelNode, RexNode)}} uses {{RelOptUtil.splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)}} to fill up {{leftKeys}} and {{rightKeys}} but it doesn't because the condition is always true (i.e cartesian product). I'm still not sure where or how to fix this. was (Author: mgelbana): My analysis so far is that {{leftKeys}} and {{rightKeys}} for EnumerableHashJoin (Recently named EnumerableJoin) are blank, which illudes {{PhysTypeImpl.generateAccessor(List)}} to return an expression of an empty list. {{leftKeys}} and {{rightKeys}} are blank because while constructing a Join node, {{JoinInfo.of(RelNode, RelNode, RexNode)}} uses {{RelOptUtil.splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)}} to fill up {{leftKeys}} and {{rightKeys}} but it doesn't because the condition is always true (i.e cartesian product). I'm still not sure where or how to fix this. > Joining two tables producing only NULLs will return 0 rows > -- > > Key: CALCITE-3128 > URL: https://issues.apache.org/jira/browse/CALCITE-3128 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.20.0 >Reporter: Muhammad Gelbana >Priority: Major > > The following queries will return 0 rows while they're expected to ruturn > rows with NULLs in them. > {code:sql} > SELECT * > FROM (SELECT NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b > {code} > {code:sql} > SELECT * > FROM (VALUES (NULLIF(5, 5)), (NULLIF(5, 5))) a, (VALUES (NULLIF(5, 5)), > (NULLIF(5, 5))) b > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3142) A NPE when rounding a nullable numeric
Muhammad Gelbana created CALCITE-3142: - Summary: A NPE when rounding a nullable numeric Key: CALCITE-3142 URL: https://issues.apache.org/jira/browse/CALCITE-3142 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.20.0 Reporter: Muhammad Gelbana The following query throws a NPE in the generated code because it assumes the divided value to be an initialized Java object (Not null), which is fine for the first row, but not for the second. {code:sql} SELECT ROUND(CAST((X/Y) AS NUMERIC), 2) FROM (VALUES (1, 2), (NULLIF(5, 5), NULLIF(5, 5))) A(X, Y){code} If I modify the query a little bit, it runs ok: – No casting {code:sql} SELECT ROUND((X/Y), 2) FROM (VALUES (1, 2), (NULLIF(5, 5), NULLIF(5, 5))) A(X, Y){code} – No rounding {code:sql} SELECT (X/Y)::NUMERIC FROM (VALUES (1, 2), (NULLIF(5, 5), NULLIF(5, 5))) A(X, Y){code} +This is the optimized generated code+ {code:java} final Object[] current = (Object[]) inputEnumerator.current(); final Integer inp0_ = (Integer) current[0]; final Integer inp1_ = (Integer) current[1]; final java.math.BigDecimal v1 = new java.math.BigDecimal( inp0_.intValue() / inp1_.intValue()); // <<< NPE return inp0_ == null || inp1_ == null ? (java.math.BigDecimal) null : org.apache.calcite.runtime.SqlFunctions.sround(v1, 2);{code} +This is the non-optimized one+ {code:java} final Object[] current = (Object[]) inputEnumerator.current(); final Integer inp0_ = (Integer) current[0]; final boolean inp0__unboxed = inp0_ == null; final Integer inp1_ = (Integer) current[1]; final boolean inp1__unboxed = inp1_ == null; final boolean v = inp0__unboxed || inp1__unboxed; final int inp0__unboxed0 = inp0_.intValue(); // <<< NPE final int inp1__unboxed0 = inp1_.intValue(); // <<< NPE final int v0 = inp0__unboxed0 / inp1__unboxed0; final java.math.BigDecimal v1 = new java.math.BigDecimal( v0); final java.math.BigDecimal v2 = v ? (java.math.BigDecimal) null : org.apache.calcite.runtime.SqlFunctions.sround(v1, 2); return v2;{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3128) Joining two tables producing only NULLs will return 0 rows
[ https://issues.apache.org/jira/browse/CALCITE-3128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16864265#comment-16864265 ] Muhammad Gelbana commented on CALCITE-3128: --- My analysis so far is that {{leftKeys}} and {{rightKeys}} for EnumerableHashJoin (Recently named EnumerableJoin) are blank, which illudes {{PhysTypeImpl.generateAccessor(List)}} to return an expression of an empty list. {{leftKeys}} and {{rightKeys}} are blank because while constructing a Join node, {{JoinInfo.of(RelNode, RelNode, RexNode)}} uses {{RelOptUtil.splitJoinCondition(RelNode, RelNode, RexNode, List, List, List)}} to fill up {{leftKeys}} and {{rightKeys}} but it doesn't because the condition is always true (i.e cartesian product). I'm still not sure where or how to fix this. > Joining two tables producing only NULLs will return 0 rows > -- > > Key: CALCITE-3128 > URL: https://issues.apache.org/jira/browse/CALCITE-3128 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.20.0 >Reporter: Muhammad Gelbana >Priority: Major > > The following queries will return 0 rows while they're expected to ruturn > rows with NULLs in them. > {code:sql} > SELECT * > FROM (SELECT NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b > {code} > {code:sql} > SELECT * > FROM (VALUES (NULLIF(5, 5)), (NULLIF(5, 5))) a, (VALUES (NULLIF(5, 5)), > (NULLIF(5, 5))) b > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3128) Joining two tables producing only NULLs will return 0 rows
Muhammad Gelbana created CALCITE-3128: - Summary: Joining two tables producing only NULLs will return 0 rows Key: CALCITE-3128 URL: https://issues.apache.org/jira/browse/CALCITE-3128 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.20.0 Reporter: Muhammad Gelbana The following queries will return 0 rows while they're expected to ruturn rows with NULLs in them. {code:sql} SELECT * FROM (SELECT NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b {code} {code:sql} SELECT * FROM (VALUES (NULLIF(5, 5)), (NULLIF(5, 5))) a, (VALUES (NULLIF(5, 5)), (NULLIF(5, 5))) b {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
[ https://issues.apache.org/jira/browse/CALCITE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3063: -- Labels: pull-request-available (was: postgresql pull-request-available pull-requests-available) > Babel parse should parse PostgreSQL posix regular expressions > - > > Key: CALCITE-3063 > URL: https://issues.apache.org/jira/browse/CALCITE-3063 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Major > Labels: pull-request-available > Time Spent: 0.5h > Remaining Estimate: 0h > > Quoting from the referenced link below, posix operators are: > ||Operator||Description||Example|| > |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| > |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* > '.*Thomas.*'}}| > |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ > '.*Thomas.*'}}| > |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* > '.*vadim.*'}}| > > +Reference:+ > https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana closed CALCITE-3108. - Resolution: Won't Fix Users can define their own types but the problem seems with the returned column type name. The metadata for the returned resultset for that query using calcite won't return the user-defiend type alias for the column type name, it will return whatever the user-define type was configured to act as (ex: {{VARCHAR}}). *Example:* The following code prints {{TEXT}} as expected {code:java} Connection connection = // A connection to a real PostgreSQL DB PreparedStatement statement = connection.prepareStatement("SELECT column1::TEXT FROM (VALUES (1, 2, 3)) a"); System.out.println(statement.executeQuery().getMetaData().getColumnTypeName(1)); {code} But the following code prints {{VARCHAR}} while I It should print {{TEXT}} instead {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); } }); PreparedStatement statement = connection.prepareStatement("SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)) a"); System.out.println(statement.executeQuery().getMetaData().getColumnTypeName(1)); {code} > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 3.5h > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 12:33 PM: My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I managed to support the TEXT type by adding the type to the root schema: {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createJavaType(String.class), false); // return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); // return factory.createJavaType(String.class); // Failes: Cannot be nullable } }); {code} And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as what would be returned form a real PostgreSQL. How could I direct Calcite to use the type name I provided to the {{.add}} method (ie. {{TEXT}}) instead of the concluded one (ie. {{VARCHAR}}) ? was (Author: mgelbana): My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I managed to support the TEXT type by adding the type to the root schema: {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createJavaType(String.class), false); // return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); // return factory.createJavaType(String.class); // Failes: Cannot be nullable } }); {code} And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as what would be returned form a real PostgreSQL. How could I direct Calcite to use the type name I provided to the .add method instead of the concluded one (ie. {{VARCHAR}}) ? > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 12:32 PM: My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I managed to support the TEXT type by adding the type to the root schema: {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createJavaType(String.class), false); // return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); // return factory.createJavaType(String.class); // Failes: Cannot be nullable } }); {code} And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as what would be returned form a real PostgreSQL. How could I direct Calcite to use the type name I provided to the .add method instead of the concluded one (ie. {{VARCHAR}}) ? was (Author: mgelbana): My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I managed to support the TEXT type by adding the type to the root schema: {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createJavaType(String.class), false); // return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); // return factory.createJavaType(String.class); // Failes: Cannot be nullable } }); {code} And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as what would be returned form a real PostgreSQL. How could I direct Calcite to use the type name I provided to the .add method instead of the concluded one (ie. {{VARCHAR}}) ? > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 12:31 PM: My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I managed to support the TEXT type by adding the type to the root schema: {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createJavaType(String.class), false); // return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); // return factory.createJavaType(String.class); // Failes: Cannot be nullable } }); {code} And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as what would be returned form a real PostgreSQL. How could I direct Calcite to use the type name I provided to the .add method instead of the concluded one (ie. {{VARCHAR}}) ? was (Author: mgelbana): My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I found I can do what you suggested by exposing that type through the exposed schemas. But I can't find a way to do so for the root schema to get the example query to work. > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 10:53 AM: My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I found I can do what you suggested by exposing that type through the exposed schemas. But I can't find a way to do so for the root schema to get the example query to work. was (Author: mgelbana): My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I tried figuring out how can I do what you suggested and I found I can it by exposing that type through the exposed schemas. But I can't find a way to do so for the root schema to get the example query to work. > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 10:12 AM: My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented and I prefer that. I tried figuring out how can I do what you suggested and I found I can it by exposing that type through the exposed schemas. But I can't find a way to do so for the root schema to get the example query to work. was (Author: mgelbana): My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented, as I'll have to acquire the {{}} and act accordingly. Is it possible to easily return the column type name as TEXT if I follow that approach ? I still have to provide casting rules to support casting types to that identifier. > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 8:34 AM: --- My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented, as I'll have to acquire the {{}} and act accordingly. Is it possible to easily return the column type name as TEXT if I follow that approach ? I still have to provide casting rules to support casting types to that identifier. was (Author: mgelbana): My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented, as I'll have to acquire the {{}} and act accordingly. Is it possible to easily return the column type name as TEXT if I follow that approach ? > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853916#comment-16853916 ] Muhammad Gelbana commented on CALCITE-3108: --- My branches got mixed up and I added this feature to an unmurged PR that supports the {{::}} operator. Please refer to the description for the updated sample query. I added {{TEXT}} as a keyword so the returned result set column type name would be {{TEXT}} as returned from a PostgreSQL DB. I don't usually like touching the parser so you're suggestion sounds more Java oriented, as I'll have to acquire the {{}} and act accordingly. Is it possible to easily return the column type name as TEXT if I follow that approach ? > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3108: -- Description: Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The following query would fail in parsing and execution. {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} was: Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The following query would fail in parsing and execution. {code:sql}SELECT EXPR$0::text FROM (VALUES (1, 2, 3)){code} > Babel parser should parse the PostgreSQL TEXT type > -- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type
Muhammad Gelbana created CALCITE-3108: - Summary: Babel parser should parse the PostgreSQL TEXT type Key: CALCITE-3108 URL: https://issues.apache.org/jira/browse/CALCITE-3108 Project: Calcite Issue Type: Bug Components: babel, core Affects Versions: 1.19.0 Reporter: Muhammad Gelbana Assignee: Muhammad Gelbana Fix For: 1.20.0 Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The following query would fail in parsing and execution. {code:sql}SELECT EXPR$0::text FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
[ https://issues.apache.org/jira/browse/CALCITE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3063: -- Fix Version/s: 1.20.0 > Babel parse should parse PostgreSQL posix regular expressions > - > > Key: CALCITE-3063 > URL: https://issues.apache.org/jira/browse/CALCITE-3063 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Major > Labels: postgresql, pull-requests-available > Fix For: 1.20.0 > > Time Spent: 10m > Remaining Estimate: 0h > > Quoting from the referenced link below, posix operators are: > ||Operator||Description||Example|| > |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| > |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* > '.*Thomas.*'}}| > |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ > '.*Thomas.*'}}| > |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* > '.*vadim.*'}}| > > +Reference:+ > https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2843: -- Labels: postgresql pull-request-available (was: pull-request-available) > 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 > Fix For: 1.20.0 > > Time Spent: 0.5h > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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)
[jira] [Updated] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
[ https://issues.apache.org/jira/browse/CALCITE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3063: -- Labels: postgresql pull-requests-available (was: postgresql pull-request-available) > Babel parse should parse PostgreSQL posix regular expressions > - > > Key: CALCITE-3063 > URL: https://issues.apache.org/jira/browse/CALCITE-3063 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Major > Labels: postgresql, pull-requests-available > Time Spent: 10m > Remaining Estimate: 0h > > Quoting from the referenced link below, posix operators are: > ||Operator||Description||Example|| > |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| > |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* > '.*Thomas.*'}}| > |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ > '.*Thomas.*'}}| > |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* > '.*vadim.*'}}| > > +Reference:+ > https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16851708#comment-16851708 ] Muhammad Gelbana commented on CALCITE-2843: --- I've just resolved the PR's conflicts and it's ready now for review. I appreciate if someone can have a look at it. > 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: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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)
[jira] [Assigned] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana reassigned CALCITE-2843: - Assignee: Muhammad Gelbana > 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: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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)
[jira] [Commented] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848396#comment-16848396 ] Muhammad Gelbana commented on CALCITE-35: - You're correct. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 1h 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16846203#comment-16846203 ] Muhammad Gelbana edited comment on CALCITE-35 at 5/22/19 8:08 PM: -- Thank you all for your time discussing this and excuse me for this very late reply. I closed the PR and provided a new one (I need to keep the original PR's branch) to protect against the broken fix I provided at first. One final question, does it make sense to have this fix in BABEL since it's described as the parser that should hande all syntaxes ? I mean it sound reasonable to be slower when you're trying to fit in everything. was (Author: mgelbana): Thank you all for your time discussing this. I closed the PR and provided a new one (I need to keep the original PR's branch) to protect against the broken fix I provided at first. One final question, does it make sense to have this fix in BABEL since it's described as the parser that should hande all syntaxes ? I mean it sound reasonable to be slower when you're trying to fit in everything. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 1h 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16846203#comment-16846203 ] Muhammad Gelbana commented on CALCITE-35: - Thank you all for your time discussing this. I closed the PR and provided a new one (I need to keep the original PR's branch) to protect against the broken fix I provided at first. One final question, does it make sense to have this fix in BABEL since it's described as the parser that should hande all syntaxes ? I mean it sound reasonable to be slower when you're trying to fit in everything. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 1h 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16838041#comment-16838041 ] Muhammad Gelbana commented on CALCITE-35: - I tried a couple of things but none worked. {{LOOKAHEAD(left = TableRef())}} and {{LOOKAHEAD(AtomicTableRef(atomicReferenceToLeft))}} where {{AtomicTableRef}} is a new production that still returns an {{SqlNode}} but also accepts an atomic reference to set the consumed {{SqlNode}} to it before returning the same {{SqlNode}} to be detected by the {{LOOKAHEAD}}. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 50m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Assigned] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
[ https://issues.apache.org/jira/browse/CALCITE-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana reassigned CALCITE-3063: - Assignee: Muhammad Gelbana > Babel parse should parse PostgreSQL posix regular expressions > - > > Key: CALCITE-3063 > URL: https://issues.apache.org/jira/browse/CALCITE-3063 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Assignee: Muhammad Gelbana >Priority: Major > Labels: postgresql > > Quoting from the referenced link below, posix operators are: > ||Operator||Description||Example|| > |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| > |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* > '.*Thomas.*'}}| > |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ > '.*Thomas.*'}}| > |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* > '.*vadim.*'}}| > > +Reference:+ > https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16837936#comment-16837936 ] Muhammad Gelbana commented on CALCITE-35: - Frankly I don't fully understand the problem [~julianhyde] mentioned. But I tried another way to specify the lookahead as mentioned by the JavaCC lookahead tutorial and your mentioned tests are succeeding along with the parenthesized queries ones. But again, I had to modify some tests assertions. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 50m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3063) Babel parse should parse PostgreSQL posix regular expressions
Muhammad Gelbana created CALCITE-3063: - Summary: Babel parse should parse PostgreSQL posix regular expressions Key: CALCITE-3063 URL: https://issues.apache.org/jira/browse/CALCITE-3063 Project: Calcite Issue Type: Bug Components: babel Affects Versions: 1.19.0 Reporter: Muhammad Gelbana Quoting from the referenced link below, posix operators are: ||Operator||Description||Example|| |{{~}}|Matches regular expression, case sensitive|{{'thomas' ~ '.*thomas.*'}}| |{{~*}}|Matches regular expression, case insensitive|{{'thomas' ~* '.*Thomas.*'}}| |{{!~}}|Does not match regular expression, case sensitive|{{'thomas' !~ '.*Thomas.*'}}| |{{!~*}}|Does not match regular expression, case insensitive|{{'thomas' !~* '.*vadim.*'}}| +Reference:+ https://www.postgresql.org/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-35: Component/s: (was: babel) core > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16837359#comment-16837359 ] Muhammad Gelbana edited comment on CALCITE-35 at 5/10/19 3:15 PM: -- I did what you asked me to. I had to tweak a few tests assertions for them to pass. Please have a look at the PR. was (Author: mgelbana): I what you asked me to. I had to tweak a few tests assertions for them to pass. Please have a look at the PR. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16837359#comment-16837359 ] Muhammad Gelbana commented on CALCITE-35: - I what you asked me to. I had to tweak a few tests assertions for them to pass. Please have a look at the PR. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.19.0 >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-35) Support parenthesized sub-clause in JOIN
[ https://issues.apache.org/jira/browse/CALCITE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16836329#comment-16836329 ] Muhammad Gelbana commented on CALCITE-35: - I opened what seems to be a duplicate issue: CALCITE-3051 I created a PR that fixed the parsing problem for this Jira and the duplicate one: [https://github.com/apache/calcite/pull/1204] I'm not sure if the PR allows invalid queries or not, but all tests are passing successfully. > Support parenthesized sub-clause in JOIN > > > Key: CALCITE-35 > URL: https://issues.apache.org/jira/browse/CALCITE-35 > Project: Calcite > Issue Type: Bug >Reporter: GitHub Import >Priority: Major > Labels: github-import, pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > SQL-92 allows joins to be grouped into trees using parentheses. For example, > select * from a join (b join c on b.x = c.x) on a.y = c.y > Optiq should support this. Currently this gives > "org.eigenbase.util.EigenbaseException: Non-query expression encountered in > illegal context". > Imported from GitHub > Url: https://github.com/julianhyde/optiq/issues/35 > Created by: [julianhyde|https://github.com/julianhyde] > Labels: > Created at: Fri Apr 19 02:46:01 CEST 2013 > State: open -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3051) Babel parser should parse special table expressions
[ https://issues.apache.org/jira/browse/CALCITE-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835071#comment-16835071 ] Muhammad Gelbana commented on CALCITE-3051: --- Thanks for the heads up [~zhztheplayer], I closed this one as a duplicate. > Babel parser should parse special table expressions > --- > > Key: CALCITE-3051 > URL: https://issues.apache.org/jira/browse/CALCITE-3051 > Project: Calcite > Issue Type: Improvement > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Priority: Major > Labels: postgresql > > PostgreSQL query > {code:sql} > SELECT * FROM " > ( > ( > (S.C c INNER JOIN S.N n ON n.id = c.id) > INNER JOIN S.A a ON (NOT a.isactive) > ) INNER JOIN S.T t ON t.id = a.id > ) > {code} > Reproduction code > {code:java} > import static org.apache.calcite.sql.parser.SqlParser.configBuilder; > import org.apache.calcite.sql.parser.SqlParseException; > import org.apache.calcite.sql.parser.SqlParser.Config; > import org.apache.calcite.sql.parser.babel.SqlBabelParserImpl; > import org.apache.calcite.sql.validate.SqlConformanceEnum; > import org.apache.calcite.tools.FrameworkConfig; > import org.apache.calcite.tools.Frameworks; > import org.apache.calcite.tools.Planner; > public class Test { > public static void main(String[] args) throws SqlParseException { > Config parserConfig = > configBuilder().setConformance(SqlConformanceEnum.BABEL).setParserFactory(SqlBabelParserImpl.FACTORY).build(); > FrameworkConfig frameworkConfig = > Frameworks.newConfigBuilder().parserConfig(parserConfig).build(); > Planner planner = Frameworks.getPlanner(frameworkConfig); > planner.parse("SELECT * FROM (((S.C c INNER JOIN S.N n ON n.id = > c.id) INNER JOIN S.A a ON (NOT a.isactive)) INNER JOIN S.T t ON t.id = > a.id)"); > } > } > {code} > Returned exception > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Non-query expression encountered in illegal context > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:355) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:143) > 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.Test.main(Test.java:20) > Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression > encountered in illegal context > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > at > org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) > at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.checkNonQueryExpression(SqlBabelParserImpl.java:299) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3387) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at >
[jira] [Closed] (CALCITE-3051) Babel parser should parse special table expressions
[ https://issues.apache.org/jira/browse/CALCITE-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana closed CALCITE-3051. - Resolution: Duplicate > Babel parser should parse special table expressions > --- > > Key: CALCITE-3051 > URL: https://issues.apache.org/jira/browse/CALCITE-3051 > Project: Calcite > Issue Type: Improvement > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Priority: Major > Labels: postgresql > > PostgreSQL query > {code:sql} > SELECT * FROM " > ( > ( > (S.C c INNER JOIN S.N n ON n.id = c.id) > INNER JOIN S.A a ON (NOT a.isactive) > ) INNER JOIN S.T t ON t.id = a.id > ) > {code} > Reproduction code > {code:java} > import static org.apache.calcite.sql.parser.SqlParser.configBuilder; > import org.apache.calcite.sql.parser.SqlParseException; > import org.apache.calcite.sql.parser.SqlParser.Config; > import org.apache.calcite.sql.parser.babel.SqlBabelParserImpl; > import org.apache.calcite.sql.validate.SqlConformanceEnum; > import org.apache.calcite.tools.FrameworkConfig; > import org.apache.calcite.tools.Frameworks; > import org.apache.calcite.tools.Planner; > public class Test { > public static void main(String[] args) throws SqlParseException { > Config parserConfig = > configBuilder().setConformance(SqlConformanceEnum.BABEL).setParserFactory(SqlBabelParserImpl.FACTORY).build(); > FrameworkConfig frameworkConfig = > Frameworks.newConfigBuilder().parserConfig(parserConfig).build(); > Planner planner = Frameworks.getPlanner(frameworkConfig); > planner.parse("SELECT * FROM (((S.C c INNER JOIN S.N n ON n.id = > c.id) INNER JOIN S.A a ON (NOT a.isactive)) INNER JOIN S.T t ON t.id = > a.id)"); > } > } > {code} > Returned exception > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Non-query expression encountered in illegal context > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:355) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:143) > 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.Test.main(Test.java:20) > Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression > encountered in illegal context > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > at > org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) > at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.checkNonQueryExpression(SqlBabelParserImpl.java:299) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3387) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) > at >
[jira] [Updated] (CALCITE-3051) Babel parser should parse special table expressions
[ https://issues.apache.org/jira/browse/CALCITE-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3051: -- Description: PostgreSQL query {code:sql} SELECT * FROM " ( ( (S.C c INNER JOIN S.N n ON n.id = c.id) INNER JOIN S.A a ON (NOT a.isactive) ) INNER JOIN S.T t ON t.id = a.id ) {code} Reproduction code {code:java} import static org.apache.calcite.sql.parser.SqlParser.configBuilder; import org.apache.calcite.sql.parser.SqlParseException; import org.apache.calcite.sql.parser.SqlParser.Config; import org.apache.calcite.sql.parser.babel.SqlBabelParserImpl; import org.apache.calcite.sql.validate.SqlConformanceEnum; import org.apache.calcite.tools.FrameworkConfig; import org.apache.calcite.tools.Frameworks; import org.apache.calcite.tools.Planner; public class Test { public static void main(String[] args) throws SqlParseException { Config parserConfig = configBuilder().setConformance(SqlConformanceEnum.BABEL).setParserFactory(SqlBabelParserImpl.FACTORY).build(); FrameworkConfig frameworkConfig = Frameworks.newConfigBuilder().parserConfig(parserConfig).build(); Planner planner = Frameworks.getPlanner(frameworkConfig); planner.parse("SELECT * FROM (((S.C c INNER JOIN S.N n ON n.id = c.id) INNER JOIN S.A a ON (NOT a.isactive)) INNER JOIN S.T t ON t.id = a.id)"); } } {code} Returned exception {noformat} Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Non-query expression encountered in illegal context at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:355) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:143) 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.App3.main(App3.java:69) Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression encountered in illegal context at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.checkNonQueryExpression(SqlBabelParserImpl.java:299) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3387) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) at
[jira] [Updated] (CALCITE-3051) Babel parser should parse special table expressions
[ https://issues.apache.org/jira/browse/CALCITE-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3051: -- Description: PostgreSQL query {code:sql} SELECT * FROM " ( ( (S.C c INNER JOIN S.N n ON n.id = c.id) INNER JOIN S.A a ON (NOT a.isactive) ) INNER JOIN S.T t ON t.id = a.id ) {code} Reproduction code {code:java} import static org.apache.calcite.sql.parser.SqlParser.configBuilder; import org.apache.calcite.sql.parser.SqlParseException; import org.apache.calcite.sql.parser.SqlParser.Config; import org.apache.calcite.sql.parser.babel.SqlBabelParserImpl; import org.apache.calcite.sql.validate.SqlConformanceEnum; import org.apache.calcite.tools.FrameworkConfig; import org.apache.calcite.tools.Frameworks; import org.apache.calcite.tools.Planner; public class Test { public static void main(String[] args) throws SqlParseException { Config parserConfig = configBuilder().setConformance(SqlConformanceEnum.BABEL).setParserFactory(SqlBabelParserImpl.FACTORY).build(); FrameworkConfig frameworkConfig = Frameworks.newConfigBuilder().parserConfig(parserConfig).build(); Planner planner = Frameworks.getPlanner(frameworkConfig); planner.parse("SELECT * FROM (((S.C c INNER JOIN S.N n ON n.id = c.id) INNER JOIN S.A a ON (NOT a.isactive)) INNER JOIN S.T t ON t.id = a.id)"); } } {code} Returned exception {noformat} Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Non-query expression encountered in illegal context at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:355) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:143) 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.Test.main(Test.java:20) Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression encountered in illegal context at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.checkNonQueryExpression(SqlBabelParserImpl.java:299) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3387) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) at
[jira] [Updated] (CALCITE-3051) Babel parser should parse special table expressions
[ https://issues.apache.org/jira/browse/CALCITE-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-3051: -- Description: PostgreSQL query {code:sql} SELECT * FROM " ( ( (S.C c INNER JOIN S.N n ON n.id = c.id) INNER JOIN S.A a ON (NOT a.isactive) ) INNER JOIN S.T t ON t.id = a.id ) {code} Returned exception {noformat} Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Non-query expression encountered in illegal context at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:355) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:143) 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.App3.main(App3.java:69) Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression encountered in illegal context at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.checkNonQueryExpression(SqlBabelParserImpl.java:299) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3387) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedExpression(SqlBabelParserImpl.java:591) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.TableRef2(SqlBabelParserImpl.java:1847) at org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.TableRef(SqlBabelParserImpl.java:1773)
[jira] [Commented] (CALCITE-3051) Babel parser should parse special table expressions
[ https://issues.apache.org/jira/browse/CALCITE-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834664#comment-16834664 ] Muhammad Gelbana commented on CALCITE-3051: --- I'm not sure what that syntax could be called. If anyone does, please update the issue title accordingly. Also any ideas about where this could be fix in the babel parser are most welcome. I'm already working on it. > Babel parser should parse special table expressions > --- > > Key: CALCITE-3051 > URL: https://issues.apache.org/jira/browse/CALCITE-3051 > Project: Calcite > Issue Type: Improvement > Components: babel >Affects Versions: 1.19.0 >Reporter: Muhammad Gelbana >Priority: Major > Labels: postgresql > > PostgreSQL query > {code:sql} > SELECT * FROM " > ( > ( > (S.C c INNER JOIN S.N n ON n.id = c.id) > INNER JOIN S.A a ON (NOT a.isactive) > ) INNER JOIN S.T t ON t.id = a.id > ) > {code} > Returned exception > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Non-query expression encountered in illegal context > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.convertException(SqlBabelParserImpl.java:355) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.normalizeException(SqlBabelParserImpl.java:143) > 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.App3.main(App3.java:69) > Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression > encountered in illegal context > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > at > org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) > at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.checkNonQueryExpression(SqlBabelParserImpl.java:299) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3387) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:3095) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.LeafQueryOrExpr(SqlBabelParserImpl.java:3077) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.QueryOrExpr(SqlBabelParserImpl.java:2999) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.OrderedQueryOrExpr(SqlBabelParserImpl.java:471) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.ParenthesizedQueryOrCommaList(SqlBabelParserImpl.java:638) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression3(SqlBabelParserImpl.java:3411) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2b(SqlBabelParserImpl.java:3117) > at > org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:3158) >
[jira] [Created] (CALCITE-3051) Babel parser should parse special table expressions
Muhammad Gelbana created CALCITE-3051: - Summary: Babel parser should parse special table expressions Key: CALCITE-3051 URL: https://issues.apache.org/jira/browse/CALCITE-3051 Project: Calcite Issue Type: Improvement Components: babel Affects Versions: 1.19.0 Reporter: Muhammad Gelbana PostgreSQL query {code:sql} SELECT * FROM " ( ( (S.C c INNER JOIN S.N n ON n.id = c.id) INNER JOIN S.A a ON (NOT a.isactive) ) INNER JOIN S.T t ON t.id = a.id ) {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2844) Babel parser should parse PostgreSQL table functions
[ https://issues.apache.org/jira/browse/CALCITE-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16810950#comment-16810950 ] Muhammad Gelbana commented on CALCITE-2844: --- Thanks a lot! Your suggestions were extremely helpful. They helped me progress a lot until the this query failed {code:sql} select * from emp (x int, y varchar(10) not null) t(a, b){code} this made me think that what I'm doing should end because it's so untidy already so I did what I mentioned on the mailing list, which is to extend the first choice for {{TableRef2}} that starts with consuming the table name, and later on would decide if that's a table name or a function name. So no other choices added here. My work is located [here|https://github.com/MGelbana/calcite/commits/CALCITE-2844]. I'll see what I can do further to clean things up a bit in the parser where I did my changes becuase I duplicated some of the {{TableFunctionCall}} logic. > Babel parser should parse PostgreSQL table functions > > > Key: CALCITE-2844 > URL: https://issues.apache.org/jira/browse/CALCITE-2844 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Priority: Major > > *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 * from generate_series(1, 5)"; > planner.parse(pg); > } > {code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered "( 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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:24) > Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered "( > 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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)
[jira] [Commented] (CALCITE-2844) Babel parser should parse PostgreSQL table functions
[ https://issues.apache.org/jira/browse/CALCITE-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16807294#comment-16807294 ] Muhammad Gelbana commented on CALCITE-2844: --- I made some progress but I have two failing test cases for reason I don't understand. I ignored them and then all other tests are passing. You can find the tests [here|https://github.com/MGelbana/calcite/blob/CALCITE-2844/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java#L50] and [here|https://github.com/MGelbana/calcite/blob/CALCITE-2844/babel/src/test/java/org/apache/calcite/test/BabelParserTest.java#L53]. I appreciate if someoen could give it a look and tell me what am I missing ? > Babel parser should parse PostgreSQL table functions > > > Key: CALCITE-2844 > URL: https://issues.apache.org/jira/browse/CALCITE-2844 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Priority: Major > > *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 * from generate_series(1, 5)"; > planner.parse(pg); > } > {code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered "( 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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:24) > Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered "( > 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16800105#comment-16800105 ] Muhammad Gelbana commented on CALCITE-2947: --- Yes it looks like it. I don't have a stacktrace for the other test case though. > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-2844) Babel parser should parse PostgreSQL table functions
[ https://issues.apache.org/jira/browse/CALCITE-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2844: -- Fix Version/s: (was: 1.20.0) > Babel parser should parse PostgreSQL table functions > > > Key: CALCITE-2844 > URL: https://issues.apache.org/jira/browse/CALCITE-2844 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Priority: Major > > *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 * from generate_series(1, 5)"; > planner.parse(pg); > } > {code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered "( 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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:24) > Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered "( > 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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)
[jira] [Updated] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2843: -- Fix Version/s: 1.20.0 > 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 >Priority: Major > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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)
[jira] [Updated] (CALCITE-2844) Babel parser should parse PostgreSQL table functions
[ https://issues.apache.org/jira/browse/CALCITE-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2844: -- Fix Version/s: 1.20.0 > Babel parser should parse PostgreSQL table functions > > > Key: CALCITE-2844 > URL: https://issues.apache.org/jira/browse/CALCITE-2844 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Priority: Major > Fix For: 1.20.0 > > > *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 * from generate_series(1, 5)"; > planner.parse(pg); > } > {code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered "( 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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:24) > Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered "( > 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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)
[jira] [Comment Edited] (CALCITE-2901) RexSubQuery.scalar needs to allow specifying a different nullability value instead of the hard coded "true" value
[ https://issues.apache.org/jira/browse/CALCITE-2901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16787659#comment-16787659 ] Muhammad Gelbana edited comment on CALCITE-2901 at 3/8/19 6:16 PM: --- I'm actually inclined to vote for your suggestion. It's safer this way, so no one would provide an invalid value. was (Author: mgelbana): I'm actually inclined to vote for your suggestion. It's safer this way, so no one would provide an illogical value. > RexSubQuery.scalar needs to allow specifying a different nullability value > instead of the hard coded "true" value > - > > Key: CALCITE-2901 > URL: https://issues.apache.org/jira/browse/CALCITE-2901 > Project: Calcite > Issue Type: Improvement > Components: core >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Priority: Major > Labels: beginner, easyfix, newbie > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > The RexSubQuery.scalar(RelNode rel) method creates a subquery node with a > hard coded nullability value of *true*, which might not be always valid. > {code:java} > public static RexSubQuery scalar(RelNode rel) { > final List fieldList = rel.getRowType().getFieldList(); > assert fieldList.size() == 1; > final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); > final RelDataType type = > typeFactory.createTypeWithNullability(fieldList.get(0).getType(), > true); > return new RexSubQuery(type, SqlStdOperatorTable.SCALAR_QUERY, > ImmutableList.of(), rel); > } > {code} > I prupose a slight change which is to update the method's signature to accept > a boolean flag to specify the nullability of the subquery's type. Alongside > an overloading method calls the modified one with the hard coded *true* > nullability for backward compatibility. > Please tell me if such change is acceptable so I can do it. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2901) RexSubQuery.scalar needs to allow specifying a different nullability value instead of the hard coded "true" value
[ https://issues.apache.org/jira/browse/CALCITE-2901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16787659#comment-16787659 ] Muhammad Gelbana commented on CALCITE-2901: --- I'm actually inclined to vote for your suggestion. It's safer this way, so no one would provide an illogical value. > RexSubQuery.scalar needs to allow specifying a different nullability value > instead of the hard coded "true" value > - > > Key: CALCITE-2901 > URL: https://issues.apache.org/jira/browse/CALCITE-2901 > Project: Calcite > Issue Type: Improvement > Components: core >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Priority: Major > Labels: beginner, easyfix, newbie > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > The RexSubQuery.scalar(RelNode rel) method creates a subquery node with a > hard coded nullability value of *true*, which might not be always valid. > {code:java} > public static RexSubQuery scalar(RelNode rel) { > final List fieldList = rel.getRowType().getFieldList(); > assert fieldList.size() == 1; > final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); > final RelDataType type = > typeFactory.createTypeWithNullability(fieldList.get(0).getType(), > true); > return new RexSubQuery(type, SqlStdOperatorTable.SCALAR_QUERY, > ImmutableList.of(), rel); > } > {code} > I prupose a slight change which is to update the method's signature to accept > a boolean flag to specify the nullability of the subquery's type. Alongside > an overloading method calls the modified one with the hard coded *true* > nullability for backward compatibility. > Please tell me if such change is acceptable so I can do it. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-2901) RexSubQuery.scalar needs to allow specifying a different nullability value instead of the hard coded "true" value
Muhammad Gelbana created CALCITE-2901: - Summary: RexSubQuery.scalar needs to allow specifying a different nullability value instead of the hard coded "true" value Key: CALCITE-2901 URL: https://issues.apache.org/jira/browse/CALCITE-2901 Project: Calcite Issue Type: Improvement Components: core Affects Versions: 1.18.0 Reporter: Muhammad Gelbana The RexSubQuery.scalar(RelNode rel) method creates a subquery node with a hard coded nullability value of *true*, which might not be always valid. {code:java} public static RexSubQuery scalar(RelNode rel) { final List fieldList = rel.getRowType().getFieldList(); assert fieldList.size() == 1; final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); final RelDataType type = typeFactory.createTypeWithNullability(fieldList.get(0).getType(), true); return new RexSubQuery(type, SqlStdOperatorTable.SCALAR_QUERY, ImmutableList.of(), rel); } {code} I prupose a slight change which is to update the method's signature to accept a boolean flag to specify the nullability of the subquery's type. Alongside an overloading method calls the modified one with the hard coded *true* nullability for backward compatibility. Please tell me if such change is acceptable so I can do it. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16776233#comment-16776233 ] Muhammad Gelbana commented on CALCITE-2843: --- That was truly very helpful [~zabetak]. I created a PR: [https://github.com/apache/calcite/pull/1066], but it aslo includes +initial+ support for PostgreSQL OID types (i.e. regproc) but its not fully implemented at the moment. I plan to do that inshalla as this is the main reason I created this bug. I have to ask though, why do we rely on having all non SPECIAL/INTERNAL operators to have their names in uppercase ? This is mandated by [SqlValidatorTest.testStandardOperatorNamesAreUpperCase|https://github.com/apache/calcite/blob/83d8cf1e9189d0098677751d928cc39ac188b5a9/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java#L8613] > 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 >Priority: Major > Labels: pull-request-available > Time Spent: 10m > 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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "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)
[jira] [Comment Edited] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16770474#comment-16770474 ] Muhammad Gelbana edited comment on CALCITE-2843 at 2/17/19 9:23 PM: Thanks [~julianhyde]. I created a new branch with [new changes|https://github.com/MGelbana/calcite/commit/9c7273289b60d3811ecbcf16049652436ff86be7] to reflect what you pointed out. I haven't invested in the operator's precedence / assiciativity yet. But I tried running a simple query {code:java} SELECT typinput='array_in'::regproc, typtype FROM pg_catalog.pg_type{code} Just to see how things will initially go and I found that that validator is complaining that *regproc* isn't a valid identifier, which is true, but it itsn't a keyword either. What do you think would be the best description for regrpoc and handling this situation in Calcite ? *Exception* {noformat} Exception in thread "main" org.apache.calcite.tools.ValidationException: org.apache.calcite.runtime.CalciteContextException: From line 1, column 29 to line 1, column 35: Column 'REGPROC' not found in any table at org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:190) at com.lab.calcite.AppExec.main(AppExec.java:41) Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 29 to line 1, column 35: Column 'REGPROC' not found in any table at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4788) at org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:259) at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:5683) at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:5665) at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:334) at org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.visitChild(SqlShuttle.java:134) at org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.visitChild(SqlShuttle.java:101) at org.apache.calcite.sql.SqlOperator.acceptCall(SqlOperator.java:865) at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visitScoped(SqlValidatorImpl.java:5701) at org.apache.calcite.sql.validate.SqlScopedShuttle.visit(SqlScopedShuttle.java:50) at org.apache.calcite.sql.validate.SqlScopedShuttle.visit(SqlScopedShuttle.java:33) at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138) at org.apache.calcite.sql.validate.SqlValidatorImpl.expand(SqlValidatorImpl.java:5272) at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:432) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4052) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3315) at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:977) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:953) at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:928) at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:632) at org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:188) ... 1 more Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Column 'REGPROC' not found in any table at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) ... 27 more{noformat} was (Author: mgelbana): Thanks
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16770474#comment-16770474 ] Muhammad Gelbana commented on CALCITE-2843: --- Thanks [~julianhyde]. I created a new branch with new changes to reflect what you pointed out. I haven't invested in the operator's precedence / assiciativity yet. But I tried running a simple query {code:java} SELECT typinput='array_in'::regproc, typtype FROM pg_catalog.pg_type{code} Just to see how things will initially go and I found that that validator is complaining that *regproc* isn't a valid identifier, which is true, but it itsn't a keyword either. What do you think would be the best description for regrpoc and handling this situation in Calcite ? *Exception* {noformat} Exception in thread "main" org.apache.calcite.tools.ValidationException: org.apache.calcite.runtime.CalciteContextException: From line 1, column 29 to line 1, column 35: Column 'REGPROC' not found in any table at org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:190) at com.lab.calcite.AppExec.main(AppExec.java:41) Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 29 to line 1, column 35: Column 'REGPROC' not found in any table at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4788) at org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:259) at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:5683) at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:5665) at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:334) at org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.visitChild(SqlShuttle.java:134) at org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.visitChild(SqlShuttle.java:101) at org.apache.calcite.sql.SqlOperator.acceptCall(SqlOperator.java:865) at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visitScoped(SqlValidatorImpl.java:5701) at org.apache.calcite.sql.validate.SqlScopedShuttle.visit(SqlScopedShuttle.java:50) at org.apache.calcite.sql.validate.SqlScopedShuttle.visit(SqlScopedShuttle.java:33) at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138) at org.apache.calcite.sql.validate.SqlValidatorImpl.expand(SqlValidatorImpl.java:5272) at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:432) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4052) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3315) at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:977) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:953) at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:928) at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:632) at org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:188) ... 1 more Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Column 'REGPROC' not found in any table at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572) ... 27 more{noformat} > Babel parser should parse PostgreSQL-style '::' cast operator > - > > Key: CALCITE-2843 >
[jira] [Commented] (CALCITE-2844) Babel parser should parse PostgreSQL table functions
[ https://issues.apache.org/jira/browse/CALCITE-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16768132#comment-16768132 ] Muhammad Gelbana commented on CALCITE-2844: --- [~zabetak], done. > Babel parser should parse PostgreSQL table functions > > > Key: CALCITE-2844 > URL: https://issues.apache.org/jira/browse/CALCITE-2844 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Assignee: Julian Hyde >Priority: Major > > *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 * from generate_series(1, 5)"; > planner.parse(pg); > } > {code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered "( 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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:24) > Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered "( > 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ... > "(" ... > "(" ... > "(" ... > "(" ... > "MATCH_RECOGNIZE" ... > "." ... > "(" ... > ... > ... > ... > ... > ... > "TABLESAMPLE" ... > "WHERE" ... > "GROUP" ... > "HAVING" ... > "WINDOW" ... > "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)
[jira] [Updated] (CALCITE-2844) Babel parser should parse PostgreSQL table functions
[ https://issues.apache.org/jira/browse/CALCITE-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2844: -- Description: *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 * from generate_series(1, 5)"; planner.parse(pg); } {code} *Thrown exception* {noformat} Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Encountered "( 1" at line 1, column 30. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "NATURAL" ... "JOIN" ... "INNER" ... "LEFT" ... "RIGHT" ... "FULL" ... "CROSS" ... "," ... "OUTER" ... "(" ... "(" ... "(" ... "(" ... "(" ... "MATCH_RECOGNIZE" ... "." ... "(" ... ... ... ... ... ... "TABLESAMPLE" ... "WHERE" ... "GROUP" ... "HAVING" ... "WINDOW" ... "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:24) Caused by: org.apache.calcite.sql.parser.babel.ParseException: Encountered "( 1" at line 1, column 30. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "NATURAL" ... "JOIN" ... "INNER" ... "LEFT" ... "RIGHT" ... "FULL" ... "CROSS" ... "," ... "OUTER" ... "(" ... "(" ... "(" ... "(" ... "(" ... "MATCH_RECOGNIZE" ... "." ... "(" ... ... ... ... ... ... "TABLESAMPLE" ... "WHERE" ... "GROUP" ... "HAVING" ... "WINDOW" ... "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} was: *Query* {code:sql} SELECT typinput, 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{code} > Babel parser should parse PostgreSQL table functions > > > Key: CALCITE-2844 > URL: https://issues.apache.org/jira/browse/CALCITE-2844 > Project: Calcite > Issue Type: Bug > Components: babel >Affects Versions: 1.18.0 >Reporter: Muhammad Gelbana >Assignee: Julian Hyde >Priority: Major > > *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 * from generate_series(1, 5)"; > planner.parse(pg); > } > {code} > > *Thrown exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered "( 1" at line 1, column 30. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "NATURAL" ... > "JOIN" ... > "INNER" ... > "LEFT" ... > "RIGHT" ... > "FULL" ... > "CROSS" ... > "," ... > "OUTER" ... > "(" ...
[jira] [Updated] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2843: -- Description: *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: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "FROM" ... "," ... ... ... ... ... ... ... "." ... "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: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "FROM" ... "," ... ... ... ... ... ... ... "." ... "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} was: How to reproduce the bug {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} *Exception* {noformat} Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Encountered ":" at line 1, column 18. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "FROM" ... "," ... ... ... ... ... ... ... "." ... "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: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "FROM" ... "," ... ... ... ... ...
[jira] [Commented] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16768123#comment-16768123 ] Muhammad Gelbana commented on CALCITE-2843: --- I've done what you ask me [~zabetak]. Excuse me for not replying earlier. > 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: Julian Hyde >Priority: Major > > How to reproduce the bug > {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} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2843: -- Description: How to reproduce the bug {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} *Exception* {noformat} Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Encountered ":" at line 1, column 18. Was expecting one of: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "FROM" ... "," ... ... ... ... ... ... ... "." ... "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: "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "FROM" ... "," ... ... ... ... ... ... ... "." ... "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} was: How to reproduce the bug {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} > 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: Julian Hyde >Priority: Major > > How to reproduce the bug > {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} > *Exception* > {noformat} > Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: > Encountered ":" at line 1, column 18. > Was expecting one of: > > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "FROM" ... > "," ... > ... > ... > ... > ... > ... > ... > "." ... > "IN" ... > "<" ... > "<=" ... > ">" ... > ">=" ... > "=" ... >
[jira] [Updated] (CALCITE-2843) Babel parser should parse PostgreSQL-style '::' cast operator
[ https://issues.apache.org/jira/browse/CALCITE-2843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana updated CALCITE-2843: -- Description: How to reproduce the bug {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} was: *Query* {code:sql} 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{code} > 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: Julian Hyde >Priority: Major > > How to reproduce the bug > {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} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-2844) Babel parser doesn't parse PostgreSQL table function
Muhammad Gelbana created CALCITE-2844: - Summary: Babel parser doesn't parse PostgreSQL table function Key: CALCITE-2844 URL: https://issues.apache.org/jira/browse/CALCITE-2844 Project: Calcite Issue Type: Bug Components: babel Affects Versions: 1.18.0 Reporter: Muhammad Gelbana Assignee: Julian Hyde Fix For: next *Query* {code:sql} SELECT typinput, 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{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-2843) Babel parser doesn't parse PostgreSQL casting operator
Muhammad Gelbana created CALCITE-2843: - Summary: Babel parser doesn't parse PostgreSQL casting 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: Julian Hyde Fix For: next *Query* {code:sql} 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{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (CALCITE-1436) AggregateNode NPE for aggregators other than SUM/COUNT
[ https://issues.apache.org/jira/browse/CALCITE-1436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500452#comment-16500452 ] Muhammad Gelbana edited comment on CALCITE-1436 at 6/4/18 8:46 PM: --- All tests ran fine. I created a Pull request: [https://github.com/apache/calcite/pull/719] was (Author: mgelbana): All tests ran find. I created a Pull request: [https://github.com/apache/calcite/pull/719] > AggregateNode NPE for aggregators other than SUM/COUNT > -- > > Key: CALCITE-1436 > URL: https://issues.apache.org/jira/browse/CALCITE-1436 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Gian Merlino >Assignee: Julian Hyde >Priority: Major > > AggregateNode.getAccumulator does this for any aggregation other than COUNT > or SUM: > final AggImpState agg = new AggImpState(0, call, false); > int stateSize = agg.state.size(); > This NPEs because "state" is null on freshly created AggImpState instances. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-1436) AggregateNode NPE for aggregators other than SUM/COUNT
[ https://issues.apache.org/jira/browse/CALCITE-1436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500452#comment-16500452 ] Muhammad Gelbana commented on CALCITE-1436: --- All tests ran find. I created a Pull request: [https://github.com/apache/calcite/pull/719] > AggregateNode NPE for aggregators other than SUM/COUNT > -- > > Key: CALCITE-1436 > URL: https://issues.apache.org/jira/browse/CALCITE-1436 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Gian Merlino >Assignee: Julian Hyde >Priority: Major > > AggregateNode.getAccumulator does this for any aggregation other than COUNT > or SUM: > final AggImpState agg = new AggImpState(0, call, false); > int stateSize = agg.state.size(); > This NPEs because "state" is null on freshly created AggImpState instances. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-1436) AggregateNode NPE for aggregators other than SUM/COUNT
[ https://issues.apache.org/jira/browse/CALCITE-1436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500330#comment-16500330 ] Muhammad Gelbana commented on CALCITE-1436: --- Has anyone created a test case for this ? I'm failing to write a test case that reproduces it. > AggregateNode NPE for aggregators other than SUM/COUNT > -- > > Key: CALCITE-1436 > URL: https://issues.apache.org/jira/browse/CALCITE-1436 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Gian Merlino >Assignee: Julian Hyde >Priority: Major > > AggregateNode.getAccumulator does this for any aggregation other than COUNT > or SUM: > final AggImpState agg = new AggImpState(0, call, false); > int stateSize = agg.state.size(); > This NPEs because "state" is null on freshly created AggImpState instances. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-1436) AggregateNode NPE for aggregators other than SUM/COUNT
[ https://issues.apache.org/jira/browse/CALCITE-1436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16497927#comment-16497927 ] Muhammad Gelbana commented on CALCITE-1436: --- Would someone please shed some light on what needs to be done here ? I believe [~vladimirsitnikov]\[~vlsi] is the author of [this change|[https://github.com/apache/calcite/commit/ddad58826121d29362539f240ea32660811dc09b#diff-964b02bd21a99d18828586e07bb88aa7].] Would you please provide more information ? I can think of two ways to fix this. I either create an accumulator following the same interface as IntSum, LongSum and DoubleSum and {code:java} return new UdaAccumulatorFactory(AggregateFunctionImpl.create(IntMin.class), call, true); // That's for Integral input{code} Just as what the SUM branch does. Or, Considering that I'm trying to support MIN and MAX aggregate functions, I'll have to initialize the *state* list with only one element that represents the calculated minimum\maximum value. Should this expression be of type ParameterExpression ? This will have to be done in the AggImpState constructor of course. But this is still complicated to me, I appreciate some clarifications please. > AggregateNode NPE for aggregators other than SUM/COUNT > -- > > Key: CALCITE-1436 > URL: https://issues.apache.org/jira/browse/CALCITE-1436 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Gian Merlino >Assignee: Julian Hyde >Priority: Major > > AggregateNode.getAccumulator does this for any aggregation other than COUNT > or SUM: > final AggImpState agg = new AggImpState(0, call, false); > int stateSize = agg.state.size(); > This NPEs because "state" is null on freshly created AggImpState instances. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (CALCITE-2228) An inevitable NPE while using MAX aggregation function
[ https://issues.apache.org/jira/browse/CALCITE-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Muhammad Gelbana closed CALCITE-2228. - Resolution: Duplicate > An inevitable NPE while using MAX aggregation function > -- > > Key: CALCITE-2228 > URL: https://issues.apache.org/jira/browse/CALCITE-2228 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.16.0 >Reporter: Muhammad Gelbana >Assignee: Julian Hyde >Priority: Major > > Looking at this > [line|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/interpreter/AggregateNode.java#L150], > and the referenced [instance > variable|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java#L33], > it looks to me that > {code:java} > int stateSize = agg.state.size{code} > will always throw a *NPE* because the *agg.state* object reference is never > initialized before it's being used ! > I'm facing the following exception > {noformat} > java.sql.SQLException: Error while executing SQL "SELECT MAX(COUNTRY_ID), > MAX(COUNTRY_TOTAL_ID) FROM SALES.COUNTRIES": null > at org.apache.calcite.avatica.Helper.createException(Helper.java:56) > at org.apache.calcite.avatica.Helper.createException(Helper.java:41) > at > org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156) > at > org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218) > at > com.mg.sqlinterface.data.provider.calcite.internal.Test_SQLi.testMG(Test_SQLi.java:35) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) > at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) > Caused by: java.lang.NullPointerException > at > org.apache.calcite.interpreter.AggregateNode.getAccumulator(AggregateNode.java:150) > at > org.apache.calcite.interpreter.AggregateNode.(AggregateNode.java:86) > at org.apache.calcite.interpreter.Nodes$CoreCompiler.visit(Nodes.java:47) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.apache.calcite.util.ReflectUtil.invokeVisitorInternal(ReflectUtil.java:257) > at org.apache.calcite.util.ReflectUtil.invokeVisitor(ReflectUtil.java:214) > at > org.apache.calcite.util.ReflectUtil$1.invokeVisitor(ReflectUtil.java:464) > at > org.apache.calcite.interpreter.Interpreter$Compiler.visit(Interpreter.java:480) > at >
[jira] [Created] (CALCITE-2228) An inevitable NPE while using MAX aggregation function
Muhammad Gelbana created CALCITE-2228: - Summary: An inevitable NPE while using MAX aggregation function Key: CALCITE-2228 URL: https://issues.apache.org/jira/browse/CALCITE-2228 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.16.0, next Reporter: Muhammad Gelbana Assignee: Julian Hyde Looking at this [line|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/interpreter/AggregateNode.java#L150], and the referenced [instance variable|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java#L33], it looks to me that {code:java} int stateSize = agg.state.size{code} will always throw a *NPE* because the *agg.state* object reference is never initialized before it's being used ! I'm facing the following exception {noformat} java.sql.SQLException: Error while executing SQL "SELECT MAX(COUNTRY_ID), MAX(COUNTRY_TOTAL_ID) FROM SALES.COUNTRIES": null at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218) at com.mg.sqlinterface.data.provider.calcite.internal.Test_SQLi.testMG(Test_SQLi.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.NullPointerException at org.apache.calcite.interpreter.AggregateNode.getAccumulator(AggregateNode.java:150) at org.apache.calcite.interpreter.AggregateNode.(AggregateNode.java:86) at org.apache.calcite.interpreter.Nodes$CoreCompiler.visit(Nodes.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.calcite.util.ReflectUtil.invokeVisitorInternal(ReflectUtil.java:257) at org.apache.calcite.util.ReflectUtil.invokeVisitor(ReflectUtil.java:214) at org.apache.calcite.util.ReflectUtil$1.invokeVisitor(ReflectUtil.java:464) at org.apache.calcite.interpreter.Interpreter$Compiler.visit(Interpreter.java:480) at org.apache.calcite.interpreter.Interpreter$Compiler.visitRoot(Interpreter.java:437) at org.apache.calcite.interpreter.Interpreter.(Interpreter.java:78) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:365) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:301) at
[jira] [Created] (CALCITE-1926) Function names are unparsed quoted while PostgreSQL can only handle unquoted function names
Muhammad Gelbana created CALCITE-1926: - Summary: Function names are unparsed quoted while PostgreSQL can only handle unquoted function names Key: CALCITE-1926 URL: https://issues.apache.org/jira/browse/CALCITE-1926 Project: Calcite Issue Type: Bug Components: jdbc-adapter Affects Versions: 1.13.0 Reporter: Muhammad Gelbana Assignee: Julian Hyde While working on a Drill plugin, Calcite unparsed a *JdbcRel* node and produced the following PostgreSQL query {code:sql} SELECT "TEMP( Test)( 535799381)( 0)" FROM (SELECT "STRPOS"("str1", 'BI') = 1 AS "TEMP( Test)( 535799381)( 0)" FROM "TestV1"."Calcs") AS "t" GROUP BY "TEMP( Test)( 535799381)( 0)" {code} The query fails due to a parsing exception, the reason is that the *STRPOS* function name is quoted using double quotes. I tried the query manually without quoting the function name and it executed successfully. I debugged through Calcite and found that the [this method|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/SqlUtil.java#L262] unparses the function name as a plain identifier which leads to the [quoting of the function name|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/SqlIdentifier.java?deDup474625=1#L287] if the dialect supports it. Drill uses Calcite v1.4 but as I compared it with the master branch, I found them identical. I haven't tried that with custom functions yet. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1792) RelToSqlConverter doesn't handle cartesian join (join cond as TRUE)
[ https://issues.apache.org/jira/browse/CALCITE-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16020938#comment-16020938 ] Muhammad Gelbana commented on CALCITE-1792: --- I agree. However, don't you agree that for always-true conditions, wouldn't it be the same if we treat the join as a COMMA join, without a condition of course ? And regarding always-false conditions, the optimization of this join is left to the datasource I suppose, correct ? Because it obviously doesn't need to be implemented as it should return 0 rows. Pardon me for asking so much, but the more I ask, the more I understand how Calcite works. > RelToSqlConverter doesn't handle cartesian join (join cond as TRUE) > --- > > Key: CALCITE-1792 > URL: https://issues.apache.org/jira/browse/CALCITE-1792 > Project: Calcite > Issue Type: Bug > Components: jdbc-adapter >Reporter: Sergiy Simonov >Assignee: Jess Balint >Priority: Minor > Fix For: 1.13.0 > > > this test fails (added in {{RelToSqlConverterTest}}): > {code} > @Test public void testCartesianProductWithFullJoinSyntax() { > String query = "select * from \"department\"\n" > + "FULL JOIN \"employee\" ON TRUE"; > String expected = "SELECT *\nFROM \"foodmart\".\"department\"\n" > + "FULL JOIN \"foodmart\".\"employee\" ON TRUE"; > sql(query).ok(expected); > } > {code} > {{RelToSqlConverter}} is checking that the join condition is a {{RexCall}}. > In this case (and {{RelBuilder.join()}} with no join cond), the join cond is > a {{RexLiteral}} with a value of {{true}}. > Suggested fix is to handle the case with this specific join condition before > {{convertConditionToSqlNode()}}: -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Comment Edited] (CALCITE-1792) RelToSqlConverter doesn't handle cartesian join (join cond as TRUE)
[ https://issues.apache.org/jira/browse/CALCITE-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16019391#comment-16019391 ] Muhammad Gelbana edited comment on CALCITE-1792 at 5/22/17 10:02 AM: - [~julianhyde], why would you support the *FALSE* literal ? I'm working on supporting cartesian and inner joins for Drill and I had to do the following. I modified the {code}org.apache.calcite.adapter.jdbc.JdbcRules.JdbcJoin.implement(JdbcImplementor){code} implementation to be {code:java} public JdbcImplementor.Result implement(JdbcImplementor implementor) { final JdbcImplementor.Result leftResult = implementor.visitChild(0, left); final JdbcImplementor.Result rightResult = implementor.visitChild(1, right); final JdbcImplementor.Context leftContext = leftResult.qualifiedContext(); final JdbcImplementor.Context rightContext = rightResult.qualifiedContext(); SqlNode sqlCondition = null; JoinConditionType joinCondition = JoinConditionType.NONE; JoinType joinType = JoinType.COMMA; if (leftContext != null && rightContext != null) { sqlCondition = convertConditionToSqlNode(condition, leftContext, rightContext, left.getRowType().getFieldCount()); if (sqlCondition != null) { joinType = JoinType.INNER; joinCondition = JoinConditionType.ON; } } SqlJoin join = new SqlJoin(POS, leftResult.asFrom(), SqlLiteral.createBoolean(false, POS), joinType.symbol(POS), rightResult.asFrom(), joinCondition.symbol(POS), sqlCondition); return implementor.result(join, leftResult, rightResult); } {code} And the convertConditionToSqlNode method to accept RexLiteral {code:java} if (!(node instanceof RexCall) && !(node instanceof RexLiteral)) { throw new AssertionError(node); } {code} and added a Literal case {code:java} case LITERAL: RexLiteral literal = (RexLiteral) node; if (literal.isAlwaysTrue()) { return null; } break; {code} was (Author: mgelbana): [~julianhyde], why would you support the FALSE literal ? I'm working on supporting cartesian and inner joins for Drill and I had to do why you did. I modified the org.apache.calcite.adapter.jdbc.JdbcRules.JdbcJoin.implement(JdbcImplementor) implementation to be {code:java} public JdbcImplementor.Result implement(JdbcImplementor implementor) { final JdbcImplementor.Result leftResult = implementor.visitChild(0, left); final JdbcImplementor.Result rightResult = implementor.visitChild(1, right); final JdbcImplementor.Context leftContext = leftResult.qualifiedContext(); final JdbcImplementor.Context rightContext = rightResult.qualifiedContext(); SqlNode sqlCondition = null; JoinConditionType joinCondition = JoinConditionType.NONE; JoinType joinType = JoinType.COMMA; if (leftContext != null && rightContext != null) { sqlCondition = convertConditionToSqlNode(condition, leftContext, rightContext, left.getRowType().getFieldCount()); if (sqlCondition != null) { joinType = JoinType.INNER; joinCondition = JoinConditionType.ON; } } SqlJoin join = new SqlJoin(POS, leftResult.asFrom(), SqlLiteral.createBoolean(false, POS), joinType.symbol(POS), rightResult.asFrom(), joinCondition.symbol(POS), sqlCondition); return implementor.result(join, leftResult, rightResult); } {code} And the convertConditionToSqlNode method to accept RexLiteral {code:java} if (!(node instanceof RexCall) && !(node instanceof RexLiteral)) { throw new AssertionError(node); } {code} and added a Literal case {code:java} case LITERAL: RexLiteral literal = (RexLiteral) node; if (literal.isAlwaysTrue()) { return null; } break; {code} > RelToSqlConverter doesn't handle cartesian join (join cond as TRUE) > --- > > Key: CALCITE-1792 > URL: https://issues.apache.org/jira/browse/CALCITE-1792 > Project: Calcite > Issue Type: Bug > Components: jdbc-adapter >Reporter: Sergiy Simonov >Assignee: Jess Balint >Priority: Minor > Fix For: 1.13.0 > > > this test fails (added in {{RelToSqlConverterTest}}): > {code} > @Test public void testCartesianProductWithFullJoinSyntax() { > String query = "select * from \"department\"\n" > + "FULL JOIN \"employee\" ON TRUE"; > String expected = "SELECT *\nFROM \"foodmart\".\"department\"\n" > + "FULL JOIN \"foodmart\".\"employee\" ON TRUE"; > sql(query).ok(expected); > } > {code} > {{RelToSqlConverter}} is checking that
[jira] [Comment Edited] (CALCITE-1792) RelToSqlConverter doesn't handle cartesian join (join cond as TRUE)
[ https://issues.apache.org/jira/browse/CALCITE-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16019391#comment-16019391 ] Muhammad Gelbana edited comment on CALCITE-1792 at 5/22/17 10:00 AM: - [~julianhyde], why would you support the FALSE literal ? I'm working on supporting cartesian and inner joins for Drill and I had to do why you did. I modified the org.apache.calcite.adapter.jdbc.JdbcRules.JdbcJoin.implement(JdbcImplementor) implementation to be {code:java} public JdbcImplementor.Result implement(JdbcImplementor implementor) { final JdbcImplementor.Result leftResult = implementor.visitChild(0, left); final JdbcImplementor.Result rightResult = implementor.visitChild(1, right); final JdbcImplementor.Context leftContext = leftResult.qualifiedContext(); final JdbcImplementor.Context rightContext = rightResult.qualifiedContext(); SqlNode sqlCondition = null; JoinConditionType joinCondition = JoinConditionType.NONE; JoinType joinType = JoinType.COMMA; if (leftContext != null && rightContext != null) { sqlCondition = convertConditionToSqlNode(condition, leftContext, rightContext, left.getRowType().getFieldCount()); if (sqlCondition != null) { joinType = JoinType.INNER; joinCondition = JoinConditionType.ON; } } SqlJoin join = new SqlJoin(POS, leftResult.asFrom(), SqlLiteral.createBoolean(false, POS), joinType.symbol(POS), rightResult.asFrom(), joinCondition.symbol(POS), sqlCondition); return implementor.result(join, leftResult, rightResult); } {code} And the convertConditionToSqlNode method to accept RexLiteral {code:java} if (!(node instanceof RexCall) && !(node instanceof RexLiteral)) { throw new AssertionError(node); } {code} and added a Literal case {code:java} case LITERAL: RexLiteral literal = (RexLiteral) node; if (literal.isAlwaysTrue()) { return null; } break; {code} was (Author: mgelbana): [~julianhyde], why would you support the FALSE literal ? I'm working on supporting cartesian and inner joins for Drill and I had to do why you did. I modified the org.apache.calcite.adapter.jdbc.JdbcRules.JdbcJoin.implement(JdbcImplementor) implementation to be > RelToSqlConverter doesn't handle cartesian join (join cond as TRUE) > --- > > Key: CALCITE-1792 > URL: https://issues.apache.org/jira/browse/CALCITE-1792 > Project: Calcite > Issue Type: Bug > Components: jdbc-adapter >Reporter: Sergiy Simonov >Assignee: Jess Balint >Priority: Minor > Fix For: 1.13.0 > > > this test fails (added in {{RelToSqlConverterTest}}): > {code} > @Test public void testCartesianProductWithFullJoinSyntax() { > String query = "select * from \"department\"\n" > + "FULL JOIN \"employee\" ON TRUE"; > String expected = "SELECT *\nFROM \"foodmart\".\"department\"\n" > + "FULL JOIN \"foodmart\".\"employee\" ON TRUE"; > sql(query).ok(expected); > } > {code} > {{RelToSqlConverter}} is checking that the join condition is a {{RexCall}}. > In this case (and {{RelBuilder.join()}} with no join cond), the join cond is > a {{RexLiteral}} with a value of {{true}}. > Suggested fix is to handle the case with this specific join condition before > {{convertConditionToSqlNode()}}: -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (CALCITE-1792) RelToSqlConverter doesn't handle cartesian join (join cond as TRUE)
[ https://issues.apache.org/jira/browse/CALCITE-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16019391#comment-16019391 ] Muhammad Gelbana commented on CALCITE-1792: --- [~julianhyde], why would you support the FALSE literal ? I'm working on supporting cartesian and inner joins for Drill and I had to do why you did. I modified the org.apache.calcite.adapter.jdbc.JdbcRules.JdbcJoin.implement(JdbcImplementor) implementation to be > RelToSqlConverter doesn't handle cartesian join (join cond as TRUE) > --- > > Key: CALCITE-1792 > URL: https://issues.apache.org/jira/browse/CALCITE-1792 > Project: Calcite > Issue Type: Bug > Components: jdbc-adapter >Reporter: Sergiy Simonov >Assignee: Jess Balint >Priority: Minor > Fix For: 1.13.0 > > > this test fails (added in {{RelToSqlConverterTest}}): > {code} > @Test public void testCartesianProductWithFullJoinSyntax() { > String query = "select * from \"department\"\n" > + "FULL JOIN \"employee\" ON TRUE"; > String expected = "SELECT *\nFROM \"foodmart\".\"department\"\n" > + "FULL JOIN \"foodmart\".\"employee\" ON TRUE"; > sql(query).ok(expected); > } > {code} > {{RelToSqlConverter}} is checking that the join condition is a {{RexCall}}. > In this case (and {{RelBuilder.join()}} with no join cond), the join cond is > a {{RexLiteral}} with a value of {{true}}. > Suggested fix is to handle the case with this specific join condition before > {{convertConditionToSqlNode()}}: -- This message was sent by Atlassian JIRA (v6.3.15#6346)