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

Wrong pushdown of several spatial functions to Oracle

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 8.12.x
    • Fix Version/s: 9.1.2, 9.2, 8.12.10.6_3
    • Component/s: None
    • Labels:
      None

      Description

      There are several geospatial functions that are wrongly pushed down to oracle

      1. ST_DISTANCE is pushed as SDO_GEOM.DISTANCE which does not exist, should be SDO_GEOM.SDO_DISTANCE. This results in runtime error.
      2. ST_CROSSES and ST_OVERLAPS are both pushed as SDO_RELATE with mask "overlapbydisjoint" which does not exists, should be "overlapbdydisjoint" (sic} for ST_CROSSES and "overlapbdyintersect" for ST_OVERLAPS. This results in false being returned for all calls to the two functions
      3. Using ST_DISJOINT in the select clause (but not in criteria) results in the following error when evaluating to true:

        org.teiid.jdbc.TeiidSQLException: TEIID30504 Remote org.teiid.core.TeiidProcessingException: TEIID30504 SpatialModel: 99999 Unexpected exception while translating results: Fail to convert to internal representation
        	at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:135)
        	at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:71)
        	at org.teiid.jdbc.StatementImpl.postReceiveResults(StatementImpl.java:706)
        	at org.teiid.jdbc.StatementImpl.access$100(StatementImpl.java:64)
        	at org.teiid.jdbc.StatementImpl$2.onCompletion(StatementImpl.java:545)
        	at org.teiid.client.util.ResultsFuture.done(ResultsFuture.java:135)
        	at org.teiid.client.util.ResultsFuture.access$200(ResultsFuture.java:40)
        	at org.teiid.client.util.ResultsFuture$1.receiveResults(ResultsFuture.java:79)
        	at org.teiid.net.socket.SocketServerInstanceImpl.receivedMessage(SocketServerInstanceImpl.java:268)
        	at org.teiid.net.socket.SocketServerInstanceImpl.read(SocketServerInstanceImpl.java:306)
        	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.teiid.net.socket.SocketServerConnectionFactory$ShutdownHandler.invoke(SocketServerConnectionFactory.java:98)
        	at com.sun.proxy.$Proxy18.read(Unknown Source)
        	at org.teiid.net.socket.SocketServerInstanceImpl$RemoteInvocationHandler$1.get(SocketServerInstanceImpl.java:405)
        	at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:554)
        	at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:1060)
        	at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:323)
        	at org.jboss.bqt.framework.AbstractQuery.execute(AbstractQuery.java:208)
        	at org.jboss.bqt.client.testcase.ProcessResults.executeTest(ProcessResults.java:280)
        	at org.jboss.bqt.client.testcase.ProcessResults.runTestCase(ProcessResults.java:166)
        	at org.jboss.bqt.client.TestClient.runScenario(TestClient.java:209)
        	at org.jboss.bqt.client.TestClient.runTest(TestClient.java:132)
        	at org.jboss.bqt.client.TestClient.runTest(TestClient.java:113)
        	at org.jboss.qe.bqt.BQTHelper.startTest(BQTHelper.java:59)
        	at org.jboss.dv.test.bqt.Utils.runScenarioTest(Utils.java:185)
        	at org.jboss.dv.test.bqt.TestPassRDBMS.testRdbms(TestPassRDBMS.java:210)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
        	at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:197)
        	at org.jboss.qe.DVQETestListener.run(DVQETestListener.java:266)
        	at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:209)
        	at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
        	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
        	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
        	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
        	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
        	at org.testng.TestRunner.privateRun(TestRunner.java:782)
        	at org.testng.TestRunner.run(TestRunner.java:632)
        	at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
        	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
        	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
        	at org.testng.SuiteRunner.run(SuiteRunner.java:268)
        	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
        	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
        	at org.testng.TestNG.run(TestNG.java:1064)
        	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:70)
        	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)
        	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
        	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
        	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
        	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
        	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
        Caused by: org.teiid.core.TeiidProcessingException: TEIID30504 Remote org.teiid.core.TeiidProcessingException: TEIID30504 SpatialModel: 99999 Unexpected exception while translating results: Fail to convert to internal representation
        	at org.teiid.dqp.internal.process.DataTierTupleSource.exceptionOccurred(DataTierTupleSource.java:401)
        	at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:161)
        	at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:391)
        	at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
        	at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)
        	at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)
        	at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)
        	at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)
        	at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)
        	at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:472)
        	at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:348)
        	at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
        	at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)
        	at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:280)
        	at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
        	at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
        	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        	at java.lang.Thread.run(Thread.java:745)
        Caused by: org.teiid.core.TeiidException: 99999 Remote org.teiid.translator.TranslatorException: 99999 Unexpected exception while translating results: Fail to convert to internal representation
        	at org.teiid.translator.jdbc.JDBCQueryExecution.next(JDBCQueryExecution.java:351)
        	at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:436)
        	at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.more(ConnectorWorkItem.java:236)
        	at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)
        	at com.sun.proxy.$Proxy47.more(Unknown Source)
        	at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:309)
        	at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)
        	at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)
        	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        	at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)
        	... 6 more
        Caused by: java.sql.SQLException: Remote java.sql.SQLException: Fail to convert to internal representation
        	at oracle.jdbc.driver.CharCommonAccessor.getBoolean(CharCommonAccessor.java:183)
        	at oracle.jdbc.driver.GeneratedStatement.getBoolean(GeneratedStatement.java:129)
        	at oracle.jdbc.driver.GeneratedScrollableResultSet.getBoolean(GeneratedScrollableResultSet.java:232)
        	at org.jboss.jca.adapters.jdbc.WrappedResultSet.getBoolean(WrappedResultSet.java:594)
        	at org.teiid.translator.jdbc.JDBCExecutionFactory.retrieveValue(JDBCExecutionFactory.java:1068)
        	at org.teiid.translator.jdbc.JDBCQueryExecution.next(JDBCQueryExecution.java:344)
        	... 18 more
        

        This is because it is pushed down as SDO_GEOM.RELATE with mask "disjoint", which in oracle returns the string 'DISJOINT' instead of the more expected 'TRUE'.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shawkins Steven Hawkins
                Reporter:
                asmigala Andrej Šmigala
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: