CompiledValue colnExpr = cIterDef.getCollectionExpr();
if (!(itrDef.getCollectionExpr() instanceof CompiledRegion)) { throw new UnsupportedOperationException( "CQ queries must have a region path only as the first iterator in the FROM clause");
private Region getRegionFromPath(String imports, String fromClause) throws RegionNotFoundException { QCompiler compiler = new QCompiler(); if (imports != null) { compiler.compileImports(imports); } List list = compiler.compileFromClause(fromClause); CompiledValue cv = QueryUtils .obtainTheBottomMostCompiledValue(((CompiledIteratorDef) list.get(0)).getCollectionExpr()); String regionPath = null; if (cv.getType() == OQLLexerTokenTypes.RegionPath) { regionPath = ((CompiledRegion) cv).getRegionPath(); } else { throw new RegionNotFoundException( String.format( "DefaultQueryService::createIndex:First Iterator of Index >From Clause does not evaluate to a Region Path. The from clause used for Index creation is %s", fromClause)); } Region region = cache.getRegion(regionPath); if (region == null) { throw new RegionNotFoundException( String.format("Region ' %s ' not found: from %s", new Object[] {regionPath, fromClause})); } return region; }
/** * Returns parameterized query used by the server. This method replaces Region name with $1 and if * type is not specified in the query, looks for type from cqattributes and appends into the * query. * * @return String modified query. */ private Query constructServerSideQuery() throws QueryException { InternalCache cache = cqService.getInternalCache(); DefaultQuery locQuery = (DefaultQuery) cache.getLocalQueryService().newQuery(this.queryString); CompiledSelect select = locQuery.getSimpleSelect(); CompiledIteratorDef from = (CompiledIteratorDef) select.getIterators().get(0); // WARNING: ASSUMES QUERY WAS ALREADY VALIDATED FOR PROPER "FORM" ON CLIENT; // THIS VALIDATION WILL NEED TO BE DONE ON THE SERVER FOR NATIVE CLIENTS, // BUT IS NOT DONE HERE FOR JAVA CLIENTS. // The query was already checked on the client that the sole iterator is a // CompiledRegion this.regionName = ((CompiledRegion) from.getCollectionExpr()).getRegionPath(); from.setCollectionExpr(new CompiledBindArgument(1)); return locQuery; }
if (iterDef.getCollectionExpr().getType() != OQLLexerTokenTypes.RegionPath) { throw new IndexInvalidException( "The fromClause for a Primary Key index should be a Region Path only");
Object[] retValues = {null, null}; try { CompiledValue def = iterDef.getCollectionExpr(); if (def instanceof CompiledRegion) { CompiledBindArgument bindArg = new CompiledBindArgument(1);
CompiledValue cv = iterDef.getCollectionExpr(); this.addnlProjType = rIter.getElementType(); String name = iterDef.getName();
QueryUtils.obtainTheBottomMostCompiledValue(itrDef.getCollectionExpr()); if (startVal.getType() == OQLLexerTokenTypes.RegionPath) { rgnPath = ((QRegion) ((CompiledRegion) startVal).evaluate(this)).getFullPath();
if (currentLevel.getCmpIteratorDefn().getCollectionExpr() .getType() == OQLLexerTokenTypes.RegionPath) { key = currentLevel.getCmpIteratorDefn().getName() + ':' + currentLevel.getDefinition(); } else if (currentLevel.getCmpIteratorDefn().getCollectionExpr() .getType() == OQLLexerTokenTypes.LITERAL_select) { useDerivedResults = false; CompiledValue path = currentLevel.getCmpIteratorDefn().getCollectionExpr(); if (useDerivedResults && derivedResults != null && path.hasIdentifierAtLeafNode()) { key = getCompiledIdFromPath(path).getId()
Object evalResult = iterDef.getCollectionExpr().evaluate(context); if (evalResult == null || evalResult == QueryService.UNDEFINED) { return false;
getModifiedDependentCompiledValue(context, currItrID, iterDef.getCollectionExpr(), isDependent));