Bug 1320535 - OData - wrong string indexing in string functions indexof and substring
Summary: OData - wrong string indexing in string functions indexof and substring
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Data Virtualization 6
Classification: JBoss
Component: Teiid
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER2
: 6.3.0
Assignee: Van Halbert
QA Contact: Juraj Duráni
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-23 12:41 UTC by Michal Sanitrak
Modified: 2016-08-24 11:45 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-08-24 11:45:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker TEIID-4103 0 Major Closed OData - wrong string indexing in string functions indexof and substring 2016-06-20 13:37:06 UTC

Description Michal Sanitrak 2016-03-23 12:41:05 UTC
By documentation [1] function indexof returns the zero-based character position of the first occurrence of the second parameter value in the first parameter value.
Function substring doens't have explicitly specified indexing, but based on Example 60 [2] is function substring zero-based too.

indexof
Reference service which supports OData V4:
ULR: http://services.odata.org/V4/Northwind/Northwind.svc/Customers/?$filter=indexof(CompanyName,'lfreds') eq 1
Result: Customer with CompanyName equals "Alfreds Futterkiste"

URL: http://localhost:8080/odata4/olingo_basic/Source/SimpleDataTable/?$filter=indexof(stringval,'alue') eq 1
Result: No entities
Expected result: Entity with intkey 1,2,3,4,8,9,10,11,12

substring
Reference service which supports OData V4:
URL: http://services.odata.org/V4/Northwind/Northwind.svc/Customers/?$filter=indexof(CompanyName,'lfreds') eq 1
Result: Customer with CompanyName equals "Alfreds Futterkiste"

ULR: http://localhost:8080/odata4/olingo_basic/Source/SimpleDataTable/?$filter=substring(stringval, 1) eq 'alue_asdf'
Result: No entities
Expected result: Entity with intkey 10

[1] https://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398121
[2] https://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398122

Comment 1 JBoss JIRA Server 2016-03-23 23:07:52 UTC
Ramesh Reddy <rareddy> updated the status of jira TEIID-4103 to Resolved

Comment 4 JBoss JIRA Server 2016-06-20 13:37:06 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-4103 to Closed


Note You need to log in before you can comment on or make changes to this bug.