[cmd] Fix a crash with CodeChecker cmd diff --unique on #3816
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suppose we have a server with two non-empty, non-identical runs, Example1 and Example2. The following invocation:
CodeChecker cmd diff -o rows --url localhost/Default -n "Example2" -b "Example1" --new --uniqueing on
would have crashed at a thrift call level. If uniqueing wasn't on, the crash was abscent as well.
The root of the problem wasn't on the thrift level, however, but rather that a thrift function was invoked with None values, when said parameters mustn't have been None.
Specifically, these values were the file ID's of some reports. The file ID, column and row numbers of a report are None in the ReportData with uniqueing, but are proper values otherwise.
This makes some sense -- if 10 reports have the same report hash, by uniquing we obtain a report that describes 10 reports, so "some sense of identity being lost" would be an understandable approach to uniquing, but we can do better.
We can just take the arguably easier solution of picking a random report out of the 10 equivalent one, and say that this report stands in the place of the other 9.
On the implementation level, I simply querried the rest of the fields of the table, which in effect does just this.