/** * For Order by queries ,since they are already ordered by the comparator && it takes care of * conversion, we do not have to wrap it in a wrapper */ private boolean needsPDXDeserializationWrapper(boolean isQueryOnPR) { return !isRemoteQuery() && !this.cache.getPdxReadSerialized(); }
/** * set keepSerialized flag for remote queries of type 'select *' having independent operators */ void keepResultsSerialized(CompiledSelect cs, ExecutionContext context) { if (isRemoteQuery()) { // for dependent iterators, deserialization is required if (cs.getIterators().size() == context.getAllIndependentIteratorsOfCurrentScope().size() && cs.getWhereClause() == null && cs.getProjectionAttributes() == null && !cs.isDistinct() && cs.getOrderByAttrs() == null) { setKeepSerialized(); } } }
/** * For local queries with distinct, deserialize all PdxInstances as we do not have a way to * compare Pdx and non Pdx objects in case the cache has a mix of pdx and non pdx objects. We * still have to honor the cache level readSerialized flag in case of all Pdx objects in cache. * Also always convert PdxString to String before adding to resultSet for remote queries */ private Object deserializePdxForLocalDistinctQuery(ExecutionContext context, Object value) throws QueryInvocationTargetException { if (!((DefaultQuery) context.getQuery()).isRemoteQuery()) { if (context.isDistinct() && value instanceof PdxInstance && !this.region.getCache().getPdxReadSerialized()) { try { value = ((PdxInstance) value).getObject(); } catch (Exception ex) { throw new QueryInvocationTargetException( "Unable to retrieve domain object from PdxInstance while building the ResultSet. " + ex.getMessage()); } } else if (value instanceof PdxString) { value = value.toString(); } } return value; }
if (context.isDistinct() && ((DefaultQuery) context.getQuery()).isRemoteQuery()) { Set tempResults = new HashSet(); for (Object o : c) { if (((DefaultQuery) context.getQuery()).isRemoteQuery() && context.isDistinct()) { for (int i = 0; i < a.length; i++) { if (a[i] instanceof PdxString) {
if (!this.query.isRemoteQuery() && pr.getCompressor() == null && pr.getCache().isCopyOnRead() && (!DefaultQueryService.COPY_ON_READ_AT_ENTRY_LEVEL || (qp.isIndexUsed() && DefaultQueryService.COPY_ON_READ_AT_ENTRY_LEVEL))) {
result = new ResultsCollectionPdxDeserializerWrapper((SelectResults) result, needsCopyOnReadWrapper); } else if (!isRemoteQuery() && this.cache.getCopyOnRead() && result instanceof SelectResults) { if (needsCopyOnReadWrapper) {
if (this.distinct && !((DefaultQuery) context.getQuery()).isRemoteQuery() && !context.getCache().getPdxReadSerialized() && (values[i] instanceof PdxInstance)) { values[i] = ((PdxInstance) values[i]).getObject(); if (!((DefaultQuery) context.getQuery()).isRemoteQuery()) { if (this.distinct && values[i] instanceof PdxInstance && !context.getCache().getPdxReadSerialized()) {