Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-c.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-DFIRESTORE_EDITION=standard"
value: "-DFIRESTORE_NAMED_DATABASE=enterprise -DFIRESTORE_EDITION=enterprise"
}

# TODO: remove this after we've migrated all tests and scripts
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-c.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-DFIRESTORE_EDITION=standard"
value: "-DFIRESTORE_NAMED_DATABASE=enterprise -DFIRESTORE_EDITION=enterprise"
}

env_vars: {
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/integration-named-db.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-DFIRESTORE_NAMED_DATABASE=test-db -DFIRESTORE_EDITION=standard"
value: "-DFIRESTORE_NAMED_DATABASE=enterprise -DFIRESTORE_EDITION=enterprise"
}

env_vars: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.firestore;

import static com.google.cloud.firestore.pipeline.expressions.Expression.and;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METHOD_NAME_RUN_AGGREGATION_QUERY;
import static com.google.cloud.firestore.telemetry.TraceUtil.ATTRIBUTE_KEY_ATTEMPT;

Expand All @@ -29,7 +28,6 @@
import com.google.api.gax.rpc.StreamController;
import com.google.cloud.Timestamp;
import com.google.cloud.firestore.pipeline.expressions.AliasedAggregate;
import com.google.cloud.firestore.pipeline.expressions.BooleanExpression;
import com.google.cloud.firestore.telemetry.MetricsUtil.MetricsContext;
import com.google.cloud.firestore.telemetry.TelemetryConstants;
import com.google.cloud.firestore.telemetry.TelemetryConstants.MetricType;
Expand All @@ -53,7 +51,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -90,22 +87,6 @@ public Query getQuery() {

Pipeline pipeline() {
Pipeline pipeline = getQuery().pipeline();

List<BooleanExpression> existsExprs =
this.aggregateFieldList.stream()
.map(PipelineUtils::toPipelineExistsExpr)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (existsExprs.size() == 1) {
pipeline = pipeline.where(existsExprs.get(0));
} else if (existsExprs.size() > 1) {
pipeline =
pipeline.where(
and(
existsExprs.get(0),
existsExprs.subList(1, existsExprs.size()).toArray(new BooleanExpression[0])));
}

return pipeline.aggregate(
this.aggregateFieldList.stream()
.map(PipelineUtils::toPipelineAggregatorTarget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1161,15 +1161,20 @@ public void testLogicalAndComparisonOperators() throws Exception {
.pipeline()
.createFrom(collection)
.where(
Expression.notEqualAny("genre", Lists.newArrayList("Romance", "Dystopian", null)))
Expression.notEqualAny(
"genre", Lists.newArrayList("Science Fiction", "Romance", "Dystopian", null)))
.select("genre")
.distinct("genre")
.execute()
.get()
.getResults();
assertThat(data(results))
.containsExactly(
map("genre", "Science Fiction"),
// This is somewhat surprising because the pipeline did ask specifically for genre not
// equal to null,
// however at the later distinct stage, UNSET is grouped as null and thus null appears
// in the result.
map("genre", null),
map("genre", "Magical Realism"),
map("genre", "Fantasy"),
map("genre", "Psychological Thriller"),
Expand Down Expand Up @@ -1236,10 +1241,9 @@ public void testChecks() throws Exception {
.select(
field("rating").equal(nullValue()).as("ratingIsNull"),
field("rating").equal(Double.NaN).as("ratingIsNaN"),
// arrayGet("title", 0) evaluates to UNSET
arrayGet("title", 0).isError().as("isError"),
arrayGet("title", 0)
.ifError(constant("was error"), constant("was not error"))
.as("ifError"),
arrayGet("title", 0).ifError(constant("was error")).as("ifError"),
field("foo").isAbsent().as("isAbsent"),
field("title").notEqual(nullValue()).as("titleIsNotNull"),
field("cost").notEqual(Double.NaN).as("costIsNotNan"),
Expand All @@ -1259,8 +1263,6 @@ public void testChecks() throws Exception {
false,
"isError",
false,
"ifError",
"was not error",
"isAbsent",
true,
"titleIsNotNull",
Expand Down
Loading
Loading