[ 
https://issues.apache.org/jira/browse/CALCITE-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16724761#comment-16724761
 ] 

Alexander Shilov commented on CALCITE-2748:
-------------------------------------------

Can you give me some example from those sub-projects of how they have 
implemented UPDATE, because I couldn't find anything besides ModifiableTable in 
the docs?

By the way, Collection API is marked experimental and inefficient, and nothing 
changed since 2013, when it was written. How many projects are using it? Maybe 
we can change it, so it can implement UPDATE and other statements?

> UPDATE doesn't work
> -------------------
>
>                 Key: CALCITE-2748
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2748
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica, core, jdbc-adapter
>    Affects Versions: 1.17.0
>            Reporter: Alexander Shilov
>            Priority: Major
>
> I tried to use UPDATE DML statements, but got exception:
> {code:java}
> java.lang.AssertionError: UPDATE
> at 
> org.apache.calcite.adapter.enumerable.EnumerableTableModify.implement(EnumerableTableModify.java:137)
> at 
> org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:100)
> at 
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
> at 
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1238)
> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:332)
> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:231)
> at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:772)
> at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:636)
> at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:606)
> at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:229)
> at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:211)
> at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:200)
> at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:91)
> at 
> org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
> ...{code}
> The reason is that EnumerableTableModify.implement doesn't support UPDATE.
> I've tried to implement it, but it's difficult with [Collection 
> API|https://github.com/apache/calcite/blob/02752fe78f817ed317b8873d2f4c7b79bfe8b9b5/core/src/main/java/org/apache/calcite/schema/ModifiableTable.java#L40].
>  There is no method in Collection, that can handle it, and if you use 
> remove/add methods to simulate update, then updated rows count will be equals 
> to zero.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to