Exemple #1
0
        public bool TryAdd(CalculateProvider provider)
        {
            var applyParameters = FindApplyParameters(provider);

            if (applyParameters.Count == 0)
            {
                return(false);
            }
            if (applyParameters.Count > 1)
            {
                ApplyProviderCorrectorRewriter.ThrowInvalidOperationException();
            }
            var applyParameter = applyParameters[0];

            if (owner.State.SelfConvertibleApplyProviders[applyParameter])
            {
                return(false);
            }
            var newPair = new Pair <CalculateProvider, ColumnCollection>(provider, provider.Header.Columns);

            if (owner.State.CalculateProviders.ContainsKey(applyParameter))
            {
                owner.State.CalculateProviders[applyParameter].Add(newPair);
            }
            else
            {
                owner.State.CalculateProviders.Add(applyParameter,
                                                   new List <Pair <CalculateProvider, ColumnCollection> > {
                    newPair
                });
            }
            return(true);
        }
Exemple #2
0
 public void ValidateNewColumnIndexes <TDictKey, TPairKey>(
     Dictionary <TDictKey, List <Pair <TPairKey, ColumnCollection> > > currentState,
     ICollection <Column> mappedColumns, string description)
 {
     foreach (var providerPair in currentState)
     {
         foreach (var predicatePair in providerPair.Value)
         {
             if (!CheckPresenceOfOldColumns(predicatePair.Second, mappedColumns))
             {
                 ApplyProviderCorrectorRewriter.ThrowInvalidOperationException(description);
             }
         }
     }
 }
 public void ValidateAggregatedColumns(AggregateProvider provider)
 {
     if (owner.State.Predicates.Count == 0)
     {
         return;
     }
     foreach (var parameterPair in owner.State.Predicates)
     {
         foreach (var predicatePair in parameterPair.Value)
         {
             foreach (var column in predicatePair.Second)
             {
                 if (provider.GroupColumnIndexes.Contains(column.Index))
                 {
                     ApplyProviderCorrectorRewriter.ThrowInvalidOperationException(
                         Strings.ExColumnsUsedByPredicateContainingApplyParameterAreRemoved);
                 }
             }
         }
     }
 }