Matt Burgess created NIFI-6062:
----------------------------------

             Summary: ExecuteSQLRecord does not write BLOB/CLOB data properly
                 Key: NIFI-6062
                 URL: https://issues.apache.org/jira/browse/NIFI-6062
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
            Reporter: Matt Burgess


When using ExecuteSQLRecord (at least with an AvroRecordSetWriter) to return 
columns that contain BLOB/CLOB data, the following error is reported:

org.apache.nifi.processor.exception.ProcessException: java.io.IOException: 
org.apache.nifi.serialization.record.util.IllegalTypeConversionException: 
Cannot convert value oracle.sql.BLOB@79c3c046 of type class oracle.sql.BLOB 
because no compatible types exist in the UNION for field IMAGE
        at 
org.apache.nifi.processors.standard.AbstractExecuteSQL.lambda$onTrigger$1(AbstractExecuteSQL.java:273)
        at 
org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2663)
        at 
org.apache.nifi.processors.standard.AbstractExecuteSQL.onTrigger(AbstractExecuteSQL.java:269)
        at 
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
        at 
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1162)
        at 
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:205)
        at 
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        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.io.IOException: 
org.apache.nifi.serialization.record.util.IllegalTypeConversionException: 
Cannot convert value oracle.sql.BLOB@79c3c046 of type class oracle.sql.BLOB 
because no compatible types exist in the UNION for field IMAGE
        at 
org.apache.nifi.processors.standard.sql.RecordSqlWriter.writeResultSet(RecordSqlWriter.java:85)
        at 
org.apache.nifi.processors.standard.AbstractExecuteSQL.lambda$onTrigger$1(AbstractExecuteSQL.java:271)
        ... 13 common frames omitted
Caused by: 
org.apache.nifi.serialization.record.util.IllegalTypeConversionException: 
Cannot convert value oracle.sql.BLOB@79c3c046 of type class oracle.sql.BLOB 
because no compatible types exist in the UNION for field IMAGE
        at 
org.apache.nifi.avro.AvroTypeUtil.convertUnionFieldValue(AvroTypeUtil.java:897)
        at 
org.apache.nifi.avro.AvroTypeUtil.convertToAvroObject(AvroTypeUtil.java:783)
        at 
org.apache.nifi.avro.AvroTypeUtil.createAvroRecord(AvroTypeUtil.java:578)
        at 
org.apache.nifi.avro.AvroTypeUtil.createAvroRecord(AvroTypeUtil.java:561)
        at 
org.apache.nifi.avro.WriteAvroResultWithSchema.writeRecord(WriteAvroResultWithSchema.java:60)
        at 
org.apache.nifi.serialization.AbstractRecordSetWriter.write(AbstractRecordSetWriter.java:59)
        at 
org.apache.nifi.serialization.AbstractRecordSetWriter.write(AbstractRecordSetWriter.java:52)
        at 
org.apache.nifi.processors.standard.sql.RecordSqlWriter.writeResultSet(RecordSqlWriter.java:79)
        ... 14 common frames omitted

ExecuteSQL does not have this problem as it uses JdbcCommon which has custom 
BLOB/CLOB logic, where ExecuteSQLRecord uses AvroTypeUtil which does not catch 
BLOB/CLOB as a special case. The logic should be updated to match JdbcCommon 
for BLOB/CLOB handling.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to