- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Transform string to integer in NiFi
- Labels:
-
Apache NiFi
Created on 11-04-2020 11:33 AM - edited 11-04-2020 11:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Faerballert
Created 02-18-2022 12:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what if the value is empty. How to set null value instead of empty string ?
