0

我试图通过链接 VDB.xml 来委派翻译器,但在拨打电话后出现错误。委托翻译器假设拦截对底层实际委托翻译器的调用并执行计算。计算由 TEIID_SESSION 中设置的属性驱动,该属性作为有效负载与语句对象一起传递

我的 vdb.xml:

<source connection-jndi-name="java:/SourceModel" name="SourceModel" translator-name="delegate"/>

<translator name="delegate" type="calcDelegate"> 
        <property name="delegateName" value="sqlserver" />
</translator> 

当我在 teiid_session 中设置属性并在 SQL 客户端中运行查询时,我收到以下错误:

org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [38000]: org.teiid.language.Join cannot be cast to org.teiid.language.NamedTable
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:134)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:488)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$0(SQLQueryJob.java:425)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:170)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:417)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:775)
    at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:2914)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:111)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:170)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:109)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$17.run(ResultSetViewer.java:3423)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:103)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.teiid.jdbc.TeiidSQLException: org.teiid.language.Join cannot be cast to org.teiid.language.NamedTable
    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:723)
    at org.teiid.jdbc.StatementImpl.access$100(StatementImpl.java:65)
    at org.teiid.jdbc.StatementImpl$2.onCompletion(StatementImpl.java:561)
    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:284)
    at org.teiid.net.socket.SocketServerInstanceImpl.read(SocketServerInstanceImpl.java:322)
    at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.teiid.net.socket.SocketServerConnectionFactory$ShutdownHandler.invoke(SocketServerConnectionFactory.java:98)
    at com.sun.proxy.$Proxy22.read(Unknown Source)
    at org.teiid.net.socket.SocketServerInstanceImpl$RemoteInvocationHandler$1.get(SocketServerInstanceImpl.java:421)
    at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:570)
    at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:1076)
    at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:339)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:338)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:131)
    ... 12 more
Caused by: org.teiid.core.TeiidException: org.teiid.language.Join cannot be cast to org.teiid.language.NamedTable
    at org.teiid.client.ResultsMessage.setException(ResultsMessage.java:196)
    at org.teiid.dqp.internal.process.RequestWorkItem.sendError(RequestWorkItem.java:1115)
    at org.teiid.dqp.internal.process.RequestWorkItem.close(RequestWorkItem.java:591)
    at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:374)
    at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
    at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:275)
    at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:282)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: org.teiid.language.Join cannot be cast to org.teiid.language.NamedTable
    at com.lgc.dsl.translators.unitConvert.delegate.UnitConvertResultSetExecution.execute(UnitConvertResultSetExecution.java:126)
    at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:367)
    at sun.reflect.GeneratedMethodAccessor740.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:220)
    at com.sun.proxy.$Proxy193.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)
    at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)
4

1 回答 1

0

根据

    Caused by: java.lang.ClassCastException: org.teiid.language.Join cannot be cast to org.teiid.language.NamedTable
        at com.lgc.dsl.translators.unitConvert.delegate.UnitConvertResultSetExecution.execute(UnitConvertResultSetExecution.java:126)

看来问题出在自定义翻译器的逻辑假设上。你调试过UnitConvertResultSetExecution中引用的方法和行号吗?

于 2020-04-09T15:55:28.473 回答