public void pushRegion(String regionPath) { push(new CompiledRegion(regionPath)); }
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; }
QRegion rgn = (QRegion) cRgn.evaluate(context);
/** * 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; }
expr = context.resolve(((CompiledID) expr).getId()); } else if (expr instanceof CompiledRegion) { QRegion qrgn = (QRegion) ((CompiledRegion) expr).evaluate(context); type = qrgn.getCollectionType(); break;
/** * Returns the size of region iterator for count(*) on a region without whereclause. * * @since GemFire 6.6.2 */ private int getRegionIteratorSize(ExecutionContext context, CompiledValue collExpr) throws RegionNotFoundException { Region region; String regionPath = ((CompiledRegion) collExpr).getRegionPath(); if (context.getBucketRegion() == null) { region = context.getCache().getRegion(regionPath); } else { region = context.getBucketRegion(); } if (region != null) { return region.size(); } else { // if we couldn't find the region because the cache is closed, throw // a CacheClosedException Cache cache = context.getCache(); if (cache.isClosed()) { throw new CacheClosedException(); } throw new RegionNotFoundException( String.format("Region not found: %s", regionPath)); } }
new CompiledMultiplication(compiledValue1, compiledValue2, 13), new CompiledNegation(compiledValue1), new CompiledRegion("test"), new CompiledSortCriterion(true, compiledValue1), new CompiledSubtraction(compiledValue1, compiledValue2, 13),
QueryUtils.obtainTheBottomMostCompiledValue(itrDef.getCollectionExpr()); if (startVal.getType() == OQLLexerTokenTypes.RegionPath) { rgnPath = ((QRegion) ((CompiledRegion) startVal).evaluate(this)).getFullPath(); this.indpndtItrToRgnMap.put(itr, rgnPath); } else if (startVal.getType() == OQLLexerTokenTypes.QUERY_PARAM) {