diff --git a/ingestion/examples/sample_data/tests/testCaseResults.json b/ingestion/examples/sample_data/tests/testCaseResults.json index bb61db5cf89..d5bd6d76257 100644 --- a/ingestion/examples/sample_data/tests/testCaseResults.json +++ b/ingestion/examples/sample_data/tests/testCaseResults.json @@ -8,9 +8,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } + "name": "columnCount", + "value": "10" + } ] }, { @@ -18,19 +18,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } - ] - }, - { - "result": "Found 10 columns vs. the expected 10", - "testCaseStatus": "Success", - "testResultValues": [ - { - "name": "columnCount", - "value": "10" - } + "name": "columnCount", + "value": "10" + } ] }, { @@ -38,19 +28,29 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } - ] + "name": "columnCount", + "value": "10" + } + ] }, { "result": "Found 10 columns vs. the expected 10", "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } + "name": "columnCount", + "value": "10" + } + ] + }, + { + "result": "Found 10 columns vs. the expected 10", + "testCaseStatus": "Success", + "testResultValues": [ + { + "name": "columnCount", + "value": "10" + } ] }, { @@ -58,19 +58,19 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "columnCount", - "value": "8" - } - ] + "name": "columnCount", + "value": "8" + } + ] }, { "result": "Found 8 columns vs. the expected 10", "testCaseStatus": "Failed", "testResultValues": [ { - "name": "columnCount", - "value": "8" - } + "name": "columnCount", + "value": "8" + } ] }, { @@ -78,9 +78,9 @@ "testCaseStatus": "Aborted", "testResultValues": [ { - "name": "columnCount", - "value": "None" - } + "name": "columnCount", + "value": "None" + } ] }, { @@ -88,9 +88,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } + "name": "columnCount", + "value": "10" + } ] }, { @@ -98,9 +98,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } + "name": "columnCount", + "value": "10" + } ] }, { @@ -108,9 +108,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "10" - } + "name": "columnCount", + "value": "10" + } ] } ] @@ -123,9 +123,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "9" - } + "name": "columnCount", + "value": "9" + } ], "maxBound": 10, "minBound": 1 @@ -135,9 +135,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "9" - } + "name": "columnCount", + "value": "9" + } ], "maxBound": 10, "minBound": 7 @@ -147,9 +147,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "9" - } + "name": "columnCount", + "value": "9" + } ], "maxBound": 10, "minBound": 1 @@ -159,9 +159,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "9" - } + "name": "columnCount", + "value": "9" + } ], "maxBound": 10, "minBound": 1 @@ -171,9 +171,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "9" - } + "name": "columnCount", + "value": "9" + } ], "maxBound": 10, "minBound": 1 @@ -183,9 +183,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "8" - } + "name": "columnCount", + "value": "8" + } ], "maxBound": 10, "minBound": 1 @@ -195,9 +195,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "8" - } + "name": "columnCount", + "value": "8" + } ], "maxBound": 10, "minBound": 1 @@ -207,9 +207,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "columnCount", - "value": "14" - } + "name": "columnCount", + "value": "14" + } ], "maxBound": 31, "minBound": 20 @@ -219,9 +219,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "8" - } + "name": "columnCount", + "value": "8" + } ], "maxBound": 150, "minBound": 7 @@ -231,9 +231,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "columnCount", - "value": "8" - } + "name": "columnCount", + "value": "8" + } ], "maxBound": 150, "minBound": 7 @@ -248,9 +248,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "max", - "value": "65" - } + "name": "max", + "value": "65" + } ], "maxBound": 100, "minBound": 50 @@ -260,9 +260,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "max", - "value": "25" - } + "name": "max", + "value": "25" + } ], "maxBound": 100, "minBound": 50 @@ -272,9 +272,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "max", - "value": "56" - } + "name": "max", + "value": "56" + } ] }, { @@ -282,9 +282,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "max", - "value": "99" - } + "name": "max", + "value": "99" + } ], "maxBound": 100, "minBound": 50 @@ -294,9 +294,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "max", - "value": "190" - } + "name": "max", + "value": "190" + } ], "maxBound": 170, "minBound": 50 @@ -306,9 +306,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "max", - "value": "66" - } + "name": "max", + "value": "66" + } ], "maxBound": 100, "minBound": 10 @@ -318,9 +318,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "max", - "value": "76" - } + "name": "max", + "value": "76" + } ] }, { @@ -328,9 +328,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "max", - "value": "46" - } + "name": "max", + "value": "46" + } ], "maxBound": 100, "minBound": 51 @@ -340,9 +340,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "max", - "value": "100" - } + "name": "max", + "value": "100" + } ], "maxBound": 100 }, @@ -351,9 +351,9 @@ "testCaseStatus": "Aborted", "testResultValues": [ { - "name": "max", - "value": "None" - } + "name": "max", + "value": "None" + } ] } ] @@ -366,9 +366,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "likeCount", - "value": "65" - } + "name": "likeCount", + "value": "65" + } ] }, { @@ -376,9 +376,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "likeCount", - "value": "0" - } + "name": "likeCount", + "value": "0" + } ] }, { @@ -386,9 +386,9 @@ "testCaseStatus": "Aborted", "testResultValues": [ { - "name": "likeCount", - "value": "None" - } + "name": "likeCount", + "value": "None" + } ] }, { @@ -396,9 +396,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "likeCount", - "value": "99" - } + "name": "likeCount", + "value": "99" + } ] }, { @@ -406,9 +406,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "likeCount", - "value": "5" - } + "name": "likeCount", + "value": "5" + } ] }, { @@ -416,9 +416,9 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "likeCount", - "value": "2" - } + "name": "likeCount", + "value": "2" + } ] }, { @@ -426,9 +426,9 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "likeCount", - "value": "99" - } + "name": "likeCount", + "value": "99" + } ] }, { @@ -436,9 +436,9 @@ "testCaseStatus": "Aborted", "testResultValues": [ { - "name": "likeCount", - "value": "None" - } + "name": "likeCount", + "value": "None" + } ] }, { @@ -446,20 +446,19 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "likeCount", - "value": "99" - } + "name": "likeCount", + "value": "99" + } ] }, - { "result": "Found 99 value(s) matching regex pattern vs 99 value(s) in the column.", "testCaseStatus": "Success", "testResultValues": [ { - "name": "likeCount", - "value": "99" - } + "name": "likeCount", + "value": "99" + } ] } ] @@ -472,13 +471,13 @@ "testCaseStatus": "Aborted", "testResultValues": [ { - "name": "min", - "value": "None" - }, + "name": "min", + "value": "None" + }, { - "name": "max", - "value": "None" - } + "name": "max", + "value": "None" + } ], "maxBound": 96162, "minBound": 90001 @@ -488,13 +487,13 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "min", - "value": "35005" - }, + "name": "min", + "value": "35005" + }, { - "name": "max", - "value": "92808" - } + "name": "max", + "value": "92808" + } ], "maxBound": 96162, "minBound": 90001 @@ -504,13 +503,13 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "min", - "value": "90006" - }, + "name": "min", + "value": "90006" + }, { - "name": "max", - "value": "92808" - } + "name": "max", + "value": "92808" + } ] }, { @@ -518,43 +517,43 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "min", - "value": "90002" - }, + "name": "min", + "value": "90002" + }, { - "name": "max", - "value": "95640" - } - ] + "name": "max", + "value": "95640" + } + ] }, { "result": "Found min=90004, max=99001 vs. the expected min=90001, max=96162.", "testCaseStatus": "Failed", "testResultValues": [ { - "name": "min", - "value": "90004" - }, + "name": "min", + "value": "90004" + }, { - "name": "max", - "value": "99001" - } + "name": "max", + "value": "99001" + } ], "maxBound": 96162, - "minBound": 90001 + "minBound": 90001 }, { "result": "Found min=1001, max=2789 vs. the expected min=90001, max=96162.", "testCaseStatus": "Failed", "testResultValues": [ { - "name": "min", - "value": "1001" - }, + "name": "min", + "value": "1001" + }, { - "name": "max", - "value": "2789" - } + "name": "max", + "value": "2789" + } ], "maxBound": 96162, "minBound": 90001 @@ -564,13 +563,13 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "min", - "value": "91009" - }, + "name": "min", + "value": "91009" + }, { - "name": "max", - "value": "92808" - } + "name": "max", + "value": "92808" + } ], "minBound": 90001 }, @@ -579,13 +578,13 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "min", - "value": "90008" - }, + "name": "min", + "value": "90008" + }, { - "name": "max", - "value": "92808" - } + "name": "max", + "value": "92808" + } ], "maxBound": 96162, "minBound": 90001 @@ -595,13 +594,13 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "min", - "value": "92000" - }, + "name": "min", + "value": "92000" + }, { - "name": "max", - "value": "92808" - } + "name": "max", + "value": "92808" + } ], "maxBound": 96162, "minBound": 90001 @@ -611,13 +610,13 @@ "testCaseStatus": "Success", "testResultValues": [ { - "name": "min", - "value": "90001" - }, + "name": "min", + "value": "90001" + }, { - "name": "max", - "value": "96612" - } + "name": "max", + "value": "96612" + } ], "maxBound": 96162, "minBound": 90001 @@ -632,79 +631,190 @@ "testCaseStatus": "Failed", "testResultValues": [ { - "name": "min", - "value": "1001" - }, + "name": "min", + "value": "1001" + }, { - "name": "max", - "value": "2789" - } + "name": "max", + "value": "2789" + } ], "maxBound": 96162, "minBound": 90001 } ], "failedRowsSample": { - "columns": [ - "address_id", - "shop_id", - "first_name", - "last_name", - "address1", - "address2", - "company", - "city", - "region", - "zip", - "country", - "phone" - ], - "rows": [ - [ - "bc35100e-2da5-48bb-bfc8-667dafe66532", - "70424951-bc97-4b20-9ce7-be37c4619361", - "Zachary", - "Brett", - "9054 Maria Circle Apt. 296", - "48348 Victoria Valleys Suite 144", - "Robinson Inc", - "Stephanieport", - "048 Moore Turnpike Apt. 061", - "1001", - "Latvia", - "(381)575-6692" - ], - [ - "facf92d7-05ea-43d2-ba2a-067d63dee60c", - "a8d30187-1409-4606-9259-322a4f6caf74", - "Amber", - "Albert", - "3170 Warren Orchard Apt. 834", - "3204 Brewer Shoal Suite 324", - "Davila-Snyder", - "Nicoleland", - "023 Paul Course", - "1002", - "Sweden", - "438-959-1151" - ], - [ - "bab9a506-e23d-4c53-9402-d070e7704376", - "e02e1fac-b650-4db8-8c9d-5fa5edf5d863", - "Heidi", - "Kelly", - "30942 Gonzalez Stravenue", - "3158 Watts Green", - "Moore PLC", - "West Erica", - "6294 Elliott Ville", - "2789", - "Saint Martin", - "(830)112-9566x8681" - ] - ] - }, + "columns": [ + "address_id", + "shop_id", + "first_name", + "last_name", + "address1", + "address2", + "company", + "city", + "region", + "zip", + "country", + "phone" + ], + "rows": [ + [ + "bc35100e-2da5-48bb-bfc8-667dafe66532", + "70424951-bc97-4b20-9ce7-be37c4619361", + "Zachary", + "Brett", + "9054 Maria Circle Apt. 296", + "48348 Victoria Valleys Suite 144", + "Robinson Inc", + "Stephanieport", + "048 Moore Turnpike Apt. 061", + "1001", + "Latvia", + "(381)575-6692" + ], + [ + "facf92d7-05ea-43d2-ba2a-067d63dee60c", + "a8d30187-1409-4606-9259-322a4f6caf74", + "Amber", + "Albert", + "3170 Warren Orchard Apt. 834", + "3204 Brewer Shoal Suite 324", + "Davila-Snyder", + "Nicoleland", + "023 Paul Course", + "1002", + "Sweden", + "438-959-1151" + ], + [ + "bab9a506-e23d-4c53-9402-d070e7704376", + "e02e1fac-b650-4db8-8c9d-5fa5edf5d863", + "Heidi", + "Kelly", + "30942 Gonzalez Stravenue", + "3158 Watts Green", + "Moore PLC", + "West Erica", + "6294 Elliott Ville", + "2789", + "Saint Martin", + "(830)112-9566x8681" + ] + ] + }, "inspectionQuery": "SELECT * FROM ecommerce_db.shopify.dim_address\nWHERE zip NOT BETWEEN 90001 AND 96162\nLIMIT 50;" + }, + { + "name": "diff_with_production", + "results": [ + { + "result": "Found 3 different rows which is more than the threshold of 0", + "testCaseStatus": "Failed", + "testResultValues": [ + { + "name": "changedRows", + "value": "1" + }, + { + "name": "removedRows", + "value": "10" + }, + { + "name": "addedRows", + "value": "2234" + } + ] + } + ], + "failedRowsSample": { + "validate": false, + "columns": [ + "diffType", + "address_id", + "shop_id", + "first_name", + "last_name", + "address1", + "address2", + "company", + "city", + "region", + "zip", + "country", + "phone" + ], + "rows": [ + [ + "+", + "bc35100e-2da5-48bb-bfc8-667dafe66532", + "70424951-bc97-4b20-9ce7-be37c4619361", + "Zachary", + "Brett", + "9054 Maria Circle Apt. 296", + "48348 Victoria Valleys Suite 144", + "Robinson Inc", + "Stephanieport", + "048 Moore Turnpike Apt. 061", + "1001", + "Latvia", + "(381)575-6692" + ], + [ + "+", + "facf92d7-05ea-43d2-ba2a-067d63dee60c", + "a8d30187-1409-4606-9259-322a4f6caf74", + "Amber", + "Albert", + "3170 Warren Orchard Apt. 834", + "3204 Brewer Shoal Suite 324", + "Davila-Snyder", + "Nicoleland", + "023 Paul Course", + "1002", + "Sweden", + "438-959-1151" + ], + [ + "-", + "bab9a506-e23d-4c53-9402-d070e7704376", + "e02e1fac-b650-4db8-8c9d-5fa5edf5d863", + "Heidi", + "Kelly", + "30942 Gonzalez Stravenue", + "3158 Watts Green", + "Moore PLC", + "West Erica", + "6294 Elliott Ville", + "2789", + "Saint Martin", + "(830)112-9566x8681" + ] + ] + } + }, + { + "name": "diff_columns", + "results": [ + { + "result": "Tables have 4 different columns:\n Removed columns: removed_id\n Added columns: added_column,my_other_value\n Changed columns:\n first_name: VARCHAR -> INT", + "testCaseStatus": "Failed", + "testResultValues": [ + { + "name": "addedColumns", + "value": "2" + }, + { + "name": "removedColumns", + "value": "1" + }, + { + "name": "changedColumns", + "value": "1" + } + ] + } + ] } ] } \ No newline at end of file diff --git a/ingestion/examples/sample_data/tests/testSuites.json b/ingestion/examples/sample_data/tests/testSuites.json index faa009b170b..654d41aa404 100644 --- a/ingestion/examples/sample_data/tests/testSuites.json +++ b/ingestion/examples/sample_data/tests/testSuites.json @@ -340,6 +340,32 @@ } ], "resolutions": {} + }, + { + "name": "diff_with_production", + "description": "compare with production data", + "entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address>", + "testDefinitionName": "tableDiff", + "parameterValues": [ + { + "name": "table2", + "value": "sample_data.ecommerce_db.shopify.production_dim_address" + } + ], + "resolutions": {} + }, + { + "name": "diff_columns", + "description": "compare with a table with different columns", + "entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address>", + "testDefinitionName": "tableDiff", + "parameterValues": [ + { + "name": "table2", + "value": "sample_data.ecommerce_db.shopify.production_dim_address" + } + ], + "resolutions": {} } ] } diff --git a/ingestion/src/metadata/ingestion/source/database/sample_data.py b/ingestion/src/metadata/ingestion/source/database/sample_data.py index 96c6b4655a3..287c311a4df 100644 --- a/ingestion/src/metadata/ingestion/source/database/sample_data.py +++ b/ingestion/src/metadata/ingestion/source/database/sample_data.py @@ -1538,6 +1538,9 @@ class SampleDataSource( rows=test_case_results["failedRowsSample"]["rows"], columns=test_case_results["failedRowsSample"]["columns"], ), + validate=test_case_results["failedRowsSample"].get( + "validate", True + ), ) if test_case_results.get("inspectionQuery"): self.metadata.ingest_inspection_query(