Created on 11-04-2020 11:33 AM - edited 11-04-2020 11:35 AM
How can I transform a string to an integer in NiFi? I tried JoltTransform, but the string is transformed to a negative (??) integer. In the example, below, the timestamp_start original string value 1677720088000 is transformed to -1612124736. What am I missing in my Jolt specification? Any help is appreciated. Is there an alternative to the JoltTransform - another processor?
Looks like this is a known issue: https://github.com/bazaarvoice/jolt/issues/749
Original JSON
Transformed JSON
Jolt Specification
[
{
"operation": "modify-overwrite-beta",
"spec": {
"timestamp_start": "=toInteger"
}
},
{
"operation": "default",
"spec": {}
}
]
Created 11-12-2020 10:45 AM
The problem is because your value is higher than the maximum of an integer
Change
"=toInteger"
to
"=toLong"
Created 11-12-2020 10:45 AM
The problem is because your value is higher than the maximum of an integer
Change
"=toInteger"
to
"=toLong"
Created 11-13-2020 06:55 AM
Thanks @Faerballert
Created 02-18-2022 12:33 AM
what if the value is empty. How to set null value instead of empty string ?