Skip to content

Conversation

@schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jul 23, 2019

This adds support for Firestore's new IN and ARRAY_CONTAINS_ANY queries.

This can not yet be merged:

  • The underlying Proto change is not public yet (hence the PR won't compile)
  • The backend does not yet support these types of queries (the test won't pass)

This PR is meant to be a reference for other languages.

Port of googleapis/nodejs-firestore#715

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 23, 2019
@schmidt-sebastian schmidt-sebastian added the status: blocked Resolving the issue is dependent on other work. label Jul 23, 2019
@schmidt-sebastian
Copy link
Contributor Author

cc @thebrianchen

Copy link

@thebrianchen thebrianchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, do we need any serialization/deserialization tests for the java sdk?
otherwise, LGTM

@schmidt-sebastian
Copy link
Contributor Author

Just double checking, do we need any serialization/deserialization tests for the java sdk?
otherwise, LGTM

We create the Proto directly via the somewhat hidden whereHelper. The unit tests then confirm that we created the expected request.

@BenWhitehead
Copy link
Contributor

@schmidt-sebastian Can we rebase this and get it fixed up to merge now that the protos are available as of #6479?

@schmidt-sebastian
Copy link
Contributor Author

We can probably launch this as soon as next week. I will rebase the PR on Monday.

@codecov
Copy link

codecov bot commented Oct 28, 2019

Codecov Report

Merging #5803 into master will increase coverage by 0.28%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #5803      +/-   ##
============================================
+ Coverage     46.06%   46.35%   +0.28%     
- Complexity    28002    28021      +19     
============================================
  Files          2613     2613              
  Lines        287940   288087     +147     
  Branches      32912    33778     +866     
============================================
+ Hits         132641   133531     +890     
- Misses       144230   144312      +82     
+ Partials      11069    10244     -825
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/com/google/cloud/firestore/Query.java 91.89% <66.66%> (-0.7%) 101 <4> (+11)
.../cloud/datastore/testing/LocalDatastoreHelper.java 80.59% <0%> (-4.48%) 17% <0%> (ø)
...le/cloud/compute/deprecated/DeprecationStatus.java 88.63% <0%> (-3.13%) 20% <0%> (ø)
...able/gaxx/reframing/ReframingResponseObserver.java 88.99% <0%> (-1.84%) 29% <0%> (-1%)
...le/cloud/storage/contrib/nio/CloudStoragePath.java 75.67% <0%> (-0.69%) 51% <0%> (ø)
...ge/contrib/nio/CloudStorageFileSystemProvider.java 62.76% <0%> (-0.3%) 73% <0%> (ø)
...ain/java/com/google/cloud/logging/LoggingImpl.java 87.9% <0%> (-0.19%) 73% <0%> (ø)
...ain/java/com/google/cloud/storage/StorageImpl.java 76.72% <0%> (-0.16%) 114% <0%> (+6%)
...m/google/cloud/spanner/jdbc/JdbcTypeConverter.java 74.86% <0%> (-0.14%) 88% <0%> (ø)
...oogle/cloud/spanner/jdbc/JdbcDatabaseMetaData.java 87.67% <0%> (-0.13%) 165% <0%> (ø)
... and 179 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3157b23...0a631c7. Read the comment docs.

@BenWhitehead
Copy link
Contributor

@schmidt-sebastian The two new integration tests are failing with assertion errors. Does the integration test project need to be given explicit access for these to pass?

@schmidt-sebastian
Copy link
Contributor Author

@schmidt-sebastian The two new integration tests are failing with assertion errors. Does the integration test project need to be given explicit access for these to pass?

No, they just have never been run and are buggy. I am updating them right now, and will also fix one incompatibility with Java 7 that we just noticed on Android.

@schmidt-sebastian
Copy link
Contributor Author

I updated the PR, it should now be in a good state. At first, we wanted to add a varargs method, but we noticed that it break when a user calls Query.whereIn(field, null) since Java 7 picks the wrong overload (@NunNull List<> is preferred). We decided to punt on this for now and may add the overloads later if requested.

Copy link
Contributor

@BenWhitehead BenWhitehead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is a compiler error due to in incorrect variable name

[ERROR] /tmp/src/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java:[632,85] cannot find symbol
[ERROR]   symbol:   variable value
[ERROR]   location: class com.google.cloud.firestore.Query

schmidt-sebastian and others added 3 commits October 29, 2019 12:59
…google/cloud/firestore/Query.java

Co-Authored-By: BenWhitehead <BenWhitehead@users.noreply.github.com>
@schmidt-sebastian schmidt-sebastian removed the status: blocked Resolving the issue is dependent on other work. label Oct 29, 2019
@schmidt-sebastian schmidt-sebastian changed the title Firestore: Add support for IN Queries (blocked) Firestore: Add support for IN Queries Oct 29, 2019
@BenWhitehead BenWhitehead merged commit bead76a into master Oct 30, 2019
@BenWhitehead BenWhitehead deleted the mrschmidt/inqueries branch October 30, 2019 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants