I use ExecuteGroovyScript processor just to extract only wanted columns for my further calculations.
Groovy Code :
def flowFile = session.get()
if(!flowFile) return
flowFile = session.write(flowFile, {inputStream, outputStream ->
outputStream.withWriter("UTF-8"){ w ->
inputStream.eachLine("UTF-8"){ line ->
def row = line.split(';',-1)
w << row[0,1,6,8,9,11].join(',') << '\n'
}
}
} as StreamCallback)
session.transfer(flowFile, REL_SUCCESS)
But for some csv, I get java.lang.ArrayIndexOutOfBoundsException.
My csv :
id,name,email,address
1,sachith,[email protected],{"Lane":"ABC Lane","No":"24"}
2,nalaka,[email protected],{"Lane":
"DEF Lane","No":"34"}
How can I get just 1 row and ignore other two rows? I have tried ValidateCSV processor for validating. But it can not capture this.

