Created 08-14-2024 09:22 AM
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
@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
@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,Created on 08-14-2024 01:31 PM - edited 08-14-2024 01:33 PM
@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.