fix: Remove client-side assertion for Union with subcollection and de… · googleapis/java-firestore@be110ee (original) (raw)

File tree

Original file line number Diff line number Diff line change
@@ -1049,11 +1049,6 @@ public Pipeline sample(Sample sample) {
1049 1049 * @return A new {@code Pipeline} object with this stage appended to the stage list.
1050 1050 */
1051 1051 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 - }
1057 1052 return append(new Union(other));
1058 1053 }
1059 1054
Original file line number Diff line number Diff line change
@@ -68,9 +68,8 @@ List<Map<String, Object>> data(List results) {
68 68 @Before
69 69 public void setup() throws Exception {
70 70 assumeFalse(
71 -"This test suite only runs against the Enterprise edition in the Nightly environment.",
72 - !getFirestoreEdition().equals(FirestoreEdition.ENTERPRISE)
73 - |
71 +"This test suite only runs against the Enterprise edition.",
72 + !getFirestoreEdition().equals(FirestoreEdition.ENTERPRISE));
74 73 if (collection != null) {
75 74 return;
76 75 }
@@ -984,20 +983,20 @@ public void testDirectExecutionOfSubcollectionPipeline() throws Exception {
984 983
985 984 @Test
986 985 public void testUnionWithSubqueryThrows() throws Exception {
987 -IllegalArgumentException e =
986 +ExecutionException e =
988 987 assertThrows(
989 -IllegalArgumentException.class,
988 +ExecutionException.class,
990 989 () -> {
991 990 firestore
992 991 .pipeline()
993 992 .collection(collection.getPath())
994 - .union(PipelineSource.subcollection("subcollection"));
993 + .union(PipelineSource.subcollection("subcollection"))
994 + .execute()
995 + .get();
995 996 });
996 997
997 -assertThat(e)
998 - .hasMessageThat()
998 +assertThat(e.getCause().getMessage())
999 999 .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.");
1002 1001 }
1003 1002 }