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

Add support for String[] to PutCassandraRecord

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.14.0
    • Extensions
    • None

    Description

      Currently the PutCassandraRecord processor does support string arrays. Trying to use them results in the following error:

      | 2020-08-13 15:15:37,861 ERROR [Timer-Driven Process Thread-5] o.a.n.p.cassandra.PutCassandraRecord PutCassandraRecord[id=af756410-1ef0-3d80-045e-160f02632c54] Unable to write the records into Cassandra table due to com.datastax.driver.core.exceptions.InvalidTypeException: Value 3 of type class [Ljava.lang.Object; does not correspond to any CQL3 type: com.datastax.driver.core.exceptions.InvalidTypeException: Value 3 of type class [Ljava.lang.Object; does not correspond to any CQL3 type
      | com.datastax.driver.core.exceptions.InvalidTypeException: Value 3 of type class [Ljava.lang.Object; does not correspond to any CQL3 type
      | 	at com.datastax.driver.core.querybuilder.Utils.convert(Utils.java:361)
      | 	at com.datastax.driver.core.querybuilder.BuiltStatement.getValues(BuiltStatement.java:265)
      | 	at com.datastax.driver.core.BatchStatement.getIdAndValues(BatchStatement.java:92)
      | 	at com.datastax.driver.core.SessionManager.makeRequestMessage(SessionManager.java:597)
      | 	at com.datastax.driver.core.SessionManager.executeAsync(SessionManager.java:131)
      | 	at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:68)
      | 	at org.apache.nifi.processors.cassandra.PutCassandraRecord.onTrigger(PutCassandraRecord.java:300)
      | 	at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
      | 	at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1176)
      | 	at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
      | 	at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
      | 	at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
      | 	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: com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [ANY <-> [Ljava.lang.Object;]
      | 	at com.datastax.driver.core.CodecRegistry.notFound(CodecRegistry.java:741)
      | 	at com.datastax.driver.core.CodecRegistry.createCodec(CodecRegistry.java:602)
      | 	at com.datastax.driver.core.CodecRegistry.findCodec(CodecRegistry.java:582)
      | 	at com.datastax.driver.core.CodecRegistry.codecFor(CodecRegistry.java:429)
      | 	at com.datastax.driver.core.querybuilder.Utils.convert(Utils.java:357)
      | 	... 18 common frames omitted

      The solution is to add the appropriate codec for this type conversion. I will submit a PR for this change.

      Attachments

        Activity

          People

            woutifier Wouter de Vries
            woutifier Wouter de Vries
            Votes:
            0 Vote for this issue
            Watchers:
            2 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 20m
                1h 20m