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

PrestoDB translator - log function not translated correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 9.2
    • 8.12.8.6_3
    • Misc. Connectors
    • None

      Function log(double) is not translated correctly. Teiid translates it to log(double), but presto does not have such function. Available similar functions in PrestoDB are (see doc):

      • ln(x)
      • log2(x)
      • log10(x)
      • log(x, b)
      Query
      SELECT log(doublenum) FROM bqt1.smalla
      
      Source-specific command
      SELECT log(g_0.doublenum) 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
      12:49:18,025 WARN  [org.teiid.CONNECTOR] (Worker17_QueryProcessorQueue73) Connector worker process failed for atomic-request=A7WqBzZhsyYM.19.0.17: org.teiid.translator.jdbc.JDBCExecutionException: 1 TEIID11008:TEIID11004 Error executing statement(s): [SQL: SELECT log(g_0.doublenum) 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_114917_04087_k4ss5): line 1:8: Unexpected parameters (double) for function log. Expected: log(double, double) 
      	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:8: Unexpected parameters (double) for function log. Expected: log(double, double) 
      	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
      

              kylinsoong.1214@gmail.com Kylin Soong (Inactive)
              jdurani Juraj DurĂ¡ni (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: