SavtechSolutions commented on issue #3269: NIFI-5960 add compatibility rating to RECORD schemas URL: https://github.com/apache/nifi/pull/3269#issuecomment-465320099 I intended for JIRA to only describe the issue, not the solution (as I'd prefer not to steer anyone trying to solve that issue into a particular solution, there might be alternate approaches). The issue at hand is that, when determining if a record is compatible with a given schema, we consider nullable fields to be compatible with null values. Generally, this makes sense, but not for union types. If one of the union choices is a record with only nullable fields, this choice suddenly becomes compatible with pretty much everything - like, you can feed it a record with completely unrelated field names, and it would still be considered compatible (see JIRA for an example). This PR aims to address that issue by keeping track of how many non-nullable fields were found compatible, as a ratio to the total # of fields checked. The ratio goes from -1 (not compatible) to 100 (fully compatible). So the above example would still be considered "sorta-compatible", with a rating of 0, but the compatibility check would still continue, and if a schema choice with a higher rating is found (all it takes for that is one non-nullable field to be found compatible), that schema would be used instead.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
