Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-6062

ExecuteSQLRecord does not write BLOB/CLOB data properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.10.0, 1.9.1
    • Extensions
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              mattyb149 Matt Burgess
              mattyb149 Matt Burgess
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h