- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
NIFI processor for converting a numeric type to string type for a specific column in CSV file
- Labels:
-
Apache NiFi
Created 08-14-2024 09:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am new to NIFI, and I was wondering if I could change the specific column in the csv file.
for example, if the column has numerical values it is supposed to be converted to string type
like if the column had a numerical value 1 it should be converted to apple in the same column
I tried doing it by referring to websites but still I was not successful. Looking forward for some response for this problem. Thanks in advance
Created on 08-14-2024 01:31 PM - edited 08-14-2024 01:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Former Member
LookupRecord processor can be used in this case. Please check if this method works for you.
Sample CSV input
id,brand,phone
10,Samsung,1
20,Apple,2
Expected output (codes 1 and 2 are replaced with names)
id,brand,phone
10,Samsung,Note
20,Apple,iPhone
I tried nifi flow as below
Lookup record configuration
CSV Reader
CSV Recordset Writer
Didnt make any change. Used default settings
Simple KeyValue Lookup service. There are several lookup services available in Nifi. You may use right service as per your requirement.
Created 08-14-2024 11:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Former Member Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @MattWho @mburgess who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created on 08-14-2024 01:31 PM - edited 08-14-2024 01:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Former Member
LookupRecord processor can be used in this case. Please check if this method works for you.
Sample CSV input
id,brand,phone
10,Samsung,1
20,Apple,2
Expected output (codes 1 and 2 are replaced with names)
id,brand,phone
10,Samsung,Note
20,Apple,iPhone
I tried nifi flow as below
Lookup record configuration
CSV Reader
CSV Recordset Writer
Didnt make any change. Used default settings
Simple KeyValue Lookup service. There are several lookup services available in Nifi. You may use right service as per your requirement.