From 80653c6988d8fa8b17aea1d3242839f872892b2e Mon Sep 17 00:00:00 2001 From: Imri Paran Date: Tue, 2 Jul 2024 09:56:04 +0200 Subject: [PATCH] MINOR: fix getter for failed rows sample (#16796) * deep copy the returned test case * added comment about deep copy * use JsonUtils.deepCopy --- .../org/openmetadata/service/jdbi3/TestCaseRepository.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java index 097e1358ffb..58f03821f35 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java @@ -790,6 +790,8 @@ public class TestCaseRepository extends EntityRepository { "failedRowsSample", JsonUtils.pojoToJson(tableData)); 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); } @@ -999,7 +1001,7 @@ public class TestCaseRepository extends EntityRepository { Entity.TABLE, table.getColumns(), table.getFullyQualifiedName(), true); List tags = daoCollection.tagUsageDAO().getTags(table.getFullyQualifiedName()); table.setTags(tags); - return maskSampleData(testCase.getFailedRowsSample(), table, table.getColumns()); + return maskSampleData(sampleData, table, table.getColumns()); } return sampleData; }