Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit be110ee

Browse files
fix: Remove client-side assertion for Union with subcollection and delegate to backend (#2356)
* Remove validation check * allow the subquery test to run in prod env * chore: generate libraries at Mon Apr 13 17:41:06 UTC 2026 --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
1 parent 71eab7b commit be110ee

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

google-cloud-firestore/src/main/java/com/google/cloud/firestore/Pipeline.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,11 +1049,6 @@ public Pipeline sample(Sample sample) {
10491049
* @return A new {@code Pipeline} object with this stage appended to the stage list.
10501050
*/
10511051
public Pipeline union(Pipeline other) {
1052-
if (other.rpcContext == null) {
1053-
throw new IllegalArgumentException(
1054-
"Union only supports combining root pipelines, doesn't support relative scope Pipeline"
1055-
+ " like relative subcollection pipeline");
1056-
}
10571052
return append(new Union(other));
10581053
}
10591054

google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITPipelineSubqueryTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ List<Map<String, Object>> data(List<PipelineResult> results) {
6868
@Before
6969
public void setup() throws Exception {
7070
assumeFalse(
71-
"This test suite only runs against the Enterprise edition in the Nightly environment.",
72-
!getFirestoreEdition().equals(FirestoreEdition.ENTERPRISE)
73-
|| !"NIGHTLY".equals(getTargetBackend()));
71+
"This test suite only runs against the Enterprise edition.",
72+
!getFirestoreEdition().equals(FirestoreEdition.ENTERPRISE));
7473
if (collection != null) {
7574
return;
7675
}
@@ -984,20 +983,20 @@ public void testDirectExecutionOfSubcollectionPipeline() throws Exception {
984983

985984
@Test
986985
public void testUnionWithSubqueryThrows() throws Exception {
987-
IllegalArgumentException e =
986+
ExecutionException e =
988987
assertThrows(
989-
IllegalArgumentException.class,
988+
ExecutionException.class,
990989
() -> {
991990
firestore
992991
.pipeline()
993992
.collection(collection.getPath())
994-
.union(PipelineSource.subcollection("subcollection"));
993+
.union(PipelineSource.subcollection("subcollection"))
994+
.execute()
995+
.get();
995996
});
996997

997-
assertThat(e)
998-
.hasMessageThat()
998+
assertThat(e.getCause().getMessage())
999999
.contains(
1000-
"Union only supports combining root pipelines, doesn't support relative scope Pipeline"
1001-
+ " like relative subcollection pipeline");
1000+
"The 'subcollection(...)' stage can only be used at the start of a nested pipeline.");
10021001
}
10031002
}

0 commit comments

Comments
 (0)