protected void evaluateCollectionForIndependentIterator(ExecutionContext context, RuntimeIterator rIter) throws RegionNotFoundException, TypeMismatchException { try { rIter.evaluateCollection(context); } catch (QueryExecutionTimeoutException qet) { throw qet; } catch (RegionNotFoundException re) { throw re; } catch (NotAuthorizedException e) { throw e; } catch (QueryExecutionCanceledException e) { throw e; } catch (CacheClosedException e) { throw e; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Exception while getting runtime iterator.", e); } throw new TypeMismatchException( "Exception in evaluating the Collection Expression in getRuntimeIterator() even though the Collection is independent of any RuntimeIterator", e); } }
private void doNestedIterationsForIndexInit(int level, List runtimeIterators) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { if (level == 1) { ++this.initEntriesUpdated; } if (level == this.iteratorSize) { applyProjectionForIndexInit(runtimeIterators); } else { RuntimeIterator rIter = (RuntimeIterator) runtimeIterators.get(level); Collection c = rIter.evaluateCollection(this.initContext); if (c == null) return; Iterator cIter = c.iterator(); while (cIter.hasNext()) { rIter.setCurrent(cIter.next()); doNestedIterationsForIndexInit(level + 1, runtimeIterators); } } }
private void doNestedIterationsForIndexInit(int level, List runtimeIterators) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { if (level == 1) { ++this.initEntriesUpdated; } if (level == this.iteratorSize) { applyProjectionForIndexInit(runtimeIterators); } else { RuntimeIterator rIter = (RuntimeIterator) runtimeIterators.get(level); // System.out.println("Level = "+level+" Iter = "+rIter.getDef()); Collection c = rIter.evaluateCollection(this.initContext); if (c == null) return; Iterator cIter = c.iterator(); while (cIter.hasNext()) { rIter.setCurrent(cIter.next()); doNestedIterationsForIndexInit(level + 1, runtimeIterators); } } }
private void doNestedExpansion(int level, ExecutionContext expansionContext, List expandedResults, Object lowerBoundKey, Object upperBoundKey, int lowerBoundOperator, int upperBoundOperator, Object value) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { List iterList = expansionContext.getCurrentIterators(); int iteratorSize = iterList.size(); if (level == iteratorSize) { expand(expansionContext, expandedResults, lowerBoundKey, upperBoundKey, lowerBoundOperator, upperBoundOperator, value); } else { RuntimeIterator rIter = (RuntimeIterator) iterList.get(level); Collection c = rIter.evaluateCollection(expansionContext); if (c == null) return; Iterator cIter = c.iterator(); while (cIter.hasNext()) { rIter.setCurrent(cIter.next()); doNestedExpansion(level + 1, expansionContext, expandedResults, lowerBoundKey, upperBoundKey, lowerBoundOperator, upperBoundOperator, value); } } }
/** * @param add true if adding to index, false if removing */ private void doNestedIterations(int level, boolean add, ExecutionContext context) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { List iterList = context.getCurrentIterators(); if (level == this.iteratorSize) { applyProjection(add, context); } else { RuntimeIterator rIter = (RuntimeIterator) iterList.get(level); // System.out.println("Level = "+level+" Iter = "+rIter.getDef()); Collection c = rIter.evaluateCollection(context); if (c == null) return; Iterator cIter = c.iterator(); while (cIter.hasNext()) { rIter.setCurrent(cIter.next()); doNestedIterations(level + 1, add, context); } } }
/** * @param add true if adding to index, false if removing */ private void doNestedIterations(int level, boolean add, ExecutionContext context) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { List iterList = context.getCurrentIterators(); if (level == this.iteratorSize) { applyProjection(add, context); } else { RuntimeIterator rIter = (RuntimeIterator) iterList.get(level); // System.out.println("Level = "+level+" Iter = "+rIter.getDef()); Collection c = rIter.evaluateCollection(context); if (c == null) return; Iterator cIter = c.iterator(); while (cIter.hasNext()) { rIter.setCurrent(cIter.next()); doNestedIterations(level + 1, add, context); } } }
private void doNestedIterationsForIndexInit(int level, List runtimeIterators) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { if (level == 1) { ++this.initEntriesUpdated; } if (level == this.iteratorSize) { applyProjectionForIndexInit(runtimeIterators); } else { RuntimeIterator rIter = (RuntimeIterator) runtimeIterators.get(level); Collection collection = rIter.evaluateCollection(this.initContext); if (collection == null) { return; } for (Object aCollection : collection) { rIter.setCurrent(aCollection); doNestedIterationsForIndexInit(level + 1, runtimeIterators); } } }
Collection nextLevelValues = nextItr.evaluateCollection(context);
private void doNestedIterations(int level, ExecutionContext context) throws TypeMismatchException, AmbiguousNameException, FunctionDomainException, NameResolutionException, QueryInvocationTargetException, IMQException { List iterList = context.getCurrentIterators(); if (level == this.iteratorSize) { applyProjection(context); } else { RuntimeIterator rIter = (RuntimeIterator) iterList.get(level); Collection collection = rIter.evaluateCollection(context); if (collection == null) { return; } for (Object aCollection : collection) { rIter.setCurrent(aCollection); doNestedIterations(level + 1, context); } } }
SelectResults c = currLevel.evaluateCollection(context); if (c == null) { expansionItrs.previous();
@Test public void cacheClosedWhileEvaluateCollectionShouldNotThrowTypeMismatchException() throws Exception { CompiledValue compiledValue = mock(CompiledValue.class); CompiledIteratorDef compiledIteratorDef = new CompiledIteratorDef("TestIterator", TypeUtils.OBJECT_TYPE, compiledValue); ExecutionContext executionContext = mock(ExecutionContext.class); RuntimeIterator runtimeIterator = mock(RuntimeIterator.class); when(runtimeIterator.evaluateCollection(executionContext)) .thenThrow(CacheClosedException.class); try { compiledIteratorDef.evaluateCollectionForIndependentIterator(executionContext, runtimeIterator); fail(); } catch (Exception e) { assertTrue(e instanceof CacheClosedException); } } }
c = derivedResults.get(key); } else { c = currentLevel.evaluateCollection(context); c = currentLevel.evaluateCollection(context);
SelectResults sr = rIter.evaluateCollection(context); if (sr == null) { return 0; // continue iteration if a collection evaluates to UNDEFINED