/** {@inheritDoc} */ @Override public SqlQuery<K, V> setPageSize(int pageSize) { return (SqlQuery<K, V>)super.setPageSize(pageSize); }
/** * Runs specified query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformQueryCursor runQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize(): Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
/** {@inheritDoc} */ @Override public TextQuery<K, V> setLocal(boolean loc) { return (TextQuery<K, V>)super.setLocal(loc); }
/** {@inheritDoc} */ @Override public <T, R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T, R> transformer) { GridCacheContext<K, V> ctx = getContextSafe(); A.notNull(qry, "qry"); A.notNull(transformer, "transformer"); if (!(qry instanceof ScanQuery)) throw new UnsupportedOperationException("Transformers are supported only for SCAN queries."); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); return query((ScanQuery<K, V>)qry, transformer, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e); } }
/** * Prepares the partitions. * * @param parts Partitions. */ protected int[] prepare(int[] parts) { if (parts == null) return null; A.notEmpty(parts, "Partitions"); boolean sorted = true; // Try to do validation in one pass, if array is already sorted. for (int i = 0; i < parts.length; i++) { if (i < parts.length - 1) if (parts[i] > parts[i + 1]) sorted = false; else if (sorted) validateDups(parts[i], parts[i + 1]); A.ensure(0 <= parts[i] && parts[i] < CacheConfiguration.MAX_PARTITIONS_COUNT, "Illegal partition"); } // Sort and validate again. if (!sorted) { Arrays.sort(parts); for (int i = 0; i < parts.length; i++) { if (i < parts.length - 1) validateDups(parts[i], parts[i + 1]); } } return parts; }
/** {@inheritDoc} */ @Override public <R> QueryCursor<R> query(Query<R> qry) { GridCacheContext<K, V> ctx = getContextSafe(); A.notNull(qry, "qry"); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); convertToBinary(qry); CacheOperationContext opCtxCall = ctx.operationContextPerCall(); boolean keepBinary = opCtxCall != null && opCtxCall.isKeepBinary(); if (qry instanceof ContinuousQuery || qry instanceof ContinuousQueryWithTransformer) return (QueryCursor<R>)queryContinuous((AbstractContinuousQuery)qry, qry.isLocal(), keepBinary); if (qry instanceof SqlQuery) return (QueryCursor<R>)ctx.kernalContext().query().querySql(ctx, (SqlQuery)qry, keepBinary); if (qry instanceof SqlFieldsQuery) return (FieldsQueryCursor<R>)ctx.kernalContext().query().querySqlFields(ctx, (SqlFieldsQuery)qry, null, keepBinary, true).get(0); if (qry instanceof ScanQuery) return query((ScanQuery)qry, null, projection(qry.isLocal())); return (QueryCursor<R>)query(qry, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e.getMessage(), e); } }
/** * Prepares the partitions. * * @param parts Partitions. */ protected int[] prepare(int[] parts) { if (parts == null) return null; A.notEmpty(parts, "Partitions"); boolean sorted = true; // Try to do validation in one pass, if array is already sorted. for (int i = 0; i < parts.length; i++) { if (i < parts.length - 1) if (parts[i] > parts[i + 1]) sorted = false; else if (sorted) validateDups(parts[i], parts[i + 1]); A.ensure(0 <= parts[i] && parts[i] < CacheConfiguration.MAX_PARTITIONS_COUNT, "Illegal partition"); } // Sort and validate again. if (!sorted) { Arrays.sort(parts); for (int i = 0; i < parts.length; i++) { if (i < parts.length - 1) validateDups(parts[i], parts[i + 1]); } } return parts; }
/** {@inheritDoc} */ @Override public TextQuery<K, V> setPageSize(int pageSize) { return (TextQuery<K, V>)super.setPageSize(pageSize); }
/** {@inheritDoc} */ @Override public SqlFieldsQuery setLocal(boolean loc) { return (SqlFieldsQuery)super.setLocal(loc); }
/** * Runs specified fields query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformFieldsQueryCursor runFieldsQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformFieldsQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize() : Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
/** {@inheritDoc} */ @Override public <T, R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T, R> transformer) { A.notNull(qry, "qry"); A.notNull(transformer, "transformer"); if (!(qry instanceof ScanQuery)) throw new UnsupportedOperationException("Transformers are supported only for SCAN queries."); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); return query((ScanQuery<K, V>)qry, transformer, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e); } }
/** {@inheritDoc} */ @Override public ScanQuery<K, V> setPageSize(int pageSize) { return (ScanQuery<K, V>)super.setPageSize(pageSize); }
/** {@inheritDoc} */ @Override public SpiQuery<K, V> setLocal(boolean loc) { return (SpiQuery<K, V>)super.setLocal(loc); }
return null; }, initialQry.getPageSize() > 0 ? initialQry.getPageSize() : Query.DFLT_PAGE_SIZE);
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public <R> QueryCursor<R> query(Query<R> qry) { A.notNull(qry, "qry"); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); convertToBinary(qry); CacheOperationContext opCtxCall = ctx.operationContextPerCall(); boolean keepBinary = opCtxCall != null && opCtxCall.isKeepBinary(); if (qry instanceof ContinuousQuery || qry instanceof ContinuousQueryWithTransformer) return (QueryCursor<R>)queryContinuous((AbstractContinuousQuery)qry, qry.isLocal(), keepBinary); if (qry instanceof SqlQuery) return (QueryCursor<R>)ctx.kernalContext().query().querySql(ctx, (SqlQuery)qry, keepBinary); if (qry instanceof SqlFieldsQuery) return (FieldsQueryCursor<R>)ctx.kernalContext().query().querySqlFields(ctx, (SqlFieldsQuery)qry, null, keepBinary, true).get(0); if (qry instanceof ScanQuery) return query((ScanQuery)qry, null, projection(qry.isLocal())); return (QueryCursor<R>)query(qry, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e.getMessage(), e); } }
/** {@inheritDoc} */ @Override public SpiQuery<K, V> setPageSize(int pageSize) { return (SpiQuery<K, V>)super.setPageSize(pageSize); }
/** {@inheritDoc} */ @Override public ScanQuery<K, V> setLocal(boolean loc) { return (ScanQuery<K, V>)super.setLocal(loc); }
/** * Runs specified query. * * @param qry Query. * @return Query cursor. * @throws IgniteCheckedException On error. */ private PlatformQueryCursor runQuery(Query qry) throws IgniteCheckedException { try { QueryCursorEx cursor = (QueryCursorEx) cache.query(qry); return new PlatformQueryCursor(platformCtx, cursor, qry.getPageSize() > 0 ? qry.getPageSize(): Query.DFLT_PAGE_SIZE); } catch (Exception err) { throw PlatformUtils.unwrapQueryException(err); } }
/** {@inheritDoc} */ @Override public SqlFieldsQuery setPageSize(int pageSize) { return (SqlFieldsQuery)super.setPageSize(pageSize); }
/** {@inheritDoc} */ @Override public SqlQuery<K, V> setLocal(boolean loc) { return (SqlQuery<K, V>)super.setLocal(loc); }