yixiaoshen commented on code in PR #22175:
URL: https://github.com/apache/beam/pull/22175#discussion_r915278107
##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreV1FnRunQueryTest.java:
##########
@@ -117,65 +119,62 @@ public void resumeFromLastReadValue() throws Exception {
.setStartAt(
Cursor.newBuilder()
.setBefore(false)
-
.addValues(Value.newBuilder().setStringValue("bar"))))
+
.addValues(Value.newBuilder().setStringValue("bar"))
+ .addValues(
+ Value.newBuilder()
+
.setReferenceValue(testData.response2.getDocument().getName()))
+ )
+ .addOrderBy(
+ Order.newBuilder()
+
.setField(FieldReference.newBuilder().setFieldPath("__name__"))
+ .setDirection(Direction.ASCENDING))
+ )
.build();
- List<RunQueryResponse> responses =
- ImmutableList.of(testData.response1, testData.response2,
testData.response3);
- when(responseStream1.iterator())
- .thenReturn(
- new AbstractIterator<RunQueryResponse>() {
- private int invocationCount = 1;
-
- @Override
- protected RunQueryResponse computeNext() {
- int count = invocationCount++;
- if (count == 1) {
- return responses.get(0);
- } else if (count == 2) {
- return responses.get(1);
- } else {
- throw RETRYABLE_ERROR;
- }
- }
- });
-
- when(callable.call(testData.request)).thenReturn(responseStream1);
- doNothing().when(attempt).checkCanRetry(any(), eq(RETRYABLE_ERROR));
-
when(responseStream2.iterator()).thenReturn(ImmutableList.of(responses.get(2)).iterator());
- when(callable.call(request2)).thenReturn(responseStream2);
-
- when(stub.runQueryCallable()).thenReturn(callable);
-
- when(ff.getFirestoreStub(any())).thenReturn(stub);
- when(ff.getRpcQos(any())).thenReturn(rpcQos);
- when(rpcQos.newReadAttempt(any())).thenReturn(attempt);
- when(attempt.awaitSafeToProceed(any())).thenReturn(true);
-
- ArgumentCaptor<RunQueryResponse> responsesCaptor =
- ArgumentCaptor.forClass(RunQueryResponse.class);
-
- doNothing().when(processContext).output(responsesCaptor.capture());
-
- when(processContext.element()).thenReturn(testData.request);
-
- RunQueryFn fn = new RunQueryFn(clock, ff, rpcQosOptions);
-
- runFunction(fn);
+ runQueryRetryTest(testData, expectedRetryRequest);
+ }
- List<RunQueryResponse> allValues = responsesCaptor.getAllValues();
- assertEquals(responses, allValues);
+ @Test
+ public void resumeFromLastReadValue_nestedOrderBy() throws Exception {
Review Comment:
oh I didn't think about this case (that a back ticked field name is inside a
nested map), I don't know what the code is going to do but seems that it's
handling it just fine?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]