/** * get the path to see if there's an index for, and also determine which CompiledValue is the key * while we're at it */ private PathAndKey getPathAndKey(ExecutionContext context) throws TypeMismatchException, AmbiguousNameException { // RuntimeIterator lIter = context.findRuntimeIterator(_left); // RuntimeIterator rIter = context.findRuntimeIterator(_right); boolean isLeftDependent = context.isDependentOnCurrentScope(_left); boolean isRightDependent = context.isDependentOnCurrentScope(_right); if ((isLeftDependent == false) == (isRightDependent == false)) return null; CompiledValue indexKey; CompiledValue path; if (isLeftDependent == false) { path = _right; indexKey = _left; } else { path = _left; indexKey = _right; } if (indexKey.isDependentOnCurrentScope(context)) return null; // this check // seems to be // redunant. return new PathAndKey(path, indexKey); }
if (!operand.isDependentOnCurrentScope(context)) { indexCount++;
/** * We retrieve the collection from the context cache if it exists This allows us to not have to * reevaluate the sub query on every iteration. This improves performance for queries such as * "select * from /receipts r where r.type = 'large' and r.id in (select c.id from /customers c * where c.status = 'preferred') The sub query would create a set that would not change and store * it into the context if it does not yet exist */ private Object evaluateColln(ExecutionContext context) throws QueryInvocationTargetException, NameResolutionException, TypeMismatchException, FunctionDomainException { Object evalColln = null; if (this.colln.isDependentOnCurrentScope(context)) { evalColln = this.colln.evaluate(context); } else { evalColln = context.cacheGet(this.colln); if (evalColln == null) { evalColln = this.colln.evaluate(context); context.cachePut(this.colln, evalColln); } } return evalColln; }
} else if (!_operands[i].isDependentOnCurrentScope(context)) {
} else if (!_operands[i].isDependentOnCurrentScope(context)) {
if (this.whereClause.isDependentOnCurrentScope(context)) { Iterator cIter = coll.iterator(); Object currObj = cIter.next();
result = doIterationEvaluate(context, false); } else { if (!this.whereClause.isDependentOnCurrentScope(context)) { // independent
Support.Assert(this._value.isDependentOnCurrentScope(context), "For a condition which does not depend on any RuntimeIterator of current scope , we should not have been in this function"); IndexInfo idxInfo[] = getIndexInfo(context);