Jan Stastny created TEIID-5034:
----------------------------------
Summary: Couchbase SUBSTRING function returns null when reaches end of
string
Key: TEIID-5034
URL:
https://issues.jboss.org/browse/TEIID-5034
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.x-6.4
Reporter: Jan Stastny
Assignee: Steven Hawkins
Couchbase return null when y points after the string end in SUBSTRING(VALUE, x, y).
That's not what is expected from Teiid.
Teiid:
{code:sql|title=query1}
SELECT SUBSTRING('49',1, 10)
{code}
|| expr1 ||
|| 49 ||
Couchbase pushdown:
{code:sql|title=query2}
SELECT SUBSTRING(BQT1.SmallA.intkey, 1, 10) FROM BQT1.SmallA WHERE IntKey=49
{code}
|| expr1 ||
|| <null> ||
{code:title=teiid-command.log}
16:18:57,156 INFO [org.teiid.COMMAND_LOG] (New I/O worker #2) QE2ZpDa/Btt5 START USER
COMMAND: startTime=2017-08-24 16:18:57.156 requestID=QE2ZpDa/Btt5.124 txID=null
sessionID=QE2ZpDa/Btt5 applicationName=JDBC principal=user@teiid-security
vdbName=couchbase vdbVersion=1 sql=SELECT SUBSTRING(BQT1.SmallA.intkey, 1, 10)
FROM BQT1.SmallA WHERE IntKey=49
16:18:57,160 DEBUG [org.teiid.COMMAND_LOG] (Worker39_QueryProcessorQueue353) QE2ZpDa/Btt5
START DATA SRC COMMAND: startTime=2017-08-24 16:18:57.16
requestID=QE2ZpDa/Btt5.124 sourceCommandID=0 executionID=85 txID=null
modelName=Couchbase_small translatorName=couchbase sessionID=QE2ZpDa/Btt5
principal=user@teiid-security sql=SELECT SUBSTRING(convert(Couchbase_small.SmallA.IntKey,
string), 1, 10) FROM Couchbase_small.SmallA WHERE Couchbase_small.SmallA.IntKey = 49
16:18:57,160 DEBUG [org.teiid.COMMAND_LOG] (Worker39_QueryProcessorQueue353) QE2ZpDa/Btt5
SOURCE SRC COMMAND: endTime=2017-08-24 16:18:57.16
requestID=QE2ZpDa/Btt5.124 sourceCommandID=0 executionID=85 txID=null
modelName=Couchbase_small translatorName=couchbase sessionID=QE2ZpDa/Btt5
principal=user@teiid-security sourceCommand=[SELECT SUBSTR(TOSTRING(`$cb_c1_IntKey`), 1,
10) FROM `dvqe_small` `$cb_t1` LET `$cb_c1_IntKey` = `$cb_t1`.`IntKey` WHERE
`$cb_c1_IntKey` = 49 AND `$cb_t1`.`type` = 'SmallA']
16:18:57,449 DEBUG [org.teiid.COMMAND_LOG] (Worker38_QueryProcessorQueue354) QE2ZpDa/Btt5
END SRC COMMAND: endTime=2017-08-24 16:18:57.449
requestID=QE2ZpDa/Btt5.124 sourceCommandID=0 executionID=85 txID=null
modelName=Couchbase_small translatorName=couchbase sessionID=QE2ZpDa/Btt5
principal=user@teiid-security finalRowCount=1 cpuTime(ns)=1213042
16:18:57,456 INFO [org.teiid.COMMAND_LOG] (Worker38_QueryProcessorQueue355) QE2ZpDa/Btt5
END USER COMMAND: endTime=2017-08-24 16:18:57.456
requestID=QE2ZpDa/Btt5.124 txID=null sessionID=QE2ZpDa/Btt5
principal=user@teiid-security vdbName=couchbase vdbVersion=1 finalRowCount=1
{code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)