Member since
01-24-2019
3
Posts
0
Kudos Received
0
Solutions
12-06-2021
08:50 AM
@mburgess .. Hope you are doing good. I am facing issue while creating a groovy script for Scripted Reader Controller service in Convert Record processor. I want read the Flat width file input but script validation is getting failed again and again. It is giving 'groovy.lang.MissingPropertyException: No such property: session for class: Script' My code is below (also not sure my logic is correct for reading the Fixed Width File as input) Please let me know what's the issue here. import org.apache.commons.io.IOUtils import java.nio.charset.StandardCharsets import java.nio.charset.UnsupportedCharsetException; import java.io.IOException; import org.apache.nifi.controller.ControllerService flowFile = session.get() if(!flowFile) return try { def text = '' // Cast a closure with an inputStream parameter to InputStreamCallback session.read(flowFile, {inputStream -> def readIN = IOUtils.toString(inputStream, StandardCharsets.UTF_8) names = [] text = readIN.eachLine { names << [ data: it[0..7].trim(), name: it[8..33].trim(), isr: it[34..43].trim() ]} readIN.close() } as InputStreamCallback) session.transfer(flowFile, REL_SUCESS) } catch(e) { log.error("Error while processing the flowfile") session.transfer(flowFile, REL_FAILURE) }
... View more
01-27-2019
08:22 AM
Hi,after these days,I found something; NIFI use the Apache parquet-avro to parse the parquet file; Unfortunately,INT96 is not yet implemented in the lastest version of parquet-avro;
... View more