Pavel created NIFI-7435:
---------------------------

             Summary: JoltTransformReccord throws ClassCastException
                 Key: NIFI-7435
                 URL: https://issues.apache.org/jira/browse/NIFI-7435
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
    Affects Versions: 1.11.4
            Reporter: Pavel
         Attachments: Snímek z 2020-05-08 21-33-08.png

I would like to implement a user case as shown in the picture in the attachment:

!Snímek z 2020-05-08 21-33-08.png|width=936,height=181!

If the records are non-empty, everything works.

However, if I first send first empty and then filled in, an exception is 
raised. In reverse order it works. 

Even manual schema setup for the input JsonTreeReader did not help.

 

Test use case:

input flowfile:
{code:java}
[{
 "CODE_ONE":null,
 "CODE_TWO":null
 },
 {
 "CODE_ONE":"a",
 "CODE_TWO":null
 }]{code}
{{jolt:}}
{code:java}
[
  {
    "operation": "shift",
    "spec": {
      "CODE_*": "CODES",
      "*": "&"
    }
  }
]
{code}
log:
JoltTransformRecord[id=f596e13d-0171-1000-7957-5abd51aa5ea0] Failed to write 
MapRecord[\{CODES=[Ljava.lang.Object;@6589e3eb}] with schema ["CODES" : 
"ARRAY[STRING]"] as a JSON Object due to java.lang.ClassCastException: null
 
JoltTransformRecord[id=f596e13d-0171-1000-7957-5abd51aa5ea0] Unable to 
transform 
StandardFlowFileRecord[uuid=db74cbdf-673b-4af4-ae3e-cab5915aa46e,claim=StandardContentClaim
 [resourceClaim=StandardResourceClaim[id=1588966927548-947, container=default, 
section=947], offset=766896, 
length=120],offset=0,name=db74cbdf-673b-4af4-ae3e-cab5915aa46e,size=120] due to 
java.lang.ClassCastException: null



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to