[jira] [Resolved] (CALCITE-3054) ElasticSearch adapter. Avoid scripting for simple projections
[ https://issues.apache.org/jira/browse/CALCITE-3054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei Sereda resolved CALCITE-3054. Resolution: Fixed Fixed in [c20af344bf|https://github.com/apache/calcite/pull/1200/commits/c20af344bfe9a4da41f5556f2896208043d3d718] > ElasticSearch adapter. Avoid scripting for simple projections > - > > Key: CALCITE-3054 > URL: https://issues.apache.org/jira/browse/CALCITE-3054 > Project: Calcite > Issue Type: Bug > Components: elasticsearch-adapter >Affects Versions: 1.19.0 >Reporter: Andrei Sereda >Assignee: Andrei Sereda >Priority: Major > Labels: pull-request-available > Time Spent: 20m > Remaining Estimate: 0h > > No > [scripting|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html] > should be used for simple field projection(s). > In some cases elastic adapter uses {{script}} instead of {{_source}} for > simple field projections. > {code:sql} > select _MAP['a'], _MAP['b.a'] from elastic > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3054) ElasticSearch adapter. Avoid scripting for simple projections
[ https://issues.apache.org/jira/browse/CALCITE-3054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] ASF GitHub Bot updated CALCITE-3054: Labels: pull-request-available (was: ) > ElasticSearch adapter. Avoid scripting for simple projections > - > > Key: CALCITE-3054 > URL: https://issues.apache.org/jira/browse/CALCITE-3054 > Project: Calcite > Issue Type: Bug > Components: elasticsearch-adapter >Affects Versions: 1.19.0 >Reporter: Andrei Sereda >Assignee: Andrei Sereda >Priority: Major > Labels: pull-request-available > > No > [scripting|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html] > should be used for simple field projection(s). > In some cases elastic adapter uses {{script}} instead of {{_source}} for > simple field projections. > {code:sql} > select _MAP['a'], _MAP['b.a'] from elastic > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3054) ElasticSearch adapter. Avoid scripting for simple projections
[ https://issues.apache.org/jira/browse/CALCITE-3054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei Sereda updated CALCITE-3054: --- Description: No [scripting|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html] should be used for simple field projection(s). In some cases elastic adapter uses {{script}} instead of {{_source}} for simple field projections. {code:sql} select _MAP['a'], _MAP['b.a'] from elastic {code} was: No [scripting|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html] should be used for simple field projection(s). In some cases elastic adapter uses {{script_fields}} instead of {{_source}} for simple field projections. {code:sql} select _MAP['a'], _MAP['b.a'] from elastic {code} > ElasticSearch adapter. Avoid scripting for simple projections > - > > Key: CALCITE-3054 > URL: https://issues.apache.org/jira/browse/CALCITE-3054 > Project: Calcite > Issue Type: Bug > Components: elasticsearch-adapter >Affects Versions: 1.19.0 >Reporter: Andrei Sereda >Assignee: Andrei Sereda >Priority: Major > > No > [scripting|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html] > should be used for simple field projection(s). > In some cases elastic adapter uses {{script}} instead of {{_source}} for > simple field projections. > {code:sql} > select _MAP['a'], _MAP['b.a'] from elastic > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3054) ElasticSearch adapter. Avoid scripting for simple projections
Andrei Sereda created CALCITE-3054: -- Summary: ElasticSearch adapter. Avoid scripting for simple projections Key: CALCITE-3054 URL: https://issues.apache.org/jira/browse/CALCITE-3054 Project: Calcite Issue Type: Bug Components: elasticsearch-adapter Affects Versions: 1.19.0 Reporter: Andrei Sereda Assignee: Andrei Sereda No [scripting|https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html] should be used for simple field projection(s). In some cases elastic adapter uses {{script_fields}} instead of {{_source}} for simple field projections. {code:sql} select _MAP['a'], _MAP['b.a'] from elastic {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3038) DESCRIBE throws exception when table name is non-reserved keyword
[ https://issues.apache.org/jira/browse/CALCITE-3038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835289#comment-16835289 ] Rui Li commented on CALCITE-3038: - [~zabetak], thanks for pointing me to CALCITE-1168. I now understand {{DESCRIBE}} w/o {{TABLE}} is not standard use pattern. But perhaps we can have some document about this limitation, that user must specify {{TABLE}} (or quote) when table name is non-reserved keyword? > DESCRIBE throws exception when table name is non-reserved keyword > - > > Key: CALCITE-3038 > URL: https://issues.apache.org/jira/browse/CALCITE-3038 > Project: Calcite > Issue Type: Bug >Reporter: Rui Li >Priority: Major > > For example, suppose I have a table named {{source}}. {{DESCRIBE source}} > throws exception: > {noformat} > CalciteException: Non-query expression encountered in illegal context > {noformat} > Not sure if this behavior is intended. But if a user is allowed to create a > table named {{source}} w/o quoting it, it seems strange to require quoting > when describe the table. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3050) Integrate SqlDialect and SqlParser.Config
[ https://issues.apache.org/jira/browse/CALCITE-3050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835268#comment-16835268 ] Danny Chan commented on CALCITE-3050: - I'm thinking about if we can merge these "SqlDialect" like config items together, I have fired a discussion in the @DEV mailing list, to see if we can make some progress > Integrate SqlDialect and SqlParser.Config > - > > Key: CALCITE-3050 > URL: https://issues.apache.org/jira/browse/CALCITE-3050 > Project: Calcite > Issue Type: Bug >Reporter: Julian Hyde >Assignee: Danny Chan >Priority: Major > > {{SqlDialect}} is used by the JDBC adapter to generate SQL in the target > dialect of a data source. {{SqlParser.Config}} is used to set what the parser > should allow for SQL statements sent to Calcite. But they both are a > representation of "dialect". And they come together when we want to use a > Babel parser to understand SQL statements that are meant for a data source. > So it makes sense to integrate them, somehow. We could add a method > {code}void SqlParser.ConfigBuilder.setFrom(SqlDialect dialect){code} or do it > from the other end, {code}SqlDialect.configureParser(SqlParser.ConfigBuilder > configBuilder){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3052) Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/CALCITE-3052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835234#comment-16835234 ] Danny Chan commented on CALCITE-3052: - Thx [~anha] for reporting this. Reproduce this problem in "MaterializationTest" is better, then we can find if it is a bug. > Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): > ArrayIndexOutOfBoundsException > -- > > Key: CALCITE-3052 > URL: https://issues.apache.org/jira/browse/CALCITE-3052 > Project: Calcite > Issue Type: Bug >Affects Versions: 1.19.0 >Reporter: Anton Haidai >Priority: Major > > *Materialized views enabled:* > # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from > students group by team" > # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, > faculty from students group by faculty, team", > *Query:* > # "select count(*), team from students group by team" > *Error* (stacktrace is obtained using the current *master* branch: > "247c7d4f76"): > {code} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 > at > com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) > at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) > at > org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) > at > org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) > at > org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776) > at > org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) > ... 71 common frames omitted > {code} > Reproducible only if both Materialization views listed are enabled: any > single one of these two could be successfully used with the query without any > errors. Looks like is is reproducible when AbstractMaterializedViewRule is > trying to rewrite one materialized view using the another materialized view. > Currently, I'm trying to reproduce the issue in "MaterializationTest": > without a success so far, I'll update the ticket if I'll find a working way > to reproduce the issue in the test will be discovered. -- 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] [Created] (CALCITE-3053) Add a test to ensure that all functions are documented in the SQL reference
Julian Hyde created CALCITE-3053: Summary: Add a test to ensure that all functions are documented in the SQL reference Key: CALCITE-3053 URL: https://issues.apache.org/jira/browse/CALCITE-3053 Project: Calcite Issue Type: Bug Reporter: Julian Hyde Assignee: Julian Hyde Add a test to ensure that all functions are documented in the [SQL reference|https://calcite.apache.org/docs/reference.html]. The test would would be called {{DocumentationTest}}, iterate through all functions and operators in {{SqlStdOperatorTable}} and {{OracleSqlOperatorTable}} and make sure that there is a line "| functionName ... |" in {{reference.md}}. There are sure to be exceptions. We can exceptions to a comment inside {{reference.md}} that is seen by the test but does not appear in the generated web page. I'll do this after CALCITE-2846, and make sure that Oracle- and MySQL-specific functions are flagged as such. After CALCITE-3016 we will need to refactor the test a little. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3050) Integrate SqlDialect and SqlParser.Config
[ https://issues.apache.org/jira/browse/CALCITE-3050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834983#comment-16834983 ] Julian Hyde commented on CALCITE-3050: -- Well, I agree with you. They are the same basic information with two distinct purposes. I do have a use case where I want a single "dialect" and I want to use it to configure how SQL is parsed and also how SQL is generated. If you have ideas for how to integrate the two APIs, let me know. I'd like to avoid breaking stuff, and also avoid introducing unnecessary coupling between components. > Integrate SqlDialect and SqlParser.Config > - > > Key: CALCITE-3050 > URL: https://issues.apache.org/jira/browse/CALCITE-3050 > Project: Calcite > Issue Type: Bug >Reporter: Julian Hyde >Assignee: Danny Chan >Priority: Major > > {{SqlDialect}} is used by the JDBC adapter to generate SQL in the target > dialect of a data source. {{SqlParser.Config}} is used to set what the parser > should allow for SQL statements sent to Calcite. But they both are a > representation of "dialect". And they come together when we want to use a > Babel parser to understand SQL statements that are meant for a data source. > So it makes sense to integrate them, somehow. We could add a method > {code}void SqlParser.ConfigBuilder.setFrom(SqlDialect dialect){code} or do it > from the other end, {code}SqlDialect.configureParser(SqlParser.ConfigBuilder > configBuilder){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2846) Document Oracle-specific functions, such as NVL and LTRIM, in the SQL reference
[ https://issues.apache.org/jira/browse/CALCITE-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834980#comment-16834980 ] Julian Hyde commented on CALCITE-2846: -- Almost done. See my branch [https://github.com/julianhyde/calcite/tree/2846-fun-ref] where I have fixed up a bit and added a test (see CALCITE-3053 for details). I will commit when tests pass. > Document Oracle-specific functions, such as NVL and LTRIM, in the SQL > reference > --- > > Key: CALCITE-2846 > URL: https://issues.apache.org/jira/browse/CALCITE-2846 > Project: Calcite > Issue Type: Improvement > Components: site >Reporter: Julian Hyde >Assignee: Julian Hyde >Priority: Major > Labels: documentation, pull-request-available > Time Spent: 0.5h > Remaining Estimate: 0h > > Document Oracle-specific functions (DECODE, NVL, LTRIM, RTRIM, SUBSTR, > GREATEST, LEAST) in the [SQL > reference|https://calcite.apache.org/docs/reference.html]. > Same goes for MySQL-specific functions (e.g. JSON_TYPE). > I don't think we should have separate lists of Oracle-specific functions and > MySQL-specific functions. Because quite a few functions appear in more than > one place. Better, I think, to have a concise annotation against each > function which tables it occurs in. > The current list of tables is standard, oracle, spatial, mysql. Perhaps also > indicate whether a function is an extension to the SQL standard but still > occurs in Calcite's default table. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (CALCITE-3052) Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException
Anton Haidai created CALCITE-3052: - Summary: Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException Key: CALCITE-3052 URL: https://issues.apache.org/jira/browse/CALCITE-3052 Project: Calcite Issue Type: Bug Affects Versions: 1.19.0 Reporter: Anton Haidai *Materialized views enabled:* # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from students group by team" # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, faculty from students group by faculty, team", *Query:* # "select count(*), team from students group by team" *Error* (stacktrace is obtained using the current *master* branch: "247c7d4f76"): {code} at org.apache.calcite.prepare.ZEnginePreparingStmt.optimize(ZEnginePreparingStmt.java:311) at org.apache.calcite.prepare.ZEnginePreparingStmt.prepare_(ZEnginePreparingStmt.java:195) at org.apache.calcite.prepare.ZEnginePreparingStmt.prepareRel(ZEnginePreparingStmt.java:142) at org.apache.calcite.prepare.ZEnginePrepareImpl.prepare2_(ZEnginePrepareImpl.java:424) at org.apache.calcite.prepare.ZEnginePrepareImpl.prepareSql(ZEnginePrepareImpl.java:108) ... 55 common frames omitted Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) ... 71 common frames omitted {code} Reproducible only if both Materialization views listed are enabled: any single one of these two could be successfully used with the query without any errors. Currently, I'm trying to reproduce the issue in "MaterializationTest": without a success so far, I'll update the ticket if I'll find a working way to reproduce the issue in the test will be discovered. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3052) Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/CALCITE-3052?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anton Haidai updated CALCITE-3052: -- Description: *Materialized views enabled:* # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from students group by team" # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, faculty from students group by faculty, team", *Query:* # "select count(*), team from students group by team" *Error* (stacktrace is obtained using the current *master* branch: "247c7d4f76"): {code} Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) ... 71 common frames omitted {code} Reproducible only if both Materialization views listed are enabled: any single one of these two could be successfully used with the query without any errors. Looks like is is reproducible when AbstractMaterializedViewRule is trying to rewrite one materialized view using the another materialized view. Currently, I'm trying to reproduce the issue in "MaterializationTest": without a success so far, I'll update the ticket if I'll find a working way to reproduce the issue in the test will be discovered. was: *Materialized views enabled:* # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from students group by team" # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, faculty from students group by faculty, team", *Query:* # "select count(*), team from students group by team" *Error* (stacktrace is obtained using the current *master* branch: "247c7d4f76"): {code} Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) ... 71 common frames omitted {code} Reproducible only if both Materialization views listed are enabled: any single one of these two could be successfully used with the query without any errors. Currently, I'm trying to reproduce the issue in "MaterializationTest": without a success so far, I'll update the ticket if I'll find a working way to reproduce the issue in the test will be discovered. > Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): > ArrayIndexOutOfBoundsException > -- > > Key: CALCITE-3052 > URL: https://issues.apache.org/jira/browse/CALCITE-3052 > Project: Calcite > Issue Type: Bug >Affects Versions: 1.19.0 >Reporter: Anton Haidai >Priority: Major > > *Materialized views enabled:* > # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from > students group by team" > # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, > faculty from students group by faculty, team", > *Query:* > # "select count(*), team from students group by team" > *Error* (stacktrace is obtained using the current *master* branch: > "247c7d4f76"): > {code} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 > at > com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) > at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) > at > org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) > at > org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) > at >
[jira] [Updated] (CALCITE-3052) Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/CALCITE-3052?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anton Haidai updated CALCITE-3052: -- Description: *Materialized views enabled:* # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from students group by team" # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, faculty from students group by faculty, team", *Query:* # "select count(*), team from students group by team" *Error* (stacktrace is obtained using the current *master* branch: "247c7d4f76"): {code} Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) ... 71 common frames omitted {code} Reproducible only if both Materialization views listed are enabled: any single one of these two could be successfully used with the query without any errors. Currently, I'm trying to reproduce the issue in "MaterializationTest": without a success so far, I'll update the ticket if I'll find a working way to reproduce the issue in the test will be discovered. was: *Materialized views enabled:* # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from students group by team" # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, faculty from students group by faculty, team", *Query:* # "select count(*), team from students group by team" *Error* (stacktrace is obtained using the current *master* branch: "247c7d4f76"): {code} at org.apache.calcite.prepare.ZEnginePreparingStmt.optimize(ZEnginePreparingStmt.java:311) at org.apache.calcite.prepare.ZEnginePreparingStmt.prepare_(ZEnginePreparingStmt.java:195) at org.apache.calcite.prepare.ZEnginePreparingStmt.prepareRel(ZEnginePreparingStmt.java:142) at org.apache.calcite.prepare.ZEnginePrepareImpl.prepare2_(ZEnginePrepareImpl.java:424) at org.apache.calcite.prepare.ZEnginePrepareImpl.prepareSql(ZEnginePrepareImpl.java:108) ... 55 common frames omitted Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522) at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) ... 71 common frames omitted {code} Reproducible only if both Materialization views listed are enabled: any single one of these two could be successfully used with the query without any errors. Currently, I'm trying to reproduce the issue in "MaterializationTest": without a success so far, I'll update the ticket if I'll find a working way to reproduce the issue in the test will be discovered. > Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): > ArrayIndexOutOfBoundsException > -- > > Key: CALCITE-3052 > URL: https://issues.apache.org/jira/browse/CALCITE-3052 > Project: Calcite > Issue Type: Bug >Affects Versions: 1.19.0 >Reporter: Anton Haidai >Priority: Major > > *Materialized views enabled:* > # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from > students group by team" > # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, > faculty from students group by faculty, team", > *Query:* > # "select count(*), team from students group by team" > *Error* (stacktrace is obtained using the current *master* branch: > "247c7d4f76"): > {code} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 > at > com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60) > 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] [Commented] (CALCITE-3046) CompileException when inserting casted value of composited user defined type into table
[ https://issues.apache.org/jira/browse/CALCITE-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834840#comment-16834840 ] Hongze Zhang commented on CALCITE-3046: --- As what's been suggested, I've added some extra visiting logic to EnumerableRelImplementor.TypeFinder, and per content of the changes the overall performance should not be affected much. * visit typed null literal, e.g. MyType type = (MyType) null; * visit convert expression, e.g. MyType type = (MyType) obj; * visit linq4j {{FunctionExpression}} (this fixes the error described in the issue topic/description) > CompileException when inserting casted value of composited user defined type > into table > --- > > Key: CALCITE-3046 > URL: https://issues.apache.org/jira/browse/CALCITE-3046 > Project: Calcite > Issue Type: Bug >Reporter: Hongze Zhang >Priority: Major > Labels: pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > Reproduce the error by running following test case from {{ServerTest.java}}: > {code:java} > @Test public void testInsertCastedValueOfCompositeUdt() throws Exception { > try (Connection c = connect(); > Statement s = c.createStatement()) { > boolean b = s.execute("create type mytype as (i int, j int)"); > assertThat(b, is(false)); > b = s.execute("create table w (i int not null, j mytype)"); > assertThat(b, is(false)); > int x = s.executeUpdate("insert into w " > + "values (1, cast((select j from w) as mytype))"); > assertThat(x, is(1)); > } > } > {code} > Root cause of the error: > {code} > Caused by: org.codehaus.commons.compiler.CompileException: Line 96, Column > 84: Cannot determine simple type name "Record2_0" > at > org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211) > at > org.codehaus.janino.UnitCompiler.getReferenceType(UnitCompiler.java:6833) > at > org.codehaus.janino.UnitCompiler.getReferenceType(UnitCompiler.java:6594) > at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:6573) > at org.codehaus.janino.UnitCompiler.access$13900(UnitCompiler.java:215) > at > org.codehaus.janino.UnitCompiler$22$1.visitReferenceType(UnitCompiler.java:6481) > at > org.codehaus.janino.UnitCompiler$22$1.visitReferenceType(UnitCompiler.java:6476) > at org.codehaus.janino.Java$ReferenceType.accept(Java.java:3928) > at org.codehaus.janino.UnitCompiler$22.visitType(UnitCompiler.java:6476) > at org.codehaus.janino.UnitCompiler$22.visitType(UnitCompiler.java:6469) > at org.codehaus.janino.Java$ReferenceType.accept(Java.java:3927) > at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:6469) > at org.codehaus.janino.UnitCompiler.access$1300(UnitCompiler.java:215) > at > org.codehaus.janino.UnitCompiler$36.getParameterTypes2(UnitCompiler.java:10383) > at > org.codehaus.janino.IClass$IInvocable.getParameterTypes(IClass.java:960) > at org.codehaus.janino.IClass$IMethod.getDescriptor2(IClass.java:1227) > at org.codehaus.janino.IClass$IInvocable.getDescriptor(IClass.java:983) > at org.codehaus.janino.IClass.getIMethods(IClass.java:248) > at org.codehaus.janino.IClass.getIMethods(IClass.java:237) > at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:492) > at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:981) > at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:951) > at org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:215) > at > org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:409) > at > org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:406) > at > org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1149) > at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406) > at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5509) > at org.codehaus.janino.UnitCompiler.access$9500(UnitCompiler.java:215) > at > org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4432) > at > org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4396) > at > org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5238) > at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396) > at > org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662) > at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5182) > at org.codehaus.janino.UnitCompiler.access$9100(UnitCompiler.java:215) > at >
[jira] [Commented] (CALCITE-3038) DESCRIBE throws exception when table name is non-reserved keyword
[ https://issues.apache.org/jira/browse/CALCITE-3038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834666#comment-16834666 ] Stamatis Zampetakis commented on CALCITE-3038: -- I tested the following and it works: {code:java} // Some comments here public void testDescribe() { check("describe table source", "DESCRIBE TABLE `SOURCE`"); } {code} Using DESCRIBE without a TABLE normally expects a query expression so I think the exception is normal based on the SQL standard. [~lirui], can you have a look in the discussion in CALCITE-1168 and check if what I am saying makes sense? > DESCRIBE throws exception when table name is non-reserved keyword > - > > Key: CALCITE-3038 > URL: https://issues.apache.org/jira/browse/CALCITE-3038 > Project: Calcite > Issue Type: Bug >Reporter: Rui Li >Priority: Major > > For example, suppose I have a table named {{source}}. {{DESCRIBE source}} > throws exception: > {noformat} > CalciteException: Non-query expression encountered in illegal context > {noformat} > Not sure if this behavior is intended. But if a user is allowed to create a > table named {{source}} w/o quoting it, it seems strange to require quoting > when describe the table. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[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] [Resolved] (CALCITE-3039) In Interpreter, min() incorrectly returns maximum double value
[ https://issues.apache.org/jira/browse/CALCITE-3039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chunwei Lei resolved CALCITE-3039. -- Resolution: Fixed Fix Version/s: 1.20.0 > In Interpreter, min() incorrectly returns maximum double value > -- > > Key: CALCITE-3039 > URL: https://issues.apache.org/jira/browse/CALCITE-3039 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: dijkspicy >Assignee: Chunwei Lei >Priority: Major > Labels: easyfix, pull-request-available > Fix For: 1.20.0 > > Time Spent: 2h 40m > Remaining Estimate: 0h > > {code:java} > //代码占位符 > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code float} values as a user-defined aggregate. > */ > public static class MinFloat extends NumericComparison { > public MinFloat() { > super(Float.MAX_VALUE, Math::min); > } > } > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code double} and {@code real} values as a user-defined aggregate. > */ > public static class MinDouble extends NumericComparison { > public MinDouble() { > super(Double.MAX_VALUE, Math::max); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CALCITE-3039) In Interpreter, min() incorrectly returns maximum double value
[ https://issues.apache.org/jira/browse/CALCITE-3039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chunwei Lei updated CALCITE-3039: - Affects Version/s: (was: 1.17.0) 1.19.0 > In Interpreter, min() incorrectly returns maximum double value > -- > > Key: CALCITE-3039 > URL: https://issues.apache.org/jira/browse/CALCITE-3039 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.19.0 >Reporter: dijkspicy >Assignee: Chunwei Lei >Priority: Major > Labels: easyfix, pull-request-available > Fix For: 1.20.0 > > Time Spent: 2h 40m > Remaining Estimate: 0h > > {code:java} > //代码占位符 > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code float} values as a user-defined aggregate. > */ > public static class MinFloat extends NumericComparison { > public MinFloat() { > super(Float.MAX_VALUE, Math::min); > } > } > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code double} and {@code real} values as a user-defined aggregate. > */ > public static class MinDouble extends NumericComparison { > public MinDouble() { > super(Double.MAX_VALUE, Math::max); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-3039) In Interpreter, min() incorrectly returns maximum double value
[ https://issues.apache.org/jira/browse/CALCITE-3039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834475#comment-16834475 ] Chunwei Lei commented on CALCITE-3039: -- Fixed in [da4970e647d58b2989077688d1e19747fd459d14|https://github.com/apache/calcite/commit/da4970e647d58b2989077688d1e19747fd459d14]. Thanks for the PR, [~dijkspicy]. > In Interpreter, min() incorrectly returns maximum double value > -- > > Key: CALCITE-3039 > URL: https://issues.apache.org/jira/browse/CALCITE-3039 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: dijkspicy >Assignee: Chunwei Lei >Priority: Major > Labels: easyfix, pull-request-available > Time Spent: 2h 40m > Remaining Estimate: 0h > > {code:java} > //代码占位符 > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code float} values as a user-defined aggregate. > */ > public static class MinFloat extends NumericComparison { > public MinFloat() { > super(Float.MAX_VALUE, Math::min); > } > } > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code double} and {@code real} values as a user-defined aggregate. > */ > public static class MinDouble extends NumericComparison { > public MinDouble() { > super(Double.MAX_VALUE, Math::max); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Assigned] (CALCITE-3039) In Interpreter, min() incorrectly returns maximum double value
[ https://issues.apache.org/jira/browse/CALCITE-3039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chunwei Lei reassigned CALCITE-3039: Assignee: Chunwei Lei > In Interpreter, min() incorrectly returns maximum double value > -- > > Key: CALCITE-3039 > URL: https://issues.apache.org/jira/browse/CALCITE-3039 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: dijkspicy >Assignee: Chunwei Lei >Priority: Major > Labels: easyfix, pull-request-available > Time Spent: 2h 40m > Remaining Estimate: 0h > > {code:java} > //代码占位符 > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code float} values as a user-defined aggregate. > */ > public static class MinFloat extends NumericComparison { > public MinFloat() { > super(Float.MAX_VALUE, Math::min); > } > } > /** Implementation of {@code MIN} function to calculate the minimum of > * {@code double} and {@code real} values as a user-defined aggregate. > */ > public static class MinDouble extends NumericComparison { > public MinDouble() { > super(Double.MAX_VALUE, Math::max); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)