[ https://issues.apache.org/jira/browse/CALCITE-2054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257982#comment-16257982 ]
Enrico Olivelli edited comment on CALCITE-2054 at 11/18/17 8:27 AM: -------------------------------------------------------------------- [~julianhyde] I found a simpler approach, that is to use setValidatedNodeType in convertUpdate to instruct the validator about inferred type of additional SqlNodes in the selectlist for the update. This way the change is minimal: no changes to signatures of methods. but I did not change the code according to your suggestion "You might need to change the tree-walk so that inferUnknownTypes gets called everywhere" https://github.com/apache/calcite/pull/568/files I appreciate your help was (Author: eolivelli): [~julianhyde] I found simpler approach, that is to use setValidatedNodeType in convertUpdate to instrct the validator of inferred type of additional SqlNodes in the selectlist for the update. This way the change is minimal: no changes to signatures of methods. but I did not change the code according to your suggestion "You might need to change the tree-walk so that inferUnknownTypes gets called everywhere" https://github.com/apache/calcite/pull/568/files I appreciate your help > Parser error on trivial UPDATE with dynamic parameters > ------------------------------------------------------ > > Key: CALCITE-2054 > URL: https://issues.apache.org/jira/browse/CALCITE-2054 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.15.0 > Reporter: Enrico Olivelli > Assignee: Julian Hyde > > with a simple UPDATE like: > UPDATE mytable set a=? where b=1 > I get the error below. > The "Table" is a ModifiableTable + ScannableTable, with "a" of type INTEGER > and "b" of type VARCHAR > Any hint ? > Thank you > Enrico > {code} > org.apache.calcite.runtime.CalciteContextException: At line 1, column 30: > Illegal use of dynamic parameter > 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:803) > at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:788) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4651) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:1694) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:1769) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:457) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.expandStar(SqlValidatorImpl.java:347) > at > org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3709) > at > org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:663) > at > org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:620) > at > org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3398) > at > org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3048) > at > org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:556) > at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:240) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)