Пример #1
0
        public void Ready(StatementContextRuntimeServices services)
        {
            var hasContext = false;
            for (var i = 0; i < Processors.Length; i++) {
                hasContext |= Processors[i].ContextName != null;
            }

            if (ContextName == null) {
                if (Processors.Length == 1) {
                    if (!hasContext) {
                        SelectExec = FAFQueryMethodSelectExecNoContextNoJoin.INSTANCE;
                    }
                    else {
                        SelectExec = FAFQueryMethodSelectExecSomeContextNoJoin.INSTANCE;
                    }
                }
                else {
                    if (!hasContext) {
                        SelectExec = FAFQueryMethodSelectExecNoContextJoin.INSTANCE;
                    }
                    else {
                        SelectExec = FAFQueryMethodSelectExecSomeContextJoin.INSTANCE;
                    }
                }
            }
            else {
                if (Processors.Length != 1) {
                    throw new UnsupportedOperationException("Context name is not supported in a join");
                }

                if (!hasContext) {
                    throw new UnsupportedOperationException("Query target is unpartitioned");
                }

                SelectExec = FAFQueryMethodSelectExecGivenContextNoJoin.INSTANCE;
            }
            
            if (!Subselects.IsEmpty()) {
                FAFQueryMethodUtil.InitializeSubselects(services, Annotations, Subselects);
            }
        }
Пример #2
0
        public EPPreparedQueryResult Execute(
            AtomicBoolean serviceStatusProvider,
            FAFQueryMethodAssignerSetter assignerSetter,
            ContextPartitionSelector[] contextPartitionSelectors,
            ContextManagementService contextManagementService)
        {
            if (!serviceStatusProvider.Get()) {
                throw FAFQueryMethodUtil.RuntimeDestroyed();
            }

            if (contextPartitionSelectors != null && contextPartitionSelectors.Length != Processors.Length) {
                throw new ArgumentException(
                    "The number of context partition selectors does not match the number of named windows or tables in the from-clause");
            }

            try {
                return SelectExec.Execute(this, contextPartitionSelectors, assignerSetter, contextManagementService);
            }
            finally {
                if (HasTableAccess) {
                    Processors[0].StatementContext.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                }
            }
        }