[
https://issues.jboss.org/browse/TEIID-5030?page=com.atlassian.jira.plugin...
]
Jan Stastny commented on TEIID-5030:
------------------------------------
[~shawkins] Yes, there are the columns modelled as string in my source model, then only in
the view they are converted to time/date/timestamp. And there is implicit convert from
date/datetime/time to string, which is not being applied before pushdown obviously. I
think this issue needs to be reopened.
{code:sql|title=Couchbase_small physical model DDL}
SET NAMESPACE 'http://www.teiid.org/translator/couchbase/2017' AS
teiid_couchbase;
CREATE FOREIGN TABLE SmallA (
documentID string,
FloatNum integer OPTIONS (NAMEINSOURCE '`FloatNum`'),
IntKey integer PRIMARY KEY OPTIONS (NAMEINSOURCE '`IntKey`'),
BigIntegerValue integer OPTIONS (NAMEINSOURCE '`BigIntegerValue`'),
StringKey string OPTIONS (NAMEINSOURCE '`StringKey`'),
CharValue string OPTIONS (NAMEINSOURCE '`CharValue`'),
LongNum integer OPTIONS (NAMEINSOURCE '`LongNum`'),
type string OPTIONS (NAMEINSOURCE '`type`'),
DoubleNum integer OPTIONS (NAMEINSOURCE '`DoubleNum`'),
ObjectValue string OPTIONS (NAMEINSOURCE '`ObjectValue`'),
ShortValue integer OPTIONS (NAMEINSOURCE '`ShortValue`'),
BigDecimalValue integer 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_small`', UPDATABLE FALSE,
"teiid_couchbase:ISARRAYTABLE" 'false',
"teiid_couchbase:NAMEDTYPEPAIR" '`type`:''SmallA''');
{code}
{code:sql|title=BQT1 virtual model DDL}
CREATE VIEW SmallA (
IntKey integer PRIMARY KEY,
StringKey string,
IntNum integer,
StringNum string,
FloatNum float,
LongNum long,
DoubleNum double,
ByteNum byte,
DateValue date,
TimeValue time,
TimestampValue timestamp,
BooleanValue boolean,
CharValue char(1),
ShortValue short,
BigIntegerValue biginteger,
BigDecimalValue bigdecimal,
ObjectValue object)
AS
SELECT
IntKey, StringKey, IntNum, StringNum, convert(FloatNum, float) AS FloatNum,
convert(LongNum, long) AS LongNum,
convert(DoubleNum, double) AS DoubleNum, convert(ByteNum, byte) AS ByteNum,
convert(DateValue, date) AS DateValue,
convert(TimeValue, time) AS TimeValue, convert(TimestampValue, timestamp) AS
TimstampValue, BooleanValue,
convert(CharValue, char) AS CharValue, convert(ShortValue, short) AS ShortValue,
convert(BigIntegerValue, biginteger) AS BigIntegerValue,
convert(BigDecimalValue, bigdecimal) AS BigDecimalValue, convert(ObjectValue,
object) AS ObjectValue
FROM
Couchbase_small.SmallA;
{code}
Couchbase error in date/timestamp/time datatype pushdown
--------------------------------------------------------
Key: TEIID-5030
URL:
https://issues.jboss.org/browse/TEIID-5030
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.x-6.4
Reporter: Jan Stastny
Assignee: Steven Hawkins
Priority: Critical
There is an issue with date, time and timestamp datatype pushdown. The following example
is for date. For timestamp the behaviour is the same, only exception message complains
about 'ts' or 't' instead of 'd'.
{code:sql|title=query}
SELECT BQT1.SmallA.DateValue FROM BQT1.SmallA WHERE BQT1.SmallA.DateValue =
'2000-02-02'
{code}
{code:title=teiid-command.log}
09:59:44,422 INFO [org.teiid.COMMAND_LOG] (New I/O worker #2) QE2ZpDa/Btt5 START
USER COMMAND: startTime=2017-08-24 09:59:44.422 requestID=QE2ZpDa/Btt5.31
txID=null sessionID=QE2ZpDa/Btt5 applicationName=JDBC
principal=user@teiid-security vdbName=couchbase vdbVersion=1 sql=SELECT
BQT1.SmallA.DateValue FROM BQT1.SmallA WHERE BQT1.SmallA.DateValue = '2000-02-02'
09:59:44,436 DEBUG [org.teiid.COMMAND_LOG] (Worker9_QueryProcessorQueue68) QE2ZpDa/Btt5
START DATA SRC COMMAND: startTime=2017-08-24 09:59:44.436
requestID=QE2ZpDa/Btt5.31 sourceCommandID=0 executionID=12 txID=null
modelName=Couchbase_small translatorName=couchbase sessionID=QE2ZpDa/Btt5
principal=user@teiid-security sql=SELECT convert(Couchbase_small.SmallA.DateValue, date)
FROM Couchbase_small.SmallA WHERE convert(Couchbase_small.SmallA.DateValue, date) =
{d'2000-02-02'}
09:59:44,436 DEBUG [org.teiid.COMMAND_LOG] (Worker9_QueryProcessorQueue68) QE2ZpDa/Btt5
SOURCE SRC COMMAND: endTime=2017-08-24 09:59:44.436 requestID=QE2ZpDa/Btt5.31
sourceCommandID=0 executionID=12 txID=null modelName=Couchbase_small
translatorName=couchbase sessionID=QE2ZpDa/Btt5 principal=user@teiid-security
sourceCommand=[SELECT TOATOM(`$cb_c1_DateValue`) FROM `dvqe_small` `$cb_t1` LET
`$cb_c1_DateValue` = `$cb_t1`.`DateValue` WHERE TOATOM(`$cb_c1_DateValue`) = {d
'2000-02-02'} AND `$cb_t1`.`type` = 'SmallA']
09:59:44,588 DEBUG [org.teiid.COMMAND_LOG] (Worker9_QueryProcessorQueue68) QE2ZpDa/Btt5
ERROR SRC COMMAND: endTime=2017-08-24 09:59:44.588 requestID=QE2ZpDa/Btt5.31
sourceCommandID=0 executionID=12 txID=null modelName=Couchbase_small
translatorName=couchbase sessionID=QE2ZpDa/Btt5 principal=user@teiid-security
09:59:44,596 DEBUG [org.teiid.COMMAND_LOG] (Worker8_QueryProcessorQueue69) QE2ZpDa/Btt5
END SRC COMMAND: endTime=2017-08-24 09:59:44.596 requestID=QE2ZpDa/Btt5.31
sourceCommandID=0 executionID=12 txID=null modelName=Couchbase_small
translatorName=couchbase sessionID=QE2ZpDa/Btt5 principal=user@teiid-security
finalRowCount=0 cpuTime(ns)=8526015
09:59:44,596 INFO [org.teiid.COMMAND_LOG] (Worker8_QueryProcessorQueue69) QE2ZpDa/Btt5
ERROR USER COMMAND: endTime=2017-08-24 09:59:44.596 requestID=QE2ZpDa/Btt5.31
txID=null sessionID=QE2ZpDa/Btt5 principal=user@teiid-security vdbName=couchbase
vdbVersion=1 finalRowCount=null
09:59:44,598 INFO [org.teiid.COMMAND_LOG] (Worker8_QueryProcessorQueue69) QE2ZpDa/Btt5
END USER COMMAND: endTime=2017-08-24 09:59:44.598 requestID=QE2ZpDa/Btt5.31
txID=null sessionID=QE2ZpDa/Btt5 principal=user@teiid-security vdbName=couchbase
vdbVersion=1 finalRowCount=0
{code}
{code:title=server.log}
09:59:44,588 WARN [org.teiid.CONNECTOR] (Worker9_QueryProcessorQueue68) Connector worker
process failed for atomic-request=QE2ZpDa/Btt5.31.0.12:
org.teiid.translator.TranslatorException: Query did not complete successfully:
[{"msg":"syntax error - at d","code":3000}], error code:
fatal
at
org.teiid.translator.couchbase.CouchbaseQueryExecution.execute(CouchbaseQueryExecution.java:73)
[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.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$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]
Caused by: javax.resource.ResourceException: Query did not complete successfully:
[{"msg":"syntax error - at d","code":3000}], error code:
fatal
at
org.teiid.resource.adapter.couchbase.CouchbaseConnectionImpl.execute(CouchbaseConnectionImpl.java:64)
at
org.teiid.translator.couchbase.CouchbaseQueryExecution.execute(CouchbaseQueryExecution.java:71)
[translator-couchbase-8.12.11.6_4-redhat-64-5.jar:8.12.11.6_4-redhat-64-5]
... 18 more
09:59:44,596 WARN [org.teiid.PROCESSOR] (Worker8_QueryProcessorQueue69) TEIID30020
Processing exception for request QE2ZpDa/Btt5.31 'TEIID30504 couchbase_small: Query
did not complete successfully: [{"msg":"syntax error - at
d","code":3000}], error code: fatal'. Originally
TeiidProcessingException CouchbaseConnectionImpl.java:64. Enable more detailed logging to
see the entire stacktrace.
{code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)