public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); }
public static Builder newBuilder(com.google.datastore.v1.Query prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
subBuilder = query_.toBuilder();
subBuilder = ((com.google.datastore.v1.Query) queryType_).toBuilder();
public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.datastore.v1.Query prototype) {
public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); }
public static Builder newBuilder(com.google.datastore.v1.Query prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
public static Builder newBuilder(com.google.datastore.v1.Query prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
Query translatedQuery = translateGqlQuery(gqlQueryWithZeroLimit, datastore, namespace); return translatedQuery.toBuilder().clearLimit().build(); } catch (DatastoreException e) {
subBuilder = query_.toBuilder();
com.google.datastore.v1.Query.Builder subBuilder = null; if (query_ != null) { subBuilder = query_.toBuilder();
subBuilder = ((com.google.datastore.v1.Query) queryType_).toBuilder();
com.google.datastore.v1.Query.Builder subBuilder = null; if (queryTypeCase_ == 3) { subBuilder = ((com.google.datastore.v1.Query) queryType_).toBuilder();
/** Tests {@link DatastoreV1.Read.SplitQueryFn} when the query has a user specified limit. */ @Test public void testSplitQueryFnWithQueryLimit() throws Exception { Query queryWithLimit = QUERY.toBuilder().setLimit(Int32Value.newBuilder().setValue(1)).build(); SplitQueryFn splitQueryFn = new SplitQueryFn(V_1_OPTIONS, 10, mockDatastoreFactory); DoFnTester<Query, Query> doFnTester = DoFnTester.of(splitQueryFn); doFnTester.setCloningBehavior(CloningBehavior.DO_NOT_CLONE); List<Query> queries = doFnTester.processBundle(queryWithLimit); assertEquals(1, queries.size()); verifyNoMoreInteractions(mockDatastore); verifyNoMoreInteractions(mockQuerySplitter); }
private Iterator<EntityResult> getIteratorAndMoveCursor() throws DatastoreException { Query.Builder query = this.query.toBuilder(); query.setLimit(Int32Value.newBuilder().setValue(QUERY_BATCH_LIMIT)); if (currentBatch != null && !currentBatch.getEndCursor().isEmpty()) { query.setStartCursor(currentBatch.getEndCursor()); } RunQueryRequest request = makeRequest(query.build(), namespace); RunQueryResponse response = datastore.runQuery(request); currentBatch = response.getBatch(); int numFetch = currentBatch.getEntityResultsCount(); // All indications from the API are that there are/may be more results. moreResults = ((numFetch == QUERY_BATCH_LIMIT) || (currentBatch.getMoreResults() == NOT_FINISHED)); // May receive a batch of 0 results if the number of records is a multiple // of the request limit. if (numFetch == 0) { return null; } return currentBatch.getEntityResultsList().iterator(); } }
Query.Builder queryBuilder = query.toBuilder(); queryBuilder.setLimit( Int32Value.newBuilder().setValue(Math.min(userLimit, QUERY_BATCH_LIMIT)));