连接到hana的Nifi executionql在创建avro架构

时间:2017-04-21 08:53:13

标签: apache-nifi

查看代码,在需要为avro架构转换的未定义数据类型上抛出错误。但是我选择的唯一一列是NVARCHAR(5000)类型,它在代码中。

2017-04-21 01:33:51,446 WARN [计时器驱动的进程线程-1] o.a.n.c.t.ContinuallyRunProcessorTask java.lang.IllegalArgumentException:createSchema:未知的SQL类型2011无法转换为Avro类型     在org.apache.nifi.processors.standard.util.JdbcCommon.createSchema(JdbcCommon.java:349)〜[na:na]     在org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:92)〜[na:na]     在org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:87)〜[na:na]     at org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:77)〜[na:na]     在org.apache.nifi.processors.standard.ExecuteSQL $ 2.process(ExecuteSQL.java:205)〜[na:na]     在org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2329)〜[nifi-framework-core-1.1.2.jar:1.1.2]     at org.apache.nifi.processors.standard.ExecuteSQL.onTrigger(ExecuteSQL.java:199)〜[na:na]     在org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)〜[nifi-api-1.1.2.jar:1.1.2]     at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1099)~ [nifi-framework-core-1.1.2.jar:1.1.2]     在org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136)[nifi-framework-core-1.1.2.jar:1.1.2]     在org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)[nifi-framework-core-1.1.2.jar:1.1.2]     在org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent $ 1.run(TimerDrivenSchedulingAgent.java:132)[nifi-framework-core-1.1.2.jar:1.1.2]     在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)[na:1.8.0_102]     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[na:1.8.0_102]     at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 301(ScheduledThreadPoolExecutor.java:180)[na:1.8.0_102]     at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[na:1.8.0_102]     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_102]     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_102]     在java.lang.Thread.run(Thread.java:745)[na:1.8.0_102]

1 个答案:

答案 0 :(得分:1)

在JDK8的JDBC API中,NCLOB是2011,NVARCHAR是-9:

public static final int NCLOB = 2011;
public static final int NVARCHAR = -9;

即使您认为该列是NVARCHAR,看起来您正在使用的驱动程序也会返回2011年的列。我不完全确定,但这似乎是来自hana司机的错误行为。

通过在JdbcCommon中为这个case语句添加NCLOB,可以在NiFi方面处理它:

 case CHAR:
 case LONGNVARCHAR:
 case LONGVARCHAR:
 case NCHAR:
 case NVARCHAR:
 case VARCHAR:
 case CLOB: