From bfcc869d193c316e06cc4f8db8e00e8f00eba7ee Mon Sep 17 00:00:00 2001 From: Christian Wade Date: Fri, 20 Dec 2019 20:28:57 -0800 Subject: [PATCH] Validation for incr refresh params --- .../TabularMetadata/Comparison.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/BismNormalizer/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs b/BismNormalizer/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs index 50f288d..59a530d 100644 --- a/BismNormalizer/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs +++ b/BismNormalizer/BismNormalizer/TabularCompare/TabularMetadata/Comparison.cs @@ -1364,6 +1364,33 @@ namespace BismNormalizer.TabularCompare.TabularMetadata return; }; + //Check if incremental refresh param and there is an incremental refresh table in the model + if (comparisonObject.TargetObjectName == "RangeStart" || comparisonObject.TargetObjectName == "RangeEnd") + { + foreach (Table table in _targetTabularModel.Tables) + { + if (table.TomTable.RefreshPolicy != null) + { + //Confirm the table with incremental refresh policy isn't going to be deleted anyway + bool tableBeingDeletedAnyway = false; + foreach (ComparisonObject comparisonObjectToCheck in _comparisonObjects) + { + if (comparisonObjectToCheck.TargetObjectName == table.Name && comparisonObjectToCheck.MergeAction == MergeAction.Delete) + { + tableBeingDeletedAnyway = true; + break; + } + } + + if (!tableBeingDeletedAnyway) + { + OnValidationMessage(new ValidationMessageEventArgs($"Unable to delete expression {comparisonObject.TargetObjectName} because it is an incremental-refresh parameter and table {table.Name} contains an incremental-refresh policy.", ValidationMessageType.Expression, ValidationMessageStatus.Warning)); + return; + } + } + } + } + //Check any objects in target that depend on the expression are also going to be deleted List warningObjectList = new List(); if (!HasBlockingToDependenciesInTarget(comparisonObject.TargetObjectName, CalcDependencyObjectType.Expression, ref warningObjectList))