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

PrestoDB translator - error executing locate(string, string, int)

    Details

      Description

      Teiid translates function locate(string, string, int) directly to strpos(string, string, integer), but there is no such function in PrestoDB (see doc).

      Query
      SELECT StringNum, LOCATE('1', StringNum, 1) FROM BQT1.SmallA
      
      Source command
      SELECT g_0.stringnum, strpos('1', g_0.stringnum, 1) FROM smalla AS g_0
      
      Exception
      Unable to find source-code formatter for language: plain. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      14:07:37,469 WARN  [org.teiid.CONNECTOR] (Worker21_QueryProcessorQueue88) Connector worker process failed for atomic-request=A7WqBzZhsyYM.23.0.21: org.teiid.translator.jdbc.JDBCExecutionException: 1 TEIID11008:TEIID11004 Error executing statement(s): [SQL: SELECT g_0.stringnum, strpos('1', g_0.stringnum, 1) FROM smalla AS g_0]
      	at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:131) [translator-jdbc-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      	at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:364)
      	at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source) [:1.8.0_92]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_92]
      	at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_92]
      	at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)
      	at com.sun.proxy.$Proxy48.execute(Unknown Source)
      	at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)
      	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) [rt.jar:1.8.0_92]
      	at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)
      	at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)
      	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) [rt.jar:1.8.0_92]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_92]
      	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_92]
      Caused by: java.sql.SQLException: Query failed (#20170106_130737_04105_k4ss5): line 1:23: Unexpected parameters (varchar(1), varchar(10), integer) for function strpos. Expected: strpos(varchar, varchar) 
      	at com.facebook.presto.jdbc.PrestoResultSet.resultsException(PrestoResultSet.java:1799)
      	at com.facebook.presto.jdbc.PrestoResultSet.getColumns(PrestoResultSet.java:1747)
      	at com.facebook.presto.jdbc.PrestoResultSet.<init>(PrestoResultSet.java:125)
      	at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:212)
      	at com.facebook.presto.jdbc.PrestoStatement.executeQuery(PrestoStatement.java:69)
      	at org.jboss.jca.adapters.jdbc.WrappedStatement.executeQuery(WrappedStatement.java:344)
      	at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:119) [translator-jdbc-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      	... 17 more
      Caused by: com.facebook.presto.sql.analyzer.SemanticException: line 1:23: Unexpected parameters (varchar(1), varchar(10), integer) for function strpos. Expected: strpos(varchar, varchar) 
      	at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitFunctionCall(ExpressionAnalyzer.java:823)
      	at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitFunctionCall(ExpressionAnalyzer.java:254)
      	at com.facebook.presto.sql.tree.FunctionCall.accept(FunctionCall.java:109)
      	at com.facebook.presto.sql.tree.StackableAstVisitor.process(StackableAstVisitor.java:26)
      	at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.process(ExpressionAnalyzer.java:273)
      	at com.facebook.presto.sql.analyzer.ExpressionAnalyzer.analyze(ExpressionAnalyzer.java:230)
      	at com.facebook.presto.sql.analyzer.ExpressionAnalyzer.analyzeExpression(ExpressionAnalyzer.java:1416)
      	at com.facebook.presto.sql.analyzer.StatementAnalyzer.analyzeExpression(StatementAnalyzer.java:1791)
      	at com.facebook.presto.sql.analyzer.StatementAnalyzer.analyzeSelect(StatementAnalyzer.java:1613)
      	at com.facebook.presto.sql.analyzer.StatementAnalyzer.visitQuerySpecification(StatementAnalyzer.java:785)
      	at com.facebook.presto.sql.analyzer.StatementAnalyzer.visitQuerySpecification(StatementAnalyzer.java:187)
      	at com.facebook.presto.sql.tree.QuerySpecification.accept(QuerySpecification.java:125)
      	at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:27)
      	at com.facebook.presto.sql.analyzer.StatementAnalyzer.visitQuery(StatementAnalyzer.java:549)
      	at com.facebook.presto.sql.analyzer.StatementAnalyzer.visitQuery(StatementAnalyzer.java:187)
      	at com.facebook.presto.sql.tree.Query.accept(Query.java:92)
      	at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:27)
      	at com.facebook.presto.sql.analyzer.Analyzer.analyze(Analyzer.java:67)
      	at com.facebook.presto.sql.analyzer.Analyzer.analyze(Analyzer.java:59)
      	at com.facebook.presto.execution.SqlQueryExecution.doAnalyzeQuery(SqlQueryExecution.java:285)
      	at com.facebook.presto.execution.SqlQueryExecution.analyzeQuery(SqlQueryExecution.java:271)
      	at com.facebook.presto.execution.SqlQueryExecution.start(SqlQueryExecution.java:229)
      	at com.facebook.presto.execution.QueuedExecution.lambda$start$1(QueuedExecution.java:62)
      	... 3 more
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shawkins Steven Hawkins
                Reporter:
                jdurani Juraj DurĂ¡ni
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: