/** Serialize SQL field query to stream. */ void write(SqlFieldsQuery qry, BinaryOutputStream out) { writeObject(out, qry.getSchema()); out.writeInt(qry.getPageSize()); out.writeInt(-1); // do not limit writeObject(out, qry.getSql()); ClientUtils.collection(qry.getArgs() == null ? null : Arrays.asList(qry.getArgs()), out, this::writeObject); out.writeByte((byte)0); // statement type ANY out.writeBoolean(qry.isDistributedJoins()); out.writeBoolean(qry.isLocal()); out.writeBoolean(qry.isReplicatedOnly()); out.writeBoolean(qry.isEnforceJoinOrder()); out.writeBoolean(qry.isCollocated()); out.writeBoolean(qry.isLazy()); out.writeLong(qry.getTimeout()); out.writeBoolean(true); // include column names }
/** * Validate SQL fields query. * * @param qry Query. * @param ctx Kernal context. * @param cctx Cache context. */ private static void validateSqlFieldsQuery(SqlFieldsQuery qry, GridKernalContext ctx, @Nullable GridCacheContext<?, ?> cctx) { if (qry.isReplicatedOnly() && qry.getPartitions() != null) throw new CacheException("Partitions are not supported in replicated only mode."); if (qry.isDistributedJoins() && qry.getPartitions() != null) throw new CacheException("Using both partitions and distributed JOINs is not supported for the same query"); if (qry.isLocal() && ctx.clientNode() && (cctx == null || cctx.config().getCacheMode() != CacheMode.LOCAL)) throw new CacheException("Execution of local SqlFieldsQuery on client node disallowed."); }
/** Serialize SQL field query to stream. */ void write(SqlFieldsQuery qry, BinaryOutputStream out) { writeObject(out, qry.getSchema()); out.writeInt(qry.getPageSize()); out.writeInt(-1); // do not limit writeObject(out, qry.getSql()); ClientUtils.collection(qry.getArgs() == null ? null : Arrays.asList(qry.getArgs()), out, this::writeObject); out.writeByte((byte)0); // statement type ANY out.writeBoolean(qry.isDistributedJoins()); out.writeBoolean(qry.isLocal()); out.writeBoolean(qry.isReplicatedOnly()); out.writeBoolean(qry.isEnforceJoinOrder()); out.writeBoolean(qry.isCollocated()); out.writeBoolean(qry.isLazy()); out.writeLong(qry.getTimeout()); out.writeBoolean(true); // include column names }
loc = parser.isLocalQuery(qry.isReplicatedOnly());