-
Bug
-
Resolution: Done
-
Major
-
8.12.11.6_4
-
None
INSERT INTO SmallA_Direct (IntKey, StringKey, IntNum, StringNum) VALUES (4, '1', 1, '1');
results in
ERROR
13:11:43,493 ERROR [org.teiid.CONNECTOR] (Worker30_QueryProcessorQueue146) Connector worker process failed for atomic-request=ReyS5USI/FcT.7.0.26: org.teiid.core.TeiidRuntimeException: TEIID29006 A documentID is necessary to insert/update/delete nested array, INSERT INTO `dvqe_crud` (documentID, `type`, `StringKey`, `IntNum`, `StringNum`) VALUES (convert(4, string), 'nullSmallA', '1', 1, '1') at org.teiid.translator.couchbase.N1QLUpdateVisitor.visit(N1QLUpdateVisitor.java:149) [translator-couchbase-8.12.11.6_4-redhat-64-5.jar:8.12.11.6_4-redhat-64-5] at org.teiid.language.Insert.acceptVisitor(Insert.java:57) [teiid-api-8.12.11.6_4-redhat-64-5.jar:8.12.11.6_4-redhat-64-5] at org.teiid.language.visitor.AbstractLanguageVisitor.visitNode(AbstractLanguageVisitor.java:51) [teiid-api-8.12.11.6_4-redhat-64-5.jar:8.12.11.6_4-redhat-64-5] at org.teiid.language.visitor.SQLStringVisitor.append(SQLStringVisitor.java:91) [teiid-api-8.12.11.6_4-redhat-64-5.jar:8.12.11.6_4-redhat-64-5] at org.teiid.translator.couchbase.CouchbaseUpdateExecution.execute(CouchbaseUpdateExecution.java:52) [translator-couchbase-8.12.11.6_4-redhat-64-5.jar:8.12.11.6_4-redhat-64-5] at org.teiid.dqp.internal.datamgr.ConnectorWorkItem$1.execute(ConnectorWorkItem.java:401) at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:363) at sun.reflect.GeneratedMethodAccessor183.invoke(Unknown Source) [:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_121] at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211) at com.sun.proxy.$Proxy91.execute(Unknown Source) at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306) at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112) at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108) at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_121] at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65) at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:280) at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_121] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_121] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_121] 13:11:43,501 WARN [org.teiid.PROCESSOR] (Worker29_QueryProcessorQueue147) TEIID30020 Processing exception for request ReyS5USI/FcT.7 'TEIID30504 Source: TEIID29006 A documentID is necessary to insert/update/delete nested array, INSERT INTO `dvqe_crud` (documentID, `type`, `StringKey`, `IntNum`, `StringNum`) VALUES (convert(4, string), 'nullSmallA', '1', 1, '1')'. Originally TeiidProcessingException N1QLUpdateVisitor.java:149. Enable more detailed logging to see the entire stacktrace.
My take from the implementing code:
The actual source cmd contains documentID and it has no NAMEINSOURCE option (after which the column is considered PK/documentID of couchbase document). But the name of the column is probably being compared on the level of view, not resulting source command.
source model ddl
CREATE FOREIGN TABLE SmallA ( documentID string PRIMARY KEY, type string OPTIONS (NAMEINSOURCE '`type`'), FloatNum float OPTIONS (NAMEINSOURCE '`FloatNum`'), BigIntegerValue biginteger OPTIONS (NAMEINSOURCE '`BigIntegerValue`'), StringKey string OPTIONS (NAMEINSOURCE '`StringKey`'), CharValue string OPTIONS (NAMEINSOURCE '`CharValue`'), LongNum long OPTIONS (NAMEINSOURCE '`LongNum`'), DoubleNum double OPTIONS (NAMEINSOURCE '`DoubleNum`'), ObjectValue string OPTIONS (NAMEINSOURCE '`ObjectValue`'), ShortValue integer OPTIONS (NAMEINSOURCE '`ShortValue`'), BigDecimalValue bigdecimal OPTIONS (NAMEINSOURCE '`BigDecimalValue`'), DateValue string OPTIONS (NAMEINSOURCE '`DateValue`'), BooleanValue boolean OPTIONS (NAMEINSOURCE '`BooleanValue`'), TimestampValue string OPTIONS (NAMEINSOURCE '`TimestampValue`'), ByteNum integer OPTIONS (NAMEINSOURCE '`ByteNum`'), StringNum string OPTIONS (NAMEINSOURCE '`StringNum`'), TimeValue string OPTIONS (NAMEINSOURCE '`TimeValue`'), IntNum integer OPTIONS (NAMEINSOURCE '`IntNum`') ) OPTIONS (NAMEINSOURCE '`dvqe_crud`', UPDATABLE TRUE, "teiid_couchbase:ISARRAYTABLE" 'false', "teiid_couchbase:NAMEDTYPEPAIR" '`type`:''nullSmallA''');
DDL of view
CREATE VIEW SmallA_Direct (IntKey integer PRIMARY KEY, StringKey string, IntNum integer, StringNum string) OPTIONS (UPDATABLE 'TRUE') AS SELECT CONVERT(documentID,integer), StringKey, IntNum, StringNum FROM Source.SmallA; CREATE TRIGGER ON SmallA_Direct INSTEAD OF INSERT AS FOR EACH ROW BEGIN ATOMIC INSERT INTO Source.SmallA(documentID, type, StringKey, IntNum, StringNum) VALUES (NEW.IntKey, 'nullSmallA', NEW.StringKey, NEW.IntNum, NEW.StringNum); END;