I’m building a data collector pipeline in which I want to rename elements within an array.
The input are JSON files read from a data lake, format is a single document with an array of identically structured documents, e.g.
{ "entries": :
{
"wd:Employee_User_ID": "lol",
"wd:Scheduled_Weekly_Hours": "40",
"wd:fte": "100" },
{
"wd:Employee_User_ID": "rofl",
"wd:Scheduled_Weekly_Hours": "37.5",
"wd:fte": "100" }
]}
I need to rename these fields, so I’ve put the following into the Field Renamer processor:
/entries
→ /entries
But that gives an
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:424)
at java.util.ArrayList.get(ArrayList.java:437)
at com.streamsets.datacollector.record.RecordImpl.get(RecordImpl.java:309)
at com.streamsets.datacollector.record.RecordImpl.has(RecordImpl.java:374)
at com.streamsets.pipeline.stage.processor.fieldrenamer.FieldRenamerProcessor.process(FieldRenamerProcessor.java:300)
It works quite well (for the first array element) if I replace the asterisk with a 0 in the expressions. Isn’t this the correct syntax for renaming all array elements?