]
RH Bugzilla Integration commented on TEIID-4676:
------------------------------------------------
Debi Rieden <drieden(a)redhat.com> changed the Status of [bug
PrestoDB translator - convert/cast is not properly translated/pushed
--------------------------------------------------------------------
Key: TEIID-4676
URL:
https://issues.jboss.org/browse/TEIID-4676
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.8.6_3
Reporter: Juraj DurĂ¡ni
Assignee: Kylin Soong
Fix For: 9.2
Convert/cast in query \[1\] is not pushed to PrestoDB.
In come cases Teiid acts like it was pushed (reads integer instead of String) and throws
exception \[2\] while reading result from PrestoDB. Source-specific command \[3\].
In other scenario, not-traslated convert causes exception - query \[4\], processing query
\[5\], source-specific command \[6\], exception \[7\].
{code:sql|title=\[1\] Query}
SELECT convert(stringnum, integer) FROM bqt1.smalla
{code}
{code:plain|title=\[2\] Exception}
12:20:10,727 WARN [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue41) TEIID30020
Processing exception for request A7WqBzZhsyYM.6 'TEIID30504 Source: Unexpected
exception while translating results: Value is not a number: java.lang.String'.
Originally TeiidProcessingException PrestoResultSet.java:1727.:
org.teiid.core.TeiidProcessingException: TEIID30504 Source: Unexpected exception while
translating results: Value is not a number: java.lang.String
at
org.teiid.dqp.internal.process.DataTierTupleSource.exceptionOccurred(DataTierTupleSource.java:401)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:161)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:391)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:472)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:348)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
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: org.teiid.translator.TranslatorException: Unexpected exception while
translating results: Value is not a number: java.lang.String
at org.teiid.translator.jdbc.JDBCQueryExecution.next(JDBCQueryExecution.java:351)
at
org.teiid.dqp.internal.datamgr.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:434)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.more(ConnectorWorkItem.java:234)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_92]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[rt.jar: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)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at com.sun.proxy.$Proxy48.more(Unknown Source)
at
org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:309)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
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)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
... 6 more
Caused by: java.sql.SQLException: Value is not a number: java.lang.String
at com.facebook.presto.jdbc.PrestoResultSet.toNumber(PrestoResultSet.java:1727)
at com.facebook.presto.jdbc.PrestoResultSet.getInt(PrestoResultSet.java:212)
at org.jboss.jca.adapters.jdbc.WrappedResultSet.getInt(WrappedResultSet.java:1052)
at
org.teiid.translator.jdbc.JDBCExecutionFactory.retrieveValue(JDBCExecutionFactory.java:997)
at org.teiid.translator.jdbc.JDBCQueryExecution.next(JDBCQueryExecution.java:344)
... 19 more
{code}
{code:sql|title=\[3\] Command}
SELECT g_0.stringnum FROM smalla AS g_0
{code}
{code:sql|title=\[4\] User query}
SELECT BooleanValue, (BooleanValue+1) AS BooleanValuePlus2 FROM BQT1.SmallA
{code}
{code:sql|title=\[5\] Teiid query}
SELECT g_0.BooleanValue, (convert(g_0.BooleanValue, integer) + 1) FROM Source.SmallA AS
g_0
{code}
{code:sql|title=\[6\] Source-specific command}
SELECT g_0.booleanvalue, (g_0.booleanvalue + 1) FROM smalla AS g_0
{code}
{code:plain|title=\[7\] Exception}
12:41:46,974 WARN [org.teiid.CONNECTOR] (Worker15_QueryProcessorQueue70) Connector
worker process failed for atomic-request=A7WqBzZhsyYM.18.0.16:
org.teiid.translator.jdbc.JDBCExecutionException: 1 TEIID11008:TEIID11004 Error executing
statement(s): [SQL: SELECT g_0.booleanvalue, (g_0.booleanvalue + 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_114146_04086_k4ss5): line 1:44:
'+' cannot be applied to boolean, integer
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:44: '+'
cannot be applied to boolean, integer
at
com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.getOperator(ExpressionAnalyzer.java:1138)
at
com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitArithmeticBinary(ExpressionAnalyzer.java:560)
at
com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitArithmeticBinary(ExpressionAnalyzer.java:254)
at
com.facebook.presto.sql.tree.ArithmeticBinaryExpression.accept(ArithmeticBinaryExpression.java:82)
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
{code}