@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.datastore.v1.Query)) { return super.equals(obj); } com.google.datastore.v1.Query other = (com.google.datastore.v1.Query) obj; boolean result = true; result = result && getProjectionList().equals(other.getProjectionList()); result = result && getKindList().equals(other.getKindList()); result = result && (hasFilter() == other.hasFilter()); if (hasFilter()) { result = result && getFilter().equals(other.getFilter()); } result = result && getOrderList().equals(other.getOrderList()); result = result && getDistinctOnList().equals(other.getDistinctOnList()); result = result && getStartCursor().equals(other.getStartCursor()); result = result && getEndCursor().equals(other.getEndCursor()); result = result && (getOffset() == other.getOffset()); result = result && (hasLimit() == other.hasLimit()); if (hasLimit()) { result = result && getLimit().equals(other.getLimit()); } result = result && unknownFields.equals(other.unknownFields); return result; }
setOffset(other.getOffset()); if (other.hasLimit()) { mergeLimit(other.getLimit());
hash = (37 * hash) + OFFSET_FIELD_NUMBER; hash = (53 * hash) + getOffset(); if (hasLimit()) { hash = (37 * hash) + LIMIT_FIELD_NUMBER; hash = (53 * hash) + getLimit().hashCode();
if (queryPb.hasLimit()) { setLimit(queryPb.getLimit().getValue());
@ProcessElement public void processElement(ProcessContext c) throws Exception { Query query = c.element(); // If query has a user set limit, then do not split. if (query.hasLimit()) { c.output(query); return; } int estimatedNumSplits; // Compute the estimated numSplits if numSplits is not specified by the user. if (numSplits <= 0) { estimatedNumSplits = getEstimatedNumSplits(datastore, query, options.getNamespace()); } else { estimatedNumSplits = numSplits; } LOG.info("Splitting the query into {} splits", estimatedNumSplits); List<Query> querySplits; try { querySplits = splitQuery( query, options.getNamespace(), datastore, querySplitter, estimatedNumSplits); } catch (Exception e) { LOG.warn("Unable to parallelize the given query: {}", query, e); querySplits = ImmutableList.of(query); } // assign unique keys to query splits. for (Query subquery : querySplits) { c.output(subquery); } }
/** * Returns a new {@link DatastoreV1.Read} that reads the results of the specified query. * * <p><b>Note:</b> Normally, {@code DatastoreIO} will read from Cloud Datastore in parallel * across many workers. However, when the {@link Query} is configured with a limit using {@link * Query.Builder#setLimit}, then all results will be read by a single worker in order to ensure * correct results. */ public DatastoreV1.Read withQuery(Query query) { checkArgument(query != null, "query can not be null"); checkArgument( !query.hasLimit() || query.getLimit().getValue() > 0, "Invalid query limit %s: must be positive", query.getLimit().getValue()); return toBuilder().setQuery(query).build(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.datastore.v1.Query)) { return super.equals(obj); } com.google.datastore.v1.Query other = (com.google.datastore.v1.Query) obj; boolean result = true; result = result && getProjectionList().equals(other.getProjectionList()); result = result && getKindList().equals(other.getKindList()); result = result && (hasFilter() == other.hasFilter()); if (hasFilter()) { result = result && getFilter().equals(other.getFilter()); } result = result && getOrderList().equals(other.getOrderList()); result = result && getDistinctOnList().equals(other.getDistinctOnList()); result = result && getStartCursor().equals(other.getStartCursor()); result = result && getEndCursor().equals(other.getEndCursor()); result = result && (getOffset() == other.getOffset()); result = result && (hasLimit() == other.hasLimit()); if (hasLimit()) { result = result && getLimit().equals(other.getLimit()); } result = result && unknownFields.equals(other.unknownFields); return result; }
setOffset(other.getOffset()); if (other.hasLimit()) { mergeLimit(other.getLimit());
setOffset(other.getOffset()); if (other.hasLimit()) { mergeLimit(other.getLimit());
hash = (37 * hash) + OFFSET_FIELD_NUMBER; hash = (53 * hash) + getOffset(); if (hasLimit()) { hash = (37 * hash) + LIMIT_FIELD_NUMBER; hash = (53 * hash) + getLimit().hashCode();
hash = (37 * hash) + OFFSET_FIELD_NUMBER; hash = (53 * hash) + getOffset(); if (hasLimit()) { hash = (37 * hash) + LIMIT_FIELD_NUMBER; hash = (53 * hash) + getLimit().hashCode();
if (queryPb.hasLimit()) { setLimit(queryPb.getLimit().getValue());