Created 10-19-2023 01:18 AM
Hi all.
I have two avro-binary types of flow files and their content is:
Flow file one:
[ {
"DepartmentID" : "Undefined",
"Name" : "Non Billable",
} ]
Flow file two:[ {
"DepartmentID" : "Null",
"Name" : "Tax",
} ]
I am using UpdateRecord processor to add a key:value (tenantId) in the same file for which I am using below avro schema:
{
"name": "nifi",
"type": "record",
"fields": [
{ "name": "TenantId", "type": ["null","string"] },
{ "name": "DepartmentId", "type": ["null","string"] },
{ "name": "Name", "type": ["null","string"] }
]
}
I am using literal value replacement value strategy and getting TenantId from previous processors. So far, this is a success and tenantId is appended. However, as a result, the DepartmentId changes to null for BOTH the files. Where I can ensure that the DepartmentId's values are not changed because based on these values, I have to route the "undefined" file for further processing.
Any help would be appreciated. Thanks.
Created 10-19-2023 03:50 AM
What did you configure in UpdateRecord? Most likely you problem starts from there.
Created 10-19-2023 03:55 AM
I am reading avro flow flow (using embedded schema) and for writing it, I am providing schema.text.
My schema text is this:
{
"name": "nifi",
"type": "record",
"fields": [
{ "name": "TenantId", "type": ["null","string"] },
{ "name": "DepartmentId", "type": ["null","string"] },
{ "name": "Name", "type": ["null","string"] }
]
}
The issue is its not retaining DepartmentID as strings and converting them to null.
Created 10-19-2023 04:50 AM
I resolved the issue. I had DepartmentId in my avro schema however, I was getting DepartmentID in the input. Schemas are case sensitive.
Now, that the string values are appended in the DepartmentID column, I am using RouteOnContent processors and using ${DepartmentID:equals('Undefined')} to match if the DepartmentID' values are of undefined or null type. It is not identifying the "Undefined" values. is the regex statement correct?
Content of flow file is:
[ {
"TenantId" : "FF369226-0EDA-4D0D-B48C-6B27F404ECCB",
"DepartmentID" : "Undefined",
"Name": "xyz"
} ]