[teiid-issues] [JBoss JIRA] (TEIID-5277) OData4 translator doesn't correctly translate LOCATE function to INDEXOF
Steven Hawkins (JIRA)
issues at jboss.org
Mon Mar 12 14:54:00 EDT 2018
[ https://issues.jboss.org/browse/TEIID-5277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steven Hawkins resolved TEIID-5277.
-----------------------------------
Fix Version/s: 10.0.4
10.2
10.1.2
Resolution: Done
Added a function modifier to reverse the arguments and increment the index.
> OData4 translator doesn't correctly translate LOCATE function to INDEXOF
> ------------------------------------------------------------------------
>
> Key: TEIID-5277
> URL: https://issues.jboss.org/browse/TEIID-5277
> Project: Teiid
> Issue Type: Bug
> Components: OData
> Affects Versions: 8.12.11.6_4
> Reporter: Jan Martiska
> Assignee: Steven Hawkins
> Fix For: 10.0.4, 10.2, 10.1.2
>
>
> Suppose this query against an OData4-backed view:
> {noformat}
> SELECT STRINGKEY FROM BQT1.SmallA WHERE LOCATE('1', stringkey) = 1
> {noformat}
> The WHERE clause gets translated into
> {noformat}
> filter=indexof('1',stringkey) eq 1
> {noformat}
> There are two issues with this:
> - the arguments of the {{indexof}} function should be in the opposite order (the sought-after string goes second)
> - {{indexof}} function indexes characters in strings from 0 whereas {{LOCATE}} from 1, this needs to be taken into account
> The correct filter in this case should be:
> {noformat}
> filter=indexof(stringkey,'1') eq 0
> {noformat}
> See http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part2-url-conventions.html#startswithurl5.1.2.4.3
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the teiid-issues
mailing list