Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-6071

Exception when using Odata functions in filter query

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

      I created an virtual function in the VDB:

      CREATE VIRTUAL FUNCTION getTrue()
          RETURNS boolean OPTIONS (UPDATECOUNT 0) AS
          BEGIN
              DECLARE boolean result;
              result = true;
              RETURN result;
          END;
      

       

      1. Calling the function directly returns the "true" boolean value: http://localhost:8080/odata/wa/getTrue()
      2. Calling a query URL for some example data with $filter and "true" value works: http://localhost:8080/odata/wa/example_entity?$format=json&$filter=true
      3. Calling the function within the filter-query leads to an exception:  http://localhost:8080/odata/wa/example_entity?$format=json&$filter=wa.getTrue()

       

      Exception: 

      java.util.EmptyStackException: nulljava.util.EmptyStackException: null at java.base/java.util.Stack.peek(Stack.java:102) ~[na:na] at java.base/java.util.Stack.pop(Stack.java:84) ~[na:na] at org.teiid.olingo.service.ODataExpressionToSQLVisitor.getExpression(ODataExpressionToSQLVisitor.java:102) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.teiid.olingo.service.ODataSQLBuilder.visit(ODataSQLBuilder.java:523) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.apache.olingo.server.core.RequestURLHierarchyVisitor.visit(RequestURLHierarchyVisitor.java:235) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.RequestURLHierarchyVisitor.visit(RequestURLHierarchyVisitor.java:93) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.teiid.olingo.service.TeiidServiceHandler.read(TeiidServiceHandler.java:163) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.apache.olingo.server.core.requests.DataRequest$EntityRequest.execute(DataRequest.java:335) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.requests.DataRequest.execute(DataRequest.java:247) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.ServiceDispatcher.internalExecute(ServiceDispatcher.java:166) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.ServiceDispatcher.execute(ServiceDispatcher.java:97) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.OData4HttpHandler.process(OData4HttpHandler.java:67) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.teiid.olingo.web.ODataServlet.service(ODataServlet.java:39) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.teiid.spring.odata.ODataController.process(ODataController.java:46) ~[spring-odata-1.6.0.jar:1.6.0] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:497) ~[jakarta.servlet-api-4.0.4.jar:4.0.4] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
      
      Show
      I created an virtual function in the VDB: CREATE VIRTUAL FUNCTION getTrue() RETURNS boolean OPTIONS (UPDATECOUNT 0) AS BEGIN DECLARE boolean result; result = true ; RETURN result; END;   Calling the function directly returns the "true" boolean value:  http://localhost:8080/odata/wa/getTrue() Calling a query URL for some example data with $filter and "true" value works:  http://localhost:8080/odata/wa/example_entity?$format=json&$filter=true Calling the function within the filter-query leads to an exception:   http://localhost:8080/odata/wa/example_entity?$format=json&$filter=wa.getTrue()   Exception:  java.util.EmptyStackException: nulljava.util.EmptyStackException: null at java.base/java.util.Stack.peek(Stack.java:102) ~[na:na] at java.base/java.util.Stack.pop(Stack.java:84) ~[na:na] at org.teiid.olingo.service.ODataExpressionToSQLVisitor.getExpression(ODataExpressionToSQLVisitor.java:102) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.teiid.olingo.service.ODataSQLBuilder.visit(ODataSQLBuilder.java:523) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.apache.olingo.server.core.RequestURLHierarchyVisitor.visit(RequestURLHierarchyVisitor.java:235) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.RequestURLHierarchyVisitor.visit(RequestURLHierarchyVisitor.java:93) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.teiid.olingo.service.TeiidServiceHandler.read(TeiidServiceHandler.java:163) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.apache.olingo.server.core.requests.DataRequest$EntityRequest.execute(DataRequest.java:335) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.requests.DataRequest.execute(DataRequest.java:247) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.ServiceDispatcher.internalExecute(ServiceDispatcher.java:166) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.ServiceDispatcher.execute(ServiceDispatcher.java:97) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.apache.olingo.server.core.OData4HttpHandler.process(OData4HttpHandler.java:67) ~[odata-server-core-ext-4.7.1.jar:4.7.1] at org.teiid.olingo.web.ODataServlet.service(ODataServlet.java:39) ~[teiid-olingo-15.0.0.jar:15.0.0] at org.teiid.spring.odata.ODataController.process(ODataController.java:46) ~[spring-odata-1.6.0.jar:1.6.0] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:497) ~[jakarta.servlet-api-4.0.4.jar:4.0.4] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    • [QE] How to address?:
      ---
    • [QE] Why QE missed?:
      ---

      Description

      I am trying to call a self defined function within a OData filter query. Based on the OData specification I would assume, that it schould work but I always get an exception. See the steps to reproduce below.

      Basically I am using teiid spring boot (1.6.0) but I think this is a problem of teiid itself. So I didn't create the issue in the sub project.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            treiboll Fabian Knoll
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: