Bug 1259736 (TEIID-3671)

Summary: Odata filter on child table not working correctly
Product: [JBoss] JBoss Data Virtualization 6 Reporter: dsteigne
Component: TeiidAssignee: jolee
Status: CLOSED CURRENTRELEASE QA Contact: Filip Elias <felias>
Severity: high Docs Contact:
Priority: high    
Version: 6.1.0CC: aszczucz, atangrin, dlesage, jdurani, vhalbert
Target Milestone: ---Keywords: QA-Closed
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Odata filters do not work correctly on child tables, hence filter results may sometimes be inaccurate.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-10 08:50:21 UTC Type: Support Patch
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1241696    
Attachments:
Description Flags
dynamic vdb w/details in comment
none
used for local testing none

Description dsteigne 2015-09-03 13:01:55 UTC
Describe the issue: 
See https://issues.jboss.org/browse/TEIID-3671

the url - //localhost:8080/odata/testVDB/sales('13')/sales_uk?$format=json, i get the results from sales_uk table which are having id=13.

Now i am trying to apply a filter on this url, i am supposed to get results which are having id=13 and satisfy the filter condition, but this url blindly returns me data from sales_uk table which satisfy the filter condition. URL- //localhost:8080/odata/testVDB/sales('13')/sales_uk?$format=json&$filter=DISCOUNT eq '22'



Suggestions for improvement: 

Additional information:

Comment 2 jolee 2015-09-16 15:43:13 UTC
git:jboss-integration/teiid.git : 8.7.x-prod-ipv6.1 : 62b86a878

git:teiid/teiid.git : 8.7.x : 62b86a878

Comment 3 dsteigne 2015-10-14 15:28:24 UTC
The fix for this broke the existing work flow of Parent-child tables relationship. 
I was getting Nullpointer exception for the base urls , 'filter for child table not working' is not solved.
11:36:18,353 WARN  [org.teiid.ODATA] (http-/0.0.0.0:8080-1) TEIID16012 Could not produce a successful OData response.  Returning status ServerErrorException with message Internal Server Error.: org.odata4j.exceptions.ServerErrorException
	at org.teiid.odata.LocalClient.executeSQL(LocalClient.java:333) [classes:]
	at org.teiid.odata.TeiidProducer.getNavProperty(TeiidProducer.java:89) [classes:]
	at org.teiid.odata.TeiidProducer.getNavProperty(TeiidProducer.java:55) [classes:]
	at org.odata4j.producer.resources.PropertyRequestResource.getNavProperty(PropertyRequestResource.java:194) [odata-core-0.8.7.redhat-61-1.jar:0.8.7.redhat-61-1]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_75]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_75]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_75]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_75]
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at org.teiid.odata.ODataServletContainerDispatcher.service(ODataServletContainerDispatcher.java:118) [classes:]
	at org.teiid.odata.ODataServlet.service(ODataServlet.java:65) [classes:]
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.8.SP4-redhat-2.jar:]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
Caused by: java.lang.NullPointerException
	at org.teiid.odata.EntityList.getEntity(EntityList.java:62) [classes:]
	at org.teiid.odata.EntityList.addEntity(EntityList.java:54) [classes:]
	at org.teiid.odata.LocalClient.executeSQL(LocalClient.java:302) [classes:]
	... 33 more

Comment 4 JBoss JIRA Server 2015-10-20 08:52:34 UTC
Juraj Duráni <jdurani> updated the status of jira TEIID-3671 to Reopened

Comment 7 jolee 2015-10-23 13:17:49 UTC
Created attachment 1085846 [details]
dynamic vdb w/details in comment

I seem to be getting a close variation of the results that Jurag and Debbie have seen,  I will use it to vet proposed changes unless someone points out a discrepancy that should be addressed.

Comment 9 jolee 2015-10-23 19:58:29 UTC
git:jboss-integration/teiid.git : 8.7.x-prod-ipv6.1 : 184a1f2

git:teiid/teiid.git : 8.7.x : 184a1f2

Comment 10 jolee 2015-10-23 20:19:25 UTC
Created attachment 1085929 [details]
used for local testing

just updating as last file had issues which were troublesome to track down (TEIID-3787)

Comment 11 Juraj Duráni 2015-10-30 06:29:53 UTC
Both, old and new, issues has been verified in the rebuild. Setting to VERIFIED.

Comment 12 JBoss JIRA Server 2015-10-30 13:59:31 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3671 to Resolved

Comment 13 JBoss JIRA Server 2015-10-30 13:59:38 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3671 to Closed