MINOR: fix getter for failed rows sample (#16796)

* deep copy the returned test case

* added comment about deep copy

* use JsonUtils.deepCopy
This commit is contained in:
Imri Paran 2024-07-02 09:56:04 +02:00 committed by GitHub
parent 7ddd8d7938
commit 80653c6988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -790,6 +790,8 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
"failedRowsSample", "failedRowsSample",
JsonUtils.pojoToJson(tableData)); JsonUtils.pojoToJson(tableData));
setFieldsInternal(testCase, Fields.EMPTY_FIELDS); setFieldsInternal(testCase, Fields.EMPTY_FIELDS);
// deep copy the test case to avoid updating the cached entity
testCase = JsonUtils.deepCopy(testCase, TestCase.class);
return testCase.withFailedRowsSample(tableData); return testCase.withFailedRowsSample(tableData);
} }
@ -999,7 +1001,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
Entity.TABLE, table.getColumns(), table.getFullyQualifiedName(), true); Entity.TABLE, table.getColumns(), table.getFullyQualifiedName(), true);
List<TagLabel> tags = daoCollection.tagUsageDAO().getTags(table.getFullyQualifiedName()); List<TagLabel> tags = daoCollection.tagUsageDAO().getTags(table.getFullyQualifiedName());
table.setTags(tags); table.setTags(tags);
return maskSampleData(testCase.getFailedRowsSample(), table, table.getColumns()); return maskSampleData(sampleData, table, table.getColumns());
} }
return sampleData; return sampleData;
} }