Hey Richard, I think you’d need to explain more about what you’re doing in your groovy script. What processor are you using? What’s the script doing? Is it parsing Avro data?
On Jan 29, 2024, at 12:26 AM, Richard Beare <[email protected]> wrote: Anyone able to offer assistance with this? I think my problem relates to correctly specifying types using expression languages and using schema inference from groovy. On Tue, Jan 23, 2024 at 2:20 PM Richard Beare <[email protected]<mailto:[email protected]>> wrote: Hi, What is the right way to deal with dates in the following context. I'm using the updaterecord processor to add a datestamp field to a record (derived from a filename attribute inserted by the getfile processor). /Visit_DateTime. ${filename:substringBeforeLast('.'):substringAfterLast('_'):toDate('yyyyMMdd'):format('yyyy-MM-dd'T'HH:mm:ss'Z'") Inside the groovy script I'm attempting to convert to date as follows: VisitTimeValue = new Date(currRecord.get(Visit_DateTime as String)) However I always get messages about "could not find matching constructor for java.util.Date(org.apackge.avro.util.Utf8)" I have a previously working version, from a slightly different context which did a cast to long: Date((long)currRecord.get....). In that case the record was created by a database query. The eventual use of VisitTimeValue is to dump it into a flowfile attribute. It seems to me that the type of the date field is not being correctly inferred by the avro reader/writers after I create it with the expression language. Alternatively, perhaps I should be using different date handling tools inside groovy. All advice welcome. Thanks
