Exemple #1
0
        private static IList<FilterSpecParam> ComputePermutation(
            FilterParamExprMap filterParamExprMap,
            object[] permutation,
            FilterParamExprMap[][] orNodesMaps,
            FilterSpecCompilerArgs args)
        {
            var mapAll = new FilterParamExprMap();
            mapAll.Add(filterParamExprMap);

            // combine
            for (int orNodeNum = 0; orNodeNum < permutation.Length; orNodeNum++)
            {
                var orChildNodeNum = permutation[orNodeNum].AsInt();
                FilterParamExprMap mapOrSub = orNodesMaps[orNodeNum][orChildNodeNum];
                mapAll.Add(mapOrSub);
            }

            // consolidate across
            FilterSpecCompilerConsolidateUtil.Consolidate(mapAll, args.StatementName);

            IList<FilterSpecParam> filterParams = new List<FilterSpecParam>();
            filterParams.AddAll(mapAll.FilterParams);
            int countUnassigned = mapAll.CountUnassignedExpressions();

            if (countUnassigned == 0)
            {
                return filterParams;
            }

            FilterSpecParamExprNode node = MakeRemainingNode(mapAll.UnassignedExpressions, args);
            filterParams.Add(node);
            return filterParams;
        }
Exemple #2
0
        private static void DecomposePopulateConsolidate(
            FilterParamExprMap filterParamExprMap,
            IList<ExprNode> validatedNodes,
            FilterSpecCompilerArgs args)

        {
            IList<ExprNode> constituents = DecomposeCheckAggregation(validatedNodes);

            // Make filter parameter for each expression node, if it can be optimized
            foreach (ExprNode constituent in constituents)
            {
                FilterSpecParam param = FilterSpecCompilerMakeParamUtil.MakeFilterParam(
                    constituent, args.ArrayEventTypes, args.ExprEvaluatorContext, args.StatementName);
                filterParamExprMap.Put(constituent, param);
                    // accepts null values as the expression may not be optimized
            }

            // Consolidate entries as possible, i.e. (a != 5 and a != 6) is (a not in (5,6))
            // Removes duplicates for same property and same filter operator for filter service index optimizations
            FilterSpecCompilerConsolidateUtil.Consolidate(filterParamExprMap, args.StatementName);
        }