[teiid-issues] [JBoss JIRA] (TEIID-5039) Couchbase document type definition for a table

Jan Stastny (JIRA) issues at jboss.org
Thu Sep 21 08:51:00 EDT 2017


    [ https://issues.jboss.org/browse/TEIID-5039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13466861#comment-13466861 ] 

Jan Stastny commented on TEIID-5039:
------------------------------------

[~shawkins] Bulk update was brokend by this fix I believe.
For query:
{code:sql|title=query}
INSERT INTO Source.smallA(documentId,StringKey) VALUES(3,'3'),(4,'4'),(5,'5')
{code}
I get:
{code:title=server.log}
14:43:13,773 ERROR [org.teiid.CONNECTOR] (Worker0_QueryProcessorQueue5) Connector worker process failed for atomic-request=lzmsLg5FtNZI.3.0.3: org.teiid.core.TeiidRuntimeException: TEIID29007 Mismatch of bulk insert columns and parameter values, INSERT INTO `dvqe_crud` (documentID, `StringKey`) VALUES (?, ?)
	at org.teiid.translator.couchbase.N1QLUpdateVisitor.appendBulkValues(N1QLUpdateVisitor.java:201) [translator-couchbase-8.12.11.6_4.jar:8.12.11.6_4]
	at org.teiid.translator.couchbase.N1QLUpdateVisitor.visit(N1QLUpdateVisitor.java:163) [translator-couchbase-8.12.11.6_4.jar:8.12.11.6_4]
	at org.teiid.language.Insert.acceptVisitor(Insert.java:57) [teiid-api-8.12.11.6_4-redhat-64-6.jar:8.12.11.6_4-redhat-64-6]
	at org.teiid.language.visitor.AbstractLanguageVisitor.visitNode(AbstractLanguageVisitor.java:51) [teiid-api-8.12.11.6_4-redhat-64-6.jar:8.12.11.6_4-redhat-64-6]
	at org.teiid.language.visitor.SQLStringVisitor.append(SQLStringVisitor.java:91) [teiid-api-8.12.11.6_4-redhat-64-6.jar:8.12.11.6_4-redhat-64-6]
	at org.teiid.translator.couchbase.CouchbaseUpdateExecution.execute(CouchbaseUpdateExecution.java:52) [translator-couchbase-8.12.11.6_4.jar:8.12.11.6_4]
	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.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar: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.$Proxy79.execute(Unknown Source)
	at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)
	at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:142)
	at org.teiid.query.processor.relational.ProjectIntoNode.checkExitConditions(ProjectIntoNode.java:264)
	at org.teiid.query.processor.relational.ProjectIntoNode.nextBatchDirect(ProjectIntoNode.java:234)
	at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:281)
	at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)
	at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)
	at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)
	at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)
	at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)
	at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:472)
	at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:348)
	at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
	at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)
	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]
{code}

> Couchbase document type definition for a table
> ----------------------------------------------
>
>                 Key: TEIID-5039
>                 URL: https://issues.jboss.org/browse/TEIID-5039
>             Project: Teiid
>          Issue Type: Bug
>          Components: Misc. Connectors
>            Reporter: Jan Stastny
>            Assignee: Steven Hawkins
>            Priority: Blocker
>             Fix For: 10.0, 8.12.x-6.4, 9.3.3
>
>
> If a table is tight to a single document type, there shouldn't be need for explicit type column assignment when inserting into that table.
> With a vdb:
> {code:sql|title=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`:''SmallA''');
> {code}
> I'd like to insert using such query:
> {code:sql|title=query}
> INSERT INTO Source.SmallA (documentID, StringKey, IntNum, StringNum) VALUES (1,  '1',  1,  '1');
> {code}
> And then getting the value back using
> {code:sql|title=query_select}
> SELECT * FROM Source.SmallA
> {code}
> to see the row I inserted.
> Everything without the need to explicitly set 'type' column for the insert query. 
> There is missing 1-to-1 relation between a defined FOREIGN table and a document type in couchbase. (When I INSERT into a table in Teiid, there should be clear distiction about what type of document I am inserting and to what keyspace). Possibly the OPTION "teiid_couchbase:NAMEDTYPEPAIR" can serve this purpose, if it works that way for selects, why not for inserts.
> I see this as an usability blocker, when user has to set 'type' explicitly in every single insert.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the teiid-issues mailing list