Apache NiFi "ExecuteSQL" 在 Oracle 数据库中使用 Join 查询不起作用

Apache NiFi "ExecuteSQL" Querying with Join in Oracle Database does not work

我尝试使用一个非常简单的 SQL 查询来检索 Oracle 数据库中两个表的连接内容:

SELECT OWNER.CONTENT.ID, OWNER.CONTENT.TITLE, OWNER.BODYCONTENT.BODY
FROM OWNER.CONTENT, OWNER.BODYCONTENT
WHERE OWNER.CONTENT.ID = OWNER.BODYCONTENT.ID 
AND OWNER.CONTENT.ID < 7

查询使用 Oracle SQL Developer 运行。

我在 NiFi 中使用 ojdbc7.jar 驱动程序。不包含连接的更简单的 SQL 查询与 "ExecuteSQL" 一起工作,例如。 G。

SELECT OWNER.CONTENT.ID, OWNER.CONTENT.TITLE
FROM OWNER.CONTENT
WHERE OWNER.CONTENT.ID < 7

我还尝试了其他 SQL 语句(例如 INNER JOIN)。这些查询使用 Oracle SQL Developer 按预期工作,但在 NiFi 中没有。有人可以帮助我吗?

NiFi 中的错误消息:

2016-05-03 11:30:02,413 ERROR [Timer-Driven Process Thread-6] o.a.nifi.processors.standard.ExecuteSQL org.apache.nifi.processor.exception.ProcessException: java.sql.SQLFeatureNotSupportedException: Unsupported feature at org.apache.nifi.processors.standard.ExecuteSQL.process(ExecuteSQL.java:160) ~[nifi-standard-processors-0.6.1.jar:0.6.1] at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:1954) ~[na:na] at org.apache.nifi.processors.standard.ExecuteSQL.onTrigger(ExecuteSQL.java:152) ~[nifi-standard-processors-0.6.1.jar:0.6.1] at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) [nifi-api-0.6.1.jar:0.6.1] at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1059) [nifi-framework-core-0.6.1.jar:0.6.1] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-0.6.1.jar:0.6.1] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-0.6.1.jar:0.6.1] at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent.run(TimerDrivenSchedulingAgent.java:123) [nifi-framework-core-0.6.1.jar:0.6.1] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_60] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_60] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_60] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_60] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60] Caused by: java.sql.SQLFeatureNotSupportedException: Unsupported feature at oracle.jdbc.driver.ClobAccessor.getBytes(ClobAccessor.java:534) ~[na:na] at oracle.jdbc.driver.GeneratedStatement.getBytes(GeneratedStatement.java:151) ~[na:na] at oracle.jdbc.driver.GeneratedScrollableResultSet.getBytes(GeneratedScrollableResultSet.java:326) ~[na:na] at org.apache.commons.dbcp.DelegatingResultSet.getBytes(DelegatingResultSet.java:241) ~[na:na] at org.apache.commons.dbcp.DelegatingResultSet.getBytes(DelegatingResultSet.java:241) ~[na:na] at org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:105) ~[nifi-standard-processors-0.6.1.jar:0.6.1] at org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:72) ~[nifi-standard-processors-0.6.1.jar:0.6.1] at org.apache.nifi.processors.standard.ExecuteSQL.process(ExecuteSQL.java:158) ~[nifi-standard-processors-0.6.1.jar:0.6.1] ... 14 common frames omitted

看起来您的 return 列之一是 BINARY、VARBINARY、LONGVARBINARY、ARRAY、BLOB 或 CLOB,当 NiFi 获取此列的值时,它会调用 ResultSet getBytes(i) 并在最终调用抛出不受支持异常的方法的 Oracle 驱动程序。

我创建了这个 JIRA: https://issues.apache.org/jira/browse/NIFI-1841

不完全确定解决方案是什么,因为我们必须依赖 JDBC 接口,如果特定的数据库驱动程序不支持我们所依赖的东西,那么我们只能做这么多。