From 954320aaefec249c77c757a1610727519a4029bd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 17 Aug 2023 12:07:17 +0530 Subject: [PATCH] feat: publish proto definitions for SUM/AVG in Datastore (#1157) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: publish proto definitions for SUM/AVG in Datastore PiperOrigin-RevId: 552847139 Source-Link: https://github.com/googleapis/googleapis/commit/6148e5b6f91abc8d2f6e246e9608bf92ffb408bd Source-Link: https://github.com/googleapis/googleapis-gen/commit/96be51b995047bfdef4825178539e238583101a9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTZiZTUxYjk5NTA0N2JmZGVmNDgyNTE3ODUzOWUyMzg1ODMxMDFhOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../google/datastore/v1/AggregationQuery.java | 3454 ++++++++++++++--- .../google/datastore/v1/PropertyFilter.java | 18 +- .../com/google/datastore/v1/QueryProto.java | 155 +- .../com/google/datastore/v1/ReadOptions.java | 108 +- .../datastore/v1/ReadOptionsOrBuilder.java | 27 +- .../datastore/v1/TransactionOptions.java | 75 +- .../proto/google/datastore/v1/datastore.proto | 14 +- .../proto/google/datastore/v1/query.proto | 57 +- 8 files changed, 3147 insertions(+), 761 deletions(-) diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java index 391b9a2b9..762c9713c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java @@ -103,6 +103,76 @@ public interface AggregationOrBuilder */ com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder getCountOrBuilder(); + /** + * + * + *
+     * Sum aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + * + * @return Whether the sum field is set. + */ + boolean hasSum(); + /** + * + * + *
+     * Sum aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + * + * @return The sum. + */ + com.google.datastore.v1.AggregationQuery.Aggregation.Sum getSum(); + /** + * + * + *
+     * Sum aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder getSumOrBuilder(); + + /** + * + * + *
+     * Average aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; + * + * @return Whether the avg field is set. + */ + boolean hasAvg(); + /** + * + * + *
+     * Average aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; + * + * @return The avg. + */ + com.google.datastore.v1.AggregationQuery.Aggregation.Avg getAvg(); + /** + * + * + *
+     * Average aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; + */ + com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder getAvgOrBuilder(); + /** * * @@ -1279,744 +1349,2879 @@ public com.google.protobuf.Parser getParserForType() { } } - private int operatorCase_ = 0; - - @SuppressWarnings("serial") - private java.lang.Object operator_; - - public enum OperatorCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - COUNT(1), - OPERATOR_NOT_SET(0); - private final int value; + public interface SumOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.datastore.v1.AggregationQuery.Aggregation.Sum) + com.google.protobuf.MessageOrBuilder { - private OperatorCase(int value) { - this.value = value; - } /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return Whether the property field is set. */ - @java.lang.Deprecated - public static OperatorCase valueOf(int value) { - return forNumber(value); - } - - public static OperatorCase forNumber(int value) { - switch (value) { - case 1: - return COUNT; - case 0: - return OPERATOR_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public OperatorCase getOperatorCase() { - return OperatorCase.forNumber(operatorCase_); + boolean hasProperty(); + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return The property. + */ + com.google.datastore.v1.PropertyReference getProperty(); + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + com.google.datastore.v1.PropertyReferenceOrBuilder getPropertyOrBuilder(); } - - public static final int COUNT_FIELD_NUMBER = 1; /** * * *
-     * Count aggregator.
-     * 
- * - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; - * - * @return Whether the count field is set. - */ - @java.lang.Override - public boolean hasCount() { - return operatorCase_ == 1; - } - /** + * Sum of the values of the requested property. * + * * Only numeric values will be aggregated. All non-numeric values + * including `NULL` are skipped. * - *
-     * Count aggregator.
-     * 
- * - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * * If the aggregated values contain `NaN`, returns `NaN`. Infinity math + * follows IEEE-754 standards. * - * @return The count. - */ - @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation.Count getCount() { - if (operatorCase_ == 1) { - return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; - } - return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); - } - /** + * * If the aggregated value set is empty, returns 0. * + * * Returns a 64-bit integer if all aggregated numbers are integers and the + * sum result does not overflow. Otherwise, the result is returned as a + * double. Note that even if all the aggregated values are integers, the + * result is returned as a double if it cannot fit within a 64-bit signed + * integer. When this occurs, the returned value will lose precision. * - *
-     * Count aggregator.
+     * * When underflow occurs, floating-point aggregation is non-deterministic.
+     * This means that running the same query repeatedly without any changes to
+     * the underlying values could produce slightly different results each
+     * time. In those cases, values should be stored as integers over
+     * floating-point numbers.
      * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * Protobuf type {@code google.datastore.v1.AggregationQuery.Aggregation.Sum} */ - @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder getCountOrBuilder() { - if (operatorCase_ == 1) { - return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + public static final class Sum extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.datastore.v1.AggregationQuery.Aggregation.Sum) + SumOrBuilder { + private static final long serialVersionUID = 0L; + // Use Sum.newBuilder() to construct. + private Sum(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); } - return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); - } - public static final int ALIAS_FIELD_NUMBER = 7; + private Sum() {} - @SuppressWarnings("serial") - private volatile java.lang.Object alias_ = ""; - /** - * - * - *
-     * Optional. Optional name of the property to store the result of the
-     * aggregation.
-     *
-     * If not provided, Datastore will pick a default name following the format
-     * `property_<incremental_id++>`. For example:
-     *
-     * ```
-     * AGGREGATE
-     *   COUNT_UP_TO(1) AS count_up_to_1,
-     *   COUNT_UP_TO(2),
-     *   COUNT_UP_TO(3) AS count_up_to_3,
-     *   COUNT(*)
-     * OVER (
-     *   ...
-     * );
-     * ```
-     *
-     * becomes:
-     *
-     * ```
-     * AGGREGATE
-     *   COUNT_UP_TO(1) AS count_up_to_1,
-     *   COUNT_UP_TO(2) AS property_1,
-     *   COUNT_UP_TO(3) AS count_up_to_3,
-     *   COUNT(*) AS property_2
-     * OVER (
-     *   ...
-     * );
-     * ```
-     *
-     * Requires:
-     *
-     * * Must be unique across all aggregation aliases.
-     * * Conform to [entity property
-     * name][google.datastore.v1.Entity.properties] limitations.
-     * 
- * - * string alias = 7 [(.google.api.field_behavior) = OPTIONAL]; - * - * @return The alias. - */ - @java.lang.Override - public java.lang.String getAlias() { - java.lang.Object ref = alias_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - alias_ = s; - return s; + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Sum(); } - } - /** - * - * - *
-     * Optional. Optional name of the property to store the result of the
-     * aggregation.
-     *
-     * If not provided, Datastore will pick a default name following the format
-     * `property_<incremental_id++>`. For example:
-     *
-     * ```
-     * AGGREGATE
-     *   COUNT_UP_TO(1) AS count_up_to_1,
-     *   COUNT_UP_TO(2),
-     *   COUNT_UP_TO(3) AS count_up_to_3,
-     *   COUNT(*)
-     * OVER (
-     *   ...
-     * );
-     * ```
-     *
-     * becomes:
-     *
-     * ```
-     * AGGREGATE
-     *   COUNT_UP_TO(1) AS count_up_to_1,
-     *   COUNT_UP_TO(2) AS property_1,
-     *   COUNT_UP_TO(3) AS count_up_to_3,
-     *   COUNT(*) AS property_2
-     * OVER (
-     *   ...
-     * );
-     * ```
-     *
-     * Requires:
-     *
-     * * Must be unique across all aggregation aliases.
-     * * Conform to [entity property
-     * name][google.datastore.v1.Entity.properties] limitations.
-     * 
- * - * string alias = 7 [(.google.api.field_behavior) = OPTIONAL]; - * - * @return The bytes for alias. - */ - @java.lang.Override - public com.google.protobuf.ByteString getAliasBytes() { - java.lang.Object ref = alias_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - alias_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_descriptor; } - } - private byte memoizedIsInitialized = -1; + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.class, + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder.class); + } - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + public static final int PROPERTY_FIELD_NUMBER = 1; + private com.google.datastore.v1.PropertyReference property_; + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return Whether the property field is set. + */ + @java.lang.Override + public boolean hasProperty() { + return property_ != null; + } + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return The property. + */ + @java.lang.Override + public com.google.datastore.v1.PropertyReference getProperty() { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + @java.lang.Override + public com.google.datastore.v1.PropertyReferenceOrBuilder getPropertyOrBuilder() { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } - memoizedIsInitialized = 1; - return true; - } + private byte memoizedIsInitialized = -1; - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (operatorCase_ == 1) { - output.writeMessage( - 1, (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_); + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alias_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 7, alias_); + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (property_ != null) { + output.writeMessage(1, getProperty()); + } + getUnknownFields().writeTo(output); } - getUnknownFields().writeTo(output); - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; - size = 0; - if (operatorCase_ == 1) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 1, (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alias_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, alias_); + size = 0; + if (property_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProperty()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.datastore.v1.AggregationQuery.Aggregation.Sum)) { + return super.equals(obj); + } + com.google.datastore.v1.AggregationQuery.Aggregation.Sum other = + (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) obj; + + if (hasProperty() != other.hasProperty()) return false; + if (hasProperty()) { + if (!getProperty().equals(other.getProperty())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } - if (!(obj instanceof com.google.datastore.v1.AggregationQuery.Aggregation)) { - return super.equals(obj); - } - com.google.datastore.v1.AggregationQuery.Aggregation other = - (com.google.datastore.v1.AggregationQuery.Aggregation) obj; - if (!getAlias().equals(other.getAlias())) return false; - if (!getOperatorCase().equals(other.getOperatorCase())) return false; - switch (operatorCase_) { - case 1: - if (!getCount().equals(other.getCount())) return false; - break; - case 0: - default: + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasProperty()) { + hash = (37 * hash) + PROPERTY_FIELD_NUMBER; + hash = (53 * hash) + getProperty().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + ALIAS_FIELD_NUMBER; - hash = (53 * hash) + getAlias().hashCode(); - switch (operatorCase_) { - case 1: - hash = (37 * hash) + COUNT_FIELD_NUMBER; - hash = (53 * hash) + getCount().hashCode(); - break; - case 0: - default: + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } - public static com.google.datastore.v1.AggregationQuery.Aggregation parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - com.google.datastore.v1.AggregationQuery.Aggregation prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-     * Defines an aggregation that produces a single result.
-     * 
- * - * Protobuf type {@code google.datastore.v1.AggregationQuery.Aggregation} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.datastore.v1.AggregationQuery.Aggregation) - com.google.datastore.v1.AggregationQuery.AggregationOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.datastore.v1.QueryProto - .internal_static_google_datastore_v1_AggregationQuery_Aggregation_descriptor; + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.datastore.v1.QueryProto - .internal_static_google_datastore_v1_AggregationQuery_Aggregation_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.datastore.v1.AggregationQuery.Aggregation.class, - com.google.datastore.v1.AggregationQuery.Aggregation.Builder.class); + public Builder newBuilderForType() { + return newBuilder(); } - // Construct using com.google.datastore.v1.AggregationQuery.Aggregation.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (countBuilder_ != null) { - countBuilder_.clear(); - } - alias_ = ""; - operatorCase_ = 0; - operator_ = null; - return this; + public static Builder newBuilder( + com.google.datastore.v1.AggregationQuery.Aggregation.Sum prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.datastore.v1.QueryProto - .internal_static_google_datastore_v1_AggregationQuery_Aggregation_descriptor; + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation getDefaultInstanceForType() { - return com.google.datastore.v1.AggregationQuery.Aggregation.getDefaultInstance(); + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; } + /** + * + * + *
+       * Sum of the values of the requested property.
+       *
+       * * Only numeric values will be aggregated. All non-numeric values
+       * including `NULL` are skipped.
+       *
+       * * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
+       * follows IEEE-754 standards.
+       *
+       * * If the aggregated value set is empty, returns 0.
+       *
+       * * Returns a 64-bit integer if all aggregated numbers are integers and the
+       * sum result does not overflow. Otherwise, the result is returned as a
+       * double. Note that even if all the aggregated values are integers, the
+       * result is returned as a double if it cannot fit within a 64-bit signed
+       * integer. When this occurs, the returned value will lose precision.
+       *
+       * * When underflow occurs, floating-point aggregation is non-deterministic.
+       * This means that running the same query repeatedly without any changes to
+       * the underlying values could produce slightly different results each
+       * time. In those cases, values should be stored as integers over
+       * floating-point numbers.
+       * 
+ * + * Protobuf type {@code google.datastore.v1.AggregationQuery.Aggregation.Sum} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.datastore.v1.AggregationQuery.Aggregation.Sum) + com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_descriptor; + } - @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation build() { - com.google.datastore.v1.AggregationQuery.Aggregation result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.class, + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder.class); } - return result; - } - @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation buildPartial() { - com.google.datastore.v1.AggregationQuery.Aggregation result = - new com.google.datastore.v1.AggregationQuery.Aggregation(this); - if (bitField0_ != 0) { - buildPartial0(result); + // Construct using com.google.datastore.v1.AggregationQuery.Aggregation.Sum.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); } - buildPartialOneofs(result); - onBuilt(); - return result; - } - private void buildPartial0(com.google.datastore.v1.AggregationQuery.Aggregation result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000002) != 0)) { - result.alias_ = alias_; + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + property_ = null; + if (propertyBuilder_ != null) { + propertyBuilder_.dispose(); + propertyBuilder_ = null; + } + return this; } - } - private void buildPartialOneofs(com.google.datastore.v1.AggregationQuery.Aggregation result) { - result.operatorCase_ = operatorCase_; - result.operator_ = this.operator_; - if (operatorCase_ == 1 && countBuilder_ != null) { - result.operator_ = countBuilder_.build(); + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_descriptor; } - } - @java.lang.Override - public Builder clone() { - return super.clone(); - } + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum + getDefaultInstanceForType() { + return com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); + } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum build() { + com.google.datastore.v1.AggregationQuery.Aggregation.Sum result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum buildPartial() { + com.google.datastore.v1.AggregationQuery.Aggregation.Sum result = + new com.google.datastore.v1.AggregationQuery.Aggregation.Sum(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } + private void buildPartial0( + com.google.datastore.v1.AggregationQuery.Aggregation.Sum result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.property_ = propertyBuilder_ == null ? property_ : propertyBuilder_.build(); + } + } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } + @java.lang.Override + public Builder clone() { + return super.clone(); + } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.datastore.v1.AggregationQuery.Aggregation.Sum) { + return mergeFrom((com.google.datastore.v1.AggregationQuery.Aggregation.Sum) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.datastore.v1.AggregationQuery.Aggregation.Sum other) { + if (other + == com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance()) + return this; + if (other.hasProperty()) { + mergeProperty(other.getProperty()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getPropertyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.datastore.v1.PropertyReference property_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.PropertyReference, + com.google.datastore.v1.PropertyReference.Builder, + com.google.datastore.v1.PropertyReferenceOrBuilder> + propertyBuilder_; + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return Whether the property field is set. + */ + public boolean hasProperty() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return The property. + */ + public com.google.datastore.v1.PropertyReference getProperty() { + if (propertyBuilder_ == null) { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } else { + return propertyBuilder_.getMessage(); + } + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder setProperty(com.google.datastore.v1.PropertyReference value) { + if (propertyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + property_ = value; + } else { + propertyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder setProperty( + com.google.datastore.v1.PropertyReference.Builder builderForValue) { + if (propertyBuilder_ == null) { + property_ = builderForValue.build(); + } else { + propertyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder mergeProperty(com.google.datastore.v1.PropertyReference value) { + if (propertyBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && property_ != null + && property_ != com.google.datastore.v1.PropertyReference.getDefaultInstance()) { + getPropertyBuilder().mergeFrom(value); + } else { + property_ = value; + } + } else { + propertyBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder clearProperty() { + bitField0_ = (bitField0_ & ~0x00000001); + property_ = null; + if (propertyBuilder_ != null) { + propertyBuilder_.dispose(); + propertyBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public com.google.datastore.v1.PropertyReference.Builder getPropertyBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getPropertyFieldBuilder().getBuilder(); + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public com.google.datastore.v1.PropertyReferenceOrBuilder getPropertyOrBuilder() { + if (propertyBuilder_ != null) { + return propertyBuilder_.getMessageOrBuilder(); + } else { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.PropertyReference, + com.google.datastore.v1.PropertyReference.Builder, + com.google.datastore.v1.PropertyReferenceOrBuilder> + getPropertyFieldBuilder() { + if (propertyBuilder_ == null) { + propertyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.PropertyReference, + com.google.datastore.v1.PropertyReference.Builder, + com.google.datastore.v1.PropertyReferenceOrBuilder>( + getProperty(), getParentForChildren(), isClean()); + property_ = null; + } + return propertyBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.datastore.v1.AggregationQuery.Aggregation.Sum) + } + + // @@protoc_insertion_point(class_scope:google.datastore.v1.AggregationQuery.Aggregation.Sum) + private static final com.google.datastore.v1.AggregationQuery.Aggregation.Sum + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.datastore.v1.AggregationQuery.Aggregation.Sum(); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Sum getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Sum parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AvgOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.datastore.v1.AggregationQuery.Aggregation.Avg) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return Whether the property field is set. + */ + boolean hasProperty(); + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return The property. + */ + com.google.datastore.v1.PropertyReference getProperty(); + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + com.google.datastore.v1.PropertyReferenceOrBuilder getPropertyOrBuilder(); + } + /** + * + * + *
+     * Average of the values of the requested property.
+     *
+     * * Only numeric values will be aggregated. All non-numeric values
+     * including `NULL` are skipped.
+     *
+     * * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
+     * follows IEEE-754 standards.
+     *
+     * * If the aggregated value set is empty, returns `NULL`.
+     *
+     * * Always returns the result as a double.
+     * 
+ * + * Protobuf type {@code google.datastore.v1.AggregationQuery.Aggregation.Avg} + */ + public static final class Avg extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.datastore.v1.AggregationQuery.Aggregation.Avg) + AvgOrBuilder { + private static final long serialVersionUID = 0L; + // Use Avg.newBuilder() to construct. + private Avg(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Avg() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Avg(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.class, + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder.class); + } + + public static final int PROPERTY_FIELD_NUMBER = 1; + private com.google.datastore.v1.PropertyReference property_; + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return Whether the property field is set. + */ + @java.lang.Override + public boolean hasProperty() { + return property_ != null; + } + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return The property. + */ + @java.lang.Override + public com.google.datastore.v1.PropertyReference getProperty() { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } + /** + * + * + *
+       * The property to aggregate on.
+       * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + @java.lang.Override + public com.google.datastore.v1.PropertyReferenceOrBuilder getPropertyOrBuilder() { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (property_ != null) { + output.writeMessage(1, getProperty()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (property_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProperty()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.datastore.v1.AggregationQuery.Aggregation.Avg)) { + return super.equals(obj); + } + com.google.datastore.v1.AggregationQuery.Aggregation.Avg other = + (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) obj; + + if (hasProperty() != other.hasProperty()) return false; + if (hasProperty()) { + if (!getProperty().equals(other.getProperty())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasProperty()) { + hash = (37 * hash) + PROPERTY_FIELD_NUMBER; + hash = (53 * hash) + getProperty().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.datastore.v1.AggregationQuery.Aggregation.Avg prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+       * Average of the values of the requested property.
+       *
+       * * Only numeric values will be aggregated. All non-numeric values
+       * including `NULL` are skipped.
+       *
+       * * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
+       * follows IEEE-754 standards.
+       *
+       * * If the aggregated value set is empty, returns `NULL`.
+       *
+       * * Always returns the result as a double.
+       * 
+ * + * Protobuf type {@code google.datastore.v1.AggregationQuery.Aggregation.Avg} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.datastore.v1.AggregationQuery.Aggregation.Avg) + com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.class, + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder.class); + } + + // Construct using com.google.datastore.v1.AggregationQuery.Aggregation.Avg.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + property_ = null; + if (propertyBuilder_ != null) { + propertyBuilder_.dispose(); + propertyBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_descriptor; + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg + getDefaultInstanceForType() { + return com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg build() { + com.google.datastore.v1.AggregationQuery.Aggregation.Avg result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg buildPartial() { + com.google.datastore.v1.AggregationQuery.Aggregation.Avg result = + new com.google.datastore.v1.AggregationQuery.Aggregation.Avg(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.datastore.v1.AggregationQuery.Aggregation.Avg result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.property_ = propertyBuilder_ == null ? property_ : propertyBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.datastore.v1.AggregationQuery.Aggregation.Avg) { + return mergeFrom((com.google.datastore.v1.AggregationQuery.Aggregation.Avg) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.datastore.v1.AggregationQuery.Aggregation.Avg other) { + if (other + == com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance()) + return this; + if (other.hasProperty()) { + mergeProperty(other.getProperty()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getPropertyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.datastore.v1.PropertyReference property_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.PropertyReference, + com.google.datastore.v1.PropertyReference.Builder, + com.google.datastore.v1.PropertyReferenceOrBuilder> + propertyBuilder_; + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return Whether the property field is set. + */ + public boolean hasProperty() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + * + * @return The property. + */ + public com.google.datastore.v1.PropertyReference getProperty() { + if (propertyBuilder_ == null) { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } else { + return propertyBuilder_.getMessage(); + } + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder setProperty(com.google.datastore.v1.PropertyReference value) { + if (propertyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + property_ = value; + } else { + propertyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder setProperty( + com.google.datastore.v1.PropertyReference.Builder builderForValue) { + if (propertyBuilder_ == null) { + property_ = builderForValue.build(); + } else { + propertyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder mergeProperty(com.google.datastore.v1.PropertyReference value) { + if (propertyBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && property_ != null + && property_ != com.google.datastore.v1.PropertyReference.getDefaultInstance()) { + getPropertyBuilder().mergeFrom(value); + } else { + property_ = value; + } + } else { + propertyBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public Builder clearProperty() { + bitField0_ = (bitField0_ & ~0x00000001); + property_ = null; + if (propertyBuilder_ != null) { + propertyBuilder_.dispose(); + propertyBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public com.google.datastore.v1.PropertyReference.Builder getPropertyBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getPropertyFieldBuilder().getBuilder(); + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + public com.google.datastore.v1.PropertyReferenceOrBuilder getPropertyOrBuilder() { + if (propertyBuilder_ != null) { + return propertyBuilder_.getMessageOrBuilder(); + } else { + return property_ == null + ? com.google.datastore.v1.PropertyReference.getDefaultInstance() + : property_; + } + } + /** + * + * + *
+         * The property to aggregate on.
+         * 
+ * + * .google.datastore.v1.PropertyReference property = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.PropertyReference, + com.google.datastore.v1.PropertyReference.Builder, + com.google.datastore.v1.PropertyReferenceOrBuilder> + getPropertyFieldBuilder() { + if (propertyBuilder_ == null) { + propertyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.PropertyReference, + com.google.datastore.v1.PropertyReference.Builder, + com.google.datastore.v1.PropertyReferenceOrBuilder>( + getProperty(), getParentForChildren(), isClean()); + property_ = null; + } + return propertyBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.datastore.v1.AggregationQuery.Aggregation.Avg) + } + + // @@protoc_insertion_point(class_scope:google.datastore.v1.AggregationQuery.Aggregation.Avg) + private static final com.google.datastore.v1.AggregationQuery.Aggregation.Avg + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.datastore.v1.AggregationQuery.Aggregation.Avg(); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation.Avg getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Avg parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int operatorCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object operator_; + + public enum OperatorCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + COUNT(1), + SUM(2), + AVG(3), + OPERATOR_NOT_SET(0); + private final int value; + + private OperatorCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static OperatorCase valueOf(int value) { + return forNumber(value); + } + + public static OperatorCase forNumber(int value) { + switch (value) { + case 1: + return COUNT; + case 2: + return SUM; + case 3: + return AVG; + case 0: + return OPERATOR_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public OperatorCase getOperatorCase() { + return OperatorCase.forNumber(operatorCase_); + } + + public static final int COUNT_FIELD_NUMBER = 1; + /** + * + * + *
+     * Count aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * + * @return Whether the count field is set. + */ + @java.lang.Override + public boolean hasCount() { + return operatorCase_ == 1; + } + /** + * + * + *
+     * Count aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * + * @return The count. + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Count getCount() { + if (operatorCase_ == 1) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + } + /** + * + * + *
+     * Count aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder getCountOrBuilder() { + if (operatorCase_ == 1) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + } + + public static final int SUM_FIELD_NUMBER = 2; + /** + * + * + *
+     * Sum aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + * + * @return Whether the sum field is set. + */ + @java.lang.Override + public boolean hasSum() { + return operatorCase_ == 2; + } + /** + * + * + *
+     * Sum aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + * + * @return The sum. + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum getSum() { + if (operatorCase_ == 2) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); + } + /** + * + * + *
+     * Sum aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder getSumOrBuilder() { + if (operatorCase_ == 2) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); + } + + public static final int AVG_FIELD_NUMBER = 3; + /** + * + * + *
+     * Average aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; + * + * @return Whether the avg field is set. + */ + @java.lang.Override + public boolean hasAvg() { + return operatorCase_ == 3; + } + /** + * + * + *
+     * Average aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; + * + * @return The avg. + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg getAvg() { + if (operatorCase_ == 3) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); + } + /** + * + * + *
+     * Average aggregator.
+     * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder getAvgOrBuilder() { + if (operatorCase_ == 3) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); + } + + public static final int ALIAS_FIELD_NUMBER = 7; + + @SuppressWarnings("serial") + private volatile java.lang.Object alias_ = ""; + /** + * + * + *
+     * Optional. Optional name of the property to store the result of the
+     * aggregation.
+     *
+     * If not provided, Datastore will pick a default name following the format
+     * `property_<incremental_id++>`. For example:
+     *
+     * ```
+     * AGGREGATE
+     *   COUNT_UP_TO(1) AS count_up_to_1,
+     *   COUNT_UP_TO(2),
+     *   COUNT_UP_TO(3) AS count_up_to_3,
+     *   COUNT(*)
+     * OVER (
+     *   ...
+     * );
+     * ```
+     *
+     * becomes:
+     *
+     * ```
+     * AGGREGATE
+     *   COUNT_UP_TO(1) AS count_up_to_1,
+     *   COUNT_UP_TO(2) AS property_1,
+     *   COUNT_UP_TO(3) AS count_up_to_3,
+     *   COUNT(*) AS property_2
+     * OVER (
+     *   ...
+     * );
+     * ```
+     *
+     * Requires:
+     *
+     * * Must be unique across all aggregation aliases.
+     * * Conform to [entity property
+     * name][google.datastore.v1.Entity.properties] limitations.
+     * 
+ * + * string alias = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The alias. + */ + @java.lang.Override + public java.lang.String getAlias() { + java.lang.Object ref = alias_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + alias_ = s; + return s; + } + } + /** + * + * + *
+     * Optional. Optional name of the property to store the result of the
+     * aggregation.
+     *
+     * If not provided, Datastore will pick a default name following the format
+     * `property_<incremental_id++>`. For example:
+     *
+     * ```
+     * AGGREGATE
+     *   COUNT_UP_TO(1) AS count_up_to_1,
+     *   COUNT_UP_TO(2),
+     *   COUNT_UP_TO(3) AS count_up_to_3,
+     *   COUNT(*)
+     * OVER (
+     *   ...
+     * );
+     * ```
+     *
+     * becomes:
+     *
+     * ```
+     * AGGREGATE
+     *   COUNT_UP_TO(1) AS count_up_to_1,
+     *   COUNT_UP_TO(2) AS property_1,
+     *   COUNT_UP_TO(3) AS count_up_to_3,
+     *   COUNT(*) AS property_2
+     * OVER (
+     *   ...
+     * );
+     * ```
+     *
+     * Requires:
+     *
+     * * Must be unique across all aggregation aliases.
+     * * Conform to [entity property
+     * name][google.datastore.v1.Entity.properties] limitations.
+     * 
+ * + * string alias = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for alias. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAliasBytes() { + java.lang.Object ref = alias_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + alias_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (operatorCase_ == 1) { + output.writeMessage( + 1, (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_); + } + if (operatorCase_ == 2) { + output.writeMessage( + 2, (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_); + } + if (operatorCase_ == 3) { + output.writeMessage( + 3, (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alias_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, alias_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (operatorCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_); + } + if (operatorCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_); + } + if (operatorCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(alias_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, alias_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.datastore.v1.AggregationQuery.Aggregation)) { + return super.equals(obj); + } + com.google.datastore.v1.AggregationQuery.Aggregation other = + (com.google.datastore.v1.AggregationQuery.Aggregation) obj; + + if (!getAlias().equals(other.getAlias())) return false; + if (!getOperatorCase().equals(other.getOperatorCase())) return false; + switch (operatorCase_) { + case 1: + if (!getCount().equals(other.getCount())) return false; + break; + case 2: + if (!getSum().equals(other.getSum())) return false; + break; + case 3: + if (!getAvg().equals(other.getAvg())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ALIAS_FIELD_NUMBER; + hash = (53 * hash) + getAlias().hashCode(); + switch (operatorCase_) { + case 1: + hash = (37 * hash) + COUNT_FIELD_NUMBER; + hash = (53 * hash) + getCount().hashCode(); + break; + case 2: + hash = (37 * hash) + SUM_FIELD_NUMBER; + hash = (53 * hash) + getSum().hashCode(); + break; + case 3: + hash = (37 * hash) + AVG_FIELD_NUMBER; + hash = (53 * hash) + getAvg().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.datastore.v1.AggregationQuery.Aggregation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.datastore.v1.AggregationQuery.Aggregation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Defines an aggregation that produces a single result.
+     * 
+ * + * Protobuf type {@code google.datastore.v1.AggregationQuery.Aggregation} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.datastore.v1.AggregationQuery.Aggregation) + com.google.datastore.v1.AggregationQuery.AggregationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.datastore.v1.AggregationQuery.Aggregation.class, + com.google.datastore.v1.AggregationQuery.Aggregation.Builder.class); + } + + // Construct using com.google.datastore.v1.AggregationQuery.Aggregation.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (countBuilder_ != null) { + countBuilder_.clear(); + } + if (sumBuilder_ != null) { + sumBuilder_.clear(); + } + if (avgBuilder_ != null) { + avgBuilder_.clear(); + } + alias_ = ""; + operatorCase_ = 0; + operator_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.datastore.v1.QueryProto + .internal_static_google_datastore_v1_AggregationQuery_Aggregation_descriptor; + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation getDefaultInstanceForType() { + return com.google.datastore.v1.AggregationQuery.Aggregation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation build() { + com.google.datastore.v1.AggregationQuery.Aggregation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation buildPartial() { + com.google.datastore.v1.AggregationQuery.Aggregation result = + new com.google.datastore.v1.AggregationQuery.Aggregation(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.datastore.v1.AggregationQuery.Aggregation result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.alias_ = alias_; + } + } + + private void buildPartialOneofs(com.google.datastore.v1.AggregationQuery.Aggregation result) { + result.operatorCase_ = operatorCase_; + result.operator_ = this.operator_; + if (operatorCase_ == 1 && countBuilder_ != null) { + result.operator_ = countBuilder_.build(); + } + if (operatorCase_ == 2 && sumBuilder_ != null) { + result.operator_ = sumBuilder_.build(); + } + if (operatorCase_ == 3 && avgBuilder_ != null) { + result.operator_ = avgBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.datastore.v1.AggregationQuery.Aggregation) { + return mergeFrom((com.google.datastore.v1.AggregationQuery.Aggregation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.datastore.v1.AggregationQuery.Aggregation other) { + if (other == com.google.datastore.v1.AggregationQuery.Aggregation.getDefaultInstance()) + return this; + if (!other.getAlias().isEmpty()) { + alias_ = other.alias_; + bitField0_ |= 0x00000008; + onChanged(); + } + switch (other.getOperatorCase()) { + case COUNT: + { + mergeCount(other.getCount()); + break; + } + case SUM: + { + mergeSum(other.getSum()); + break; + } + case AVG: + { + mergeAvg(other.getAvg()); + break; + } + case OPERATOR_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getCountFieldBuilder().getBuilder(), extensionRegistry); + operatorCase_ = 1; + break; + } // case 10 + case 18: + { + input.readMessage(getSumFieldBuilder().getBuilder(), extensionRegistry); + operatorCase_ = 2; + break; + } // case 18 + case 26: + { + input.readMessage(getAvgFieldBuilder().getBuilder(), extensionRegistry); + operatorCase_ = 3; + break; + } // case 26 + case 58: + { + alias_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int operatorCase_ = 0; + private java.lang.Object operator_; + + public OperatorCase getOperatorCase() { + return OperatorCase.forNumber(operatorCase_); + } + + public Builder clearOperator() { + operatorCase_ = 0; + operator_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.AggregationQuery.Aggregation.Count, + com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder> + countBuilder_; + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * + * @return Whether the count field is set. + */ + @java.lang.Override + public boolean hasCount() { + return operatorCase_ == 1; + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * + * @return The count. + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Count getCount() { + if (countBuilder_ == null) { + if (operatorCase_ == 1) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + } else { + if (operatorCase_ == 1) { + return countBuilder_.getMessage(); + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + } + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + public Builder setCount(com.google.datastore.v1.AggregationQuery.Aggregation.Count value) { + if (countBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + operator_ = value; + onChanged(); + } else { + countBuilder_.setMessage(value); + } + operatorCase_ = 1; + return this; + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + public Builder setCount( + com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder builderForValue) { + if (countBuilder_ == null) { + operator_ = builderForValue.build(); + onChanged(); + } else { + countBuilder_.setMessage(builderForValue.build()); + } + operatorCase_ = 1; + return this; + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + public Builder mergeCount(com.google.datastore.v1.AggregationQuery.Aggregation.Count value) { + if (countBuilder_ == null) { + if (operatorCase_ == 1 + && operator_ + != com.google.datastore.v1.AggregationQuery.Aggregation.Count + .getDefaultInstance()) { + operator_ = + com.google.datastore.v1.AggregationQuery.Aggregation.Count.newBuilder( + (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_) + .mergeFrom(value) + .buildPartial(); + } else { + operator_ = value; + } + onChanged(); + } else { + if (operatorCase_ == 1) { + countBuilder_.mergeFrom(value); + } else { + countBuilder_.setMessage(value); + } + } + operatorCase_ = 1; + return this; + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + public Builder clearCount() { + if (countBuilder_ == null) { + if (operatorCase_ == 1) { + operatorCase_ = 0; + operator_ = null; + onChanged(); + } + } else { + if (operatorCase_ == 1) { + operatorCase_ = 0; + operator_ = null; + } + countBuilder_.clear(); + } + return this; + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + public com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder getCountBuilder() { + return getCountFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder + getCountOrBuilder() { + if ((operatorCase_ == 1) && (countBuilder_ != null)) { + return countBuilder_.getMessageOrBuilder(); + } else { + if (operatorCase_ == 1) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + } + } + /** + * + * + *
+       * Count aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.AggregationQuery.Aggregation.Count, + com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder> + getCountFieldBuilder() { + if (countBuilder_ == null) { + if (!(operatorCase_ == 1)) { + operator_ = + com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + } + countBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.AggregationQuery.Aggregation.Count, + com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder>( + (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_, + getParentForChildren(), + isClean()); + operator_ = null; + } + operatorCase_ = 1; + onChanged(); + return countBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.AggregationQuery.Aggregation.Sum, + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder> + sumBuilder_; + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + * + * @return Whether the sum field is set. + */ + @java.lang.Override + public boolean hasSum() { + return operatorCase_ == 2; + } + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + * + * @return The sum. + */ + @java.lang.Override + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum getSum() { + if (sumBuilder_ == null) { + if (operatorCase_ == 2) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); + } else { + if (operatorCase_ == 2) { + return sumBuilder_.getMessage(); + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); + } + } + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + public Builder setSum(com.google.datastore.v1.AggregationQuery.Aggregation.Sum value) { + if (sumBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + operator_ = value; + onChanged(); + } else { + sumBuilder_.setMessage(value); + } + operatorCase_ = 2; + return this; } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.datastore.v1.AggregationQuery.Aggregation) { - return mergeFrom((com.google.datastore.v1.AggregationQuery.Aggregation) other); + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + public Builder setSum( + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder builderForValue) { + if (sumBuilder_ == null) { + operator_ = builderForValue.build(); + onChanged(); } else { - super.mergeFrom(other); - return this; + sumBuilder_.setMessage(builderForValue.build()); } + operatorCase_ = 2; + return this; } - - public Builder mergeFrom(com.google.datastore.v1.AggregationQuery.Aggregation other) { - if (other == com.google.datastore.v1.AggregationQuery.Aggregation.getDefaultInstance()) - return this; - if (!other.getAlias().isEmpty()) { - alias_ = other.alias_; - bitField0_ |= 0x00000002; + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + public Builder mergeSum(com.google.datastore.v1.AggregationQuery.Aggregation.Sum value) { + if (sumBuilder_ == null) { + if (operatorCase_ == 2 + && operator_ + != com.google.datastore.v1.AggregationQuery.Aggregation.Sum + .getDefaultInstance()) { + operator_ = + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.newBuilder( + (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_) + .mergeFrom(value) + .buildPartial(); + } else { + operator_ = value; + } onChanged(); + } else { + if (operatorCase_ == 2) { + sumBuilder_.mergeFrom(value); + } else { + sumBuilder_.setMessage(value); + } } - switch (other.getOperatorCase()) { - case COUNT: - { - mergeCount(other.getCount()); - break; - } - case OPERATOR_NOT_SET: - { - break; - } + operatorCase_ = 2; + return this; + } + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + public Builder clearSum() { + if (sumBuilder_ == null) { + if (operatorCase_ == 2) { + operatorCase_ = 0; + operator_ = null; + onChanged(); + } + } else { + if (operatorCase_ == 2) { + operatorCase_ = 0; + operator_ = null; + } + sumBuilder_.clear(); } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); return this; } - - @java.lang.Override - public final boolean isInitialized() { - return true; + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + public com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder getSumBuilder() { + return getSumFieldBuilder().getBuilder(); } - + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); + public com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder getSumOrBuilder() { + if ((operatorCase_ == 2) && (sumBuilder_ != null)) { + return sumBuilder_.getMessageOrBuilder(); + } else { + if (operatorCase_ == 2) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_; + } + return com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getCountFieldBuilder().getBuilder(), extensionRegistry); - operatorCase_ = 1; - break; - } // case 10 - case 58: - { - alias_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 58 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int operatorCase_ = 0; - private java.lang.Object operator_; - - public OperatorCase getOperatorCase() { - return OperatorCase.forNumber(operatorCase_); } - - public Builder clearOperator() { - operatorCase_ = 0; - operator_ = null; + /** + * + * + *
+       * Sum aggregator.
+       * 
+ * + * .google.datastore.v1.AggregationQuery.Aggregation.Sum sum = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.AggregationQuery.Aggregation.Sum, + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder> + getSumFieldBuilder() { + if (sumBuilder_ == null) { + if (!(operatorCase_ == 2)) { + operator_ = + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.getDefaultInstance(); + } + sumBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.datastore.v1.AggregationQuery.Aggregation.Sum, + com.google.datastore.v1.AggregationQuery.Aggregation.Sum.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.SumOrBuilder>( + (com.google.datastore.v1.AggregationQuery.Aggregation.Sum) operator_, + getParentForChildren(), + isClean()); + operator_ = null; + } + operatorCase_ = 2; onChanged(); - return this; + return sumBuilder_; } - private int bitField0_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.datastore.v1.AggregationQuery.Aggregation.Count, - com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder, - com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder> - countBuilder_; + com.google.datastore.v1.AggregationQuery.Aggregation.Avg, + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder> + avgBuilder_; /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; * - * @return Whether the count field is set. + * @return Whether the avg field is set. */ @java.lang.Override - public boolean hasCount() { - return operatorCase_ == 1; + public boolean hasAvg() { + return operatorCase_ == 3; } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; * - * @return The count. + * @return The avg. */ @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation.Count getCount() { - if (countBuilder_ == null) { - if (operatorCase_ == 1) { - return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg getAvg() { + if (avgBuilder_ == null) { + if (operatorCase_ == 3) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_; } - return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + return com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); } else { - if (operatorCase_ == 1) { - return countBuilder_.getMessage(); + if (operatorCase_ == 3) { + return avgBuilder_.getMessage(); } - return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + return com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); } } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ - public Builder setCount(com.google.datastore.v1.AggregationQuery.Aggregation.Count value) { - if (countBuilder_ == null) { + public Builder setAvg(com.google.datastore.v1.AggregationQuery.Aggregation.Avg value) { + if (avgBuilder_ == null) { if (value == null) { throw new NullPointerException(); } operator_ = value; onChanged(); } else { - countBuilder_.setMessage(value); + avgBuilder_.setMessage(value); } - operatorCase_ = 1; + operatorCase_ = 3; return this; } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ - public Builder setCount( - com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder builderForValue) { - if (countBuilder_ == null) { + public Builder setAvg( + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder builderForValue) { + if (avgBuilder_ == null) { operator_ = builderForValue.build(); onChanged(); } else { - countBuilder_.setMessage(builderForValue.build()); + avgBuilder_.setMessage(builderForValue.build()); } - operatorCase_ = 1; + operatorCase_ = 3; return this; } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ - public Builder mergeCount(com.google.datastore.v1.AggregationQuery.Aggregation.Count value) { - if (countBuilder_ == null) { - if (operatorCase_ == 1 + public Builder mergeAvg(com.google.datastore.v1.AggregationQuery.Aggregation.Avg value) { + if (avgBuilder_ == null) { + if (operatorCase_ == 3 && operator_ - != com.google.datastore.v1.AggregationQuery.Aggregation.Count + != com.google.datastore.v1.AggregationQuery.Aggregation.Avg .getDefaultInstance()) { operator_ = - com.google.datastore.v1.AggregationQuery.Aggregation.Count.newBuilder( - (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_) + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.newBuilder( + (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_) .mergeFrom(value) .buildPartial(); } else { @@ -2024,37 +4229,37 @@ public Builder mergeCount(com.google.datastore.v1.AggregationQuery.Aggregation.C } onChanged(); } else { - if (operatorCase_ == 1) { - countBuilder_.mergeFrom(value); + if (operatorCase_ == 3) { + avgBuilder_.mergeFrom(value); } else { - countBuilder_.setMessage(value); + avgBuilder_.setMessage(value); } } - operatorCase_ = 1; + operatorCase_ = 3; return this; } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ - public Builder clearCount() { - if (countBuilder_ == null) { - if (operatorCase_ == 1) { + public Builder clearAvg() { + if (avgBuilder_ == null) { + if (operatorCase_ == 3) { operatorCase_ = 0; operator_ = null; onChanged(); } } else { - if (operatorCase_ == 1) { + if (operatorCase_ == 3) { operatorCase_ = 0; operator_ = null; } - countBuilder_.clear(); + avgBuilder_.clear(); } return this; } @@ -2062,67 +4267,66 @@ public Builder clearCount() { * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ - public com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder getCountBuilder() { - return getCountFieldBuilder().getBuilder(); + public com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder getAvgBuilder() { + return getAvgFieldBuilder().getBuilder(); } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ @java.lang.Override - public com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder - getCountOrBuilder() { - if ((operatorCase_ == 1) && (countBuilder_ != null)) { - return countBuilder_.getMessageOrBuilder(); + public com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder getAvgOrBuilder() { + if ((operatorCase_ == 3) && (avgBuilder_ != null)) { + return avgBuilder_.getMessageOrBuilder(); } else { - if (operatorCase_ == 1) { - return (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_; + if (operatorCase_ == 3) { + return (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_; } - return com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + return com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); } } /** * * *
-       * Count aggregator.
+       * Average aggregator.
        * 
* - * .google.datastore.v1.AggregationQuery.Aggregation.Count count = 1; + * .google.datastore.v1.AggregationQuery.Aggregation.Avg avg = 3; */ private com.google.protobuf.SingleFieldBuilderV3< - com.google.datastore.v1.AggregationQuery.Aggregation.Count, - com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder, - com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder> - getCountFieldBuilder() { - if (countBuilder_ == null) { - if (!(operatorCase_ == 1)) { + com.google.datastore.v1.AggregationQuery.Aggregation.Avg, + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder> + getAvgFieldBuilder() { + if (avgBuilder_ == null) { + if (!(operatorCase_ == 3)) { operator_ = - com.google.datastore.v1.AggregationQuery.Aggregation.Count.getDefaultInstance(); + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.getDefaultInstance(); } - countBuilder_ = + avgBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.datastore.v1.AggregationQuery.Aggregation.Count, - com.google.datastore.v1.AggregationQuery.Aggregation.Count.Builder, - com.google.datastore.v1.AggregationQuery.Aggregation.CountOrBuilder>( - (com.google.datastore.v1.AggregationQuery.Aggregation.Count) operator_, + com.google.datastore.v1.AggregationQuery.Aggregation.Avg, + com.google.datastore.v1.AggregationQuery.Aggregation.Avg.Builder, + com.google.datastore.v1.AggregationQuery.Aggregation.AvgOrBuilder>( + (com.google.datastore.v1.AggregationQuery.Aggregation.Avg) operator_, getParentForChildren(), isClean()); operator_ = null; } - operatorCase_ = 1; + operatorCase_ = 3; onChanged(); - return countBuilder_; + return avgBuilder_; } private java.lang.Object alias_ = ""; @@ -2289,7 +4493,7 @@ public Builder setAlias(java.lang.String value) { throw new NullPointerException(); } alias_ = value; - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000008; onChanged(); return this; } @@ -2340,7 +4544,7 @@ public Builder setAlias(java.lang.String value) { */ public Builder clearAlias() { alias_ = getDefaultInstance().getAlias(); - bitField0_ = (bitField0_ & ~0x00000002); + bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } @@ -2396,7 +4600,7 @@ public Builder setAliasBytes(com.google.protobuf.ByteString value) { } checkByteStringIsUtf8(value); alias_ = value; - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000008; onChanged(); return this; } diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java index bee06ffda..45d9e144b 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java @@ -156,8 +156,9 @@ public enum Operator implements com.google.protobuf.ProtocolMessageEnum { * * Requires: * - * * That `value` is a non-empty `ArrayValue` with at most 10 values. - * * No other `IN` or `NOT_IN` is in the same query. + * * That `value` is a non-empty `ArrayValue`, subject to disjunction + * limits. + * * No `NOT_IN` is in the same query. * * * IN = 6; @@ -187,7 +188,7 @@ public enum Operator implements com.google.protobuf.ProtocolMessageEnum { * Requires: * * * That `value` is an entity key. - * * No other `HAS_ANCESTOR` is in the same query. + * * All evaluated disjunctions must have the same `HAS_ANCESTOR` filter. * * * HAS_ANCESTOR = 11; @@ -202,7 +203,7 @@ public enum Operator implements com.google.protobuf.ProtocolMessageEnum { * Requires: * * * That `value` is a non-empty `ArrayValue` with at most 10 values. - * * No other `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. + * * No other `OR`, `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. * * That `field` comes first in the `order_by`. * * @@ -296,8 +297,9 @@ public enum Operator implements com.google.protobuf.ProtocolMessageEnum { * * Requires: * - * * That `value` is a non-empty `ArrayValue` with at most 10 values. - * * No other `IN` or `NOT_IN` is in the same query. + * * That `value` is a non-empty `ArrayValue`, subject to disjunction + * limits. + * * No `NOT_IN` is in the same query. * * * IN = 6; @@ -327,7 +329,7 @@ public enum Operator implements com.google.protobuf.ProtocolMessageEnum { * Requires: * * * That `value` is an entity key. - * * No other `HAS_ANCESTOR` is in the same query. + * * All evaluated disjunctions must have the same `HAS_ANCESTOR` filter. * * * HAS_ANCESTOR = 11; @@ -342,7 +344,7 @@ public enum Operator implements com.google.protobuf.ProtocolMessageEnum { * Requires: * * * That `value` is a non-empty `ArrayValue` with at most 10 values. - * * No other `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. + * * No other `OR`, `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. * * That `field` comes first in the `order_by`. * * diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java index bce5821df..63c146eb4 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java @@ -47,6 +47,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_datastore_v1_AggregationQuery_Aggregation_Count_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_datastore_v1_AggregationQuery_Aggregation_Count_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_datastore_v1_AggregationQuery_Aggregation_Sum_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_datastore_v1_AggregationQuery_Aggregation_Avg_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_datastore_v1_KindExpression_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -120,70 +128,77 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "inct_on\030\006 \003(\0132&.google.datastore.v1.Prop" + "ertyReference\022\024\n\014start_cursor\030\007 \001(\014\022\022\n\ne" + "nd_cursor\030\010 \001(\014\022\016\n\006offset\030\n \001(\005\022*\n\005limit" - + "\030\014 \001(\0132\033.google.protobuf.Int32Value\"\331\002\n\020" + + "\030\014 \001(\0132\033.google.protobuf.Int32Value\"\347\004\n\020" + "AggregationQuery\0222\n\014nested_query\030\001 \001(\0132\032" + ".google.datastore.v1.QueryH\000\022M\n\014aggregat" + "ions\030\003 \003(\01321.google.datastore.v1.Aggrega" - + "tionQuery.AggregationB\004\342A\001\001\032\263\001\n\013Aggregat" + + "tionQuery.AggregationB\004\342A\001\001\032\301\003\n\013Aggregat" + "ion\022H\n\005count\030\001 \001(\01327.google.datastore.v1" - + ".AggregationQuery.Aggregation.CountH\000\022\023\n" - + "\005alias\030\007 \001(\tB\004\342A\001\001\0329\n\005Count\0220\n\005up_to\030\001 \001" - + "(\0132\033.google.protobuf.Int64ValueB\004\342A\001\001B\n\n" - + "\010operatorB\014\n\nquery_type\"\036\n\016KindExpressio" - + "n\022\014\n\004name\030\001 \001(\t\"!\n\021PropertyReference\022\014\n\004" - + "name\030\002 \001(\t\"F\n\nProjection\0228\n\010property\030\001 \001" + + ".AggregationQuery.Aggregation.CountH\000\022D\n" + + "\003sum\030\002 \001(\01325.google.datastore.v1.Aggrega" + + "tionQuery.Aggregation.SumH\000\022D\n\003avg\030\003 \001(\013" + + "25.google.datastore.v1.AggregationQuery." + + "Aggregation.AvgH\000\022\023\n\005alias\030\007 \001(\tB\004\342A\001\001\0329" + + "\n\005Count\0220\n\005up_to\030\001 \001(\0132\033.google.protobuf" + + ".Int64ValueB\004\342A\001\001\032?\n\003Sum\0228\n\010property\030\001 \001" + "(\0132&.google.datastore.v1.PropertyReferen" - + "ce\"\321\001\n\rPropertyOrder\0228\n\010property\030\001 \001(\0132&" - + ".google.datastore.v1.PropertyReference\022?" - + "\n\tdirection\030\002 \001(\0162,.google.datastore.v1." - + "PropertyOrder.Direction\"E\n\tDirection\022\031\n\025" - + "DIRECTION_UNSPECIFIED\020\000\022\r\n\tASCENDING\020\001\022\016" - + "\n\nDESCENDING\020\002\"\231\001\n\006Filter\022@\n\020composite_f" - + "ilter\030\001 \001(\0132$.google.datastore.v1.Compos" - + "iteFilterH\000\022>\n\017property_filter\030\002 \001(\0132#.g" - + "oogle.datastore.v1.PropertyFilterH\000B\r\n\013f" - + "ilter_type\"\261\001\n\017CompositeFilter\0229\n\002op\030\001 \001" - + "(\0162-.google.datastore.v1.CompositeFilter" - + ".Operator\022,\n\007filters\030\002 \003(\0132\033.google.data" - + "store.v1.Filter\"5\n\010Operator\022\030\n\024OPERATOR_" - + "UNSPECIFIED\020\000\022\007\n\003AND\020\001\022\006\n\002OR\020\002\"\352\002\n\016Prope" - + "rtyFilter\0228\n\010property\030\001 \001(\0132&.google.dat" - + "astore.v1.PropertyReference\0228\n\002op\030\002 \001(\0162" - + ",.google.datastore.v1.PropertyFilter.Ope" - + "rator\022)\n\005value\030\003 \001(\0132\032.google.datastore." - + "v1.Value\"\270\001\n\010Operator\022\030\n\024OPERATOR_UNSPEC" - + "IFIED\020\000\022\r\n\tLESS_THAN\020\001\022\026\n\022LESS_THAN_OR_E" - + "QUAL\020\002\022\020\n\014GREATER_THAN\020\003\022\031\n\025GREATER_THAN" - + "_OR_EQUAL\020\004\022\t\n\005EQUAL\020\005\022\006\n\002IN\020\006\022\r\n\tNOT_EQ" - + "UAL\020\t\022\020\n\014HAS_ANCESTOR\020\013\022\n\n\006NOT_IN\020\r\"\245\002\n\010" - + "GqlQuery\022\024\n\014query_string\030\001 \001(\t\022\026\n\016allow_" - + "literals\030\002 \001(\010\022H\n\016named_bindings\030\005 \003(\01320" - + ".google.datastore.v1.GqlQuery.NamedBindi" - + "ngsEntry\022C\n\023positional_bindings\030\004 \003(\0132&." - + "google.datastore.v1.GqlQueryParameter\032\\\n" - + "\022NamedBindingsEntry\022\013\n\003key\030\001 \001(\t\0225\n\005valu" - + "e\030\002 \001(\0132&.google.datastore.v1.GqlQueryPa" - + "rameter:\0028\001\"d\n\021GqlQueryParameter\022+\n\005valu" - + "e\030\002 \001(\0132\032.google.datastore.v1.ValueH\000\022\020\n" - + "\006cursor\030\003 \001(\014H\000B\020\n\016parameter_type\"\215\004\n\020Qu" - + "eryResultBatch\022\027\n\017skipped_results\030\006 \001(\005\022" - + "\026\n\016skipped_cursor\030\003 \001(\014\022H\n\022entity_result" - + "_type\030\001 \001(\0162,.google.datastore.v1.Entity" - + "Result.ResultType\0229\n\016entity_results\030\002 \003(" - + "\0132!.google.datastore.v1.EntityResult\022\022\n\n" - + "end_cursor\030\004 \001(\014\022K\n\014more_results\030\005 \001(\01625" - + ".google.datastore.v1.QueryResultBatch.Mo" - + "reResultsType\022\030\n\020snapshot_version\030\007 \001(\003\022" - + "-\n\tread_time\030\010 \001(\0132\032.google.protobuf.Tim" - + "estamp\"\230\001\n\017MoreResultsType\022!\n\035MORE_RESUL" - + "TS_TYPE_UNSPECIFIED\020\000\022\020\n\014NOT_FINISHED\020\001\022" - + "\034\n\030MORE_RESULTS_AFTER_LIMIT\020\002\022\035\n\031MORE_RE" - + "SULTS_AFTER_CURSOR\020\004\022\023\n\017NO_MORE_RESULTS\020" - + "\003B\274\001\n\027com.google.datastore.v1B\nQueryProt" - + "oP\001Z\n\017property_filter\030\002 \001(\0132#.google.data" + + "store.v1.PropertyFilterH\000B\r\n\013filter_type" + + "\"\261\001\n\017CompositeFilter\0229\n\002op\030\001 \001(\0162-.googl" + + "e.datastore.v1.CompositeFilter.Operator\022" + + ",\n\007filters\030\002 \003(\0132\033.google.datastore.v1.F" + + "ilter\"5\n\010Operator\022\030\n\024OPERATOR_UNSPECIFIE" + + "D\020\000\022\007\n\003AND\020\001\022\006\n\002OR\020\002\"\352\002\n\016PropertyFilter\022" + + "8\n\010property\030\001 \001(\0132&.google.datastore.v1." + + "PropertyReference\0228\n\002op\030\002 \001(\0162,.google.d" + + "atastore.v1.PropertyFilter.Operator\022)\n\005v" + + "alue\030\003 \001(\0132\032.google.datastore.v1.Value\"\270" + + "\001\n\010Operator\022\030\n\024OPERATOR_UNSPECIFIED\020\000\022\r\n" + + "\tLESS_THAN\020\001\022\026\n\022LESS_THAN_OR_EQUAL\020\002\022\020\n\014" + + "GREATER_THAN\020\003\022\031\n\025GREATER_THAN_OR_EQUAL\020" + + "\004\022\t\n\005EQUAL\020\005\022\006\n\002IN\020\006\022\r\n\tNOT_EQUAL\020\t\022\020\n\014H" + + "AS_ANCESTOR\020\013\022\n\n\006NOT_IN\020\r\"\245\002\n\010GqlQuery\022\024" + + "\n\014query_string\030\001 \001(\t\022\026\n\016allow_literals\030\002" + + " \001(\010\022H\n\016named_bindings\030\005 \003(\01320.google.da" + + "tastore.v1.GqlQuery.NamedBindingsEntry\022C" + + "\n\023positional_bindings\030\004 \003(\0132&.google.dat" + + "astore.v1.GqlQueryParameter\032\\\n\022NamedBind" + + "ingsEntry\022\013\n\003key\030\001 \001(\t\0225\n\005value\030\002 \001(\0132&." + + "google.datastore.v1.GqlQueryParameter:\0028" + + "\001\"d\n\021GqlQueryParameter\022+\n\005value\030\002 \001(\0132\032." + + "google.datastore.v1.ValueH\000\022\020\n\006cursor\030\003 " + + "\001(\014H\000B\020\n\016parameter_type\"\215\004\n\020QueryResultB" + + "atch\022\027\n\017skipped_results\030\006 \001(\005\022\026\n\016skipped" + + "_cursor\030\003 \001(\014\022H\n\022entity_result_type\030\001 \001(" + + "\0162,.google.datastore.v1.EntityResult.Res" + + "ultType\0229\n\016entity_results\030\002 \003(\0132!.google" + + ".datastore.v1.EntityResult\022\022\n\nend_cursor" + + "\030\004 \001(\014\022K\n\014more_results\030\005 \001(\01625.google.da" + + "tastore.v1.QueryResultBatch.MoreResultsT" + + "ype\022\030\n\020snapshot_version\030\007 \001(\003\022-\n\tread_ti" + + "me\030\010 \001(\0132\032.google.protobuf.Timestamp\"\230\001\n" + + "\017MoreResultsType\022!\n\035MORE_RESULTS_TYPE_UN" + + "SPECIFIED\020\000\022\020\n\014NOT_FINISHED\020\001\022\034\n\030MORE_RE" + + "SULTS_AFTER_LIMIT\020\002\022\035\n\031MORE_RESULTS_AFTE" + + "R_CURSOR\020\004\022\023\n\017NO_MORE_RESULTS\020\003B\274\001\n\027com." + + "google.datastore.v1B\nQueryProtoP\001Z - * Reads entities as they were at the given time. This may not be older - * than 270 seconds. This value is only supported for Cloud Firestore in - * Datastore mode. + * Reads entities as they were at the given time. This value is only + * supported for Cloud Firestore in Datastore mode. + * + * This must be a microsecond precision timestamp within the past one hour, + * or if Point-in-Time Recovery is enabled, can additionally be a whole + * minute timestamp within the past 7 days. * * * .google.protobuf.Timestamp read_time = 4; @@ -459,9 +462,12 @@ public boolean hasReadTime() { * * *
-   * Reads entities as they were at the given time. This may not be older
-   * than 270 seconds.  This value is only supported for Cloud Firestore in
-   * Datastore mode.
+   * Reads entities as they were at the given time. This value is only
+   * supported for Cloud Firestore in Datastore mode.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
    * 
* * .google.protobuf.Timestamp read_time = 4; @@ -479,9 +485,12 @@ public com.google.protobuf.Timestamp getReadTime() { * * *
-   * Reads entities as they were at the given time. This may not be older
-   * than 270 seconds.  This value is only supported for Cloud Firestore in
-   * Datastore mode.
+   * Reads entities as they were at the given time. This value is only
+   * supported for Cloud Firestore in Datastore mode.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
    * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1430,9 +1439,12 @@ public com.google.datastore.v1.TransactionOptionsOrBuilder getNewTransactionOrBu * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1447,9 +1459,12 @@ public boolean hasReadTime() { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1474,9 +1489,12 @@ public com.google.protobuf.Timestamp getReadTime() { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1498,9 +1516,12 @@ public Builder setReadTime(com.google.protobuf.Timestamp value) { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1519,9 +1540,12 @@ public Builder setReadTime(com.google.protobuf.Timestamp.Builder builderForValue * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1553,9 +1577,12 @@ public Builder mergeReadTime(com.google.protobuf.Timestamp value) { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1580,9 +1607,12 @@ public Builder clearReadTime() { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1594,9 +1624,12 @@ public com.google.protobuf.Timestamp.Builder getReadTimeBuilder() { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; @@ -1616,9 +1649,12 @@ public com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder() { * * *
-     * Reads entities as they were at the given time. This may not be older
-     * than 270 seconds.  This value is only supported for Cloud Firestore in
-     * Datastore mode.
+     * Reads entities as they were at the given time. This value is only
+     * supported for Cloud Firestore in Datastore mode.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 4; diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java index d0658b8e8..31eb6ad9d 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java @@ -146,9 +146,12 @@ public interface ReadOptionsOrBuilder * * *
-   * Reads entities as they were at the given time. This may not be older
-   * than 270 seconds.  This value is only supported for Cloud Firestore in
-   * Datastore mode.
+   * Reads entities as they were at the given time. This value is only
+   * supported for Cloud Firestore in Datastore mode.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
    * 
* * .google.protobuf.Timestamp read_time = 4; @@ -160,9 +163,12 @@ public interface ReadOptionsOrBuilder * * *
-   * Reads entities as they were at the given time. This may not be older
-   * than 270 seconds.  This value is only supported for Cloud Firestore in
-   * Datastore mode.
+   * Reads entities as they were at the given time. This value is only
+   * supported for Cloud Firestore in Datastore mode.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
    * 
* * .google.protobuf.Timestamp read_time = 4; @@ -174,9 +180,12 @@ public interface ReadOptionsOrBuilder * * *
-   * Reads entities as they were at the given time. This may not be older
-   * than 270 seconds.  This value is only supported for Cloud Firestore in
-   * Datastore mode.
+   * Reads entities as they were at the given time. This value is only
+   * supported for Cloud Firestore in Datastore mode.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
    * 
* * .google.protobuf.Timestamp read_time = 4; diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java index 349768043..3f8f3209f 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java @@ -622,7 +622,10 @@ public interface ReadOnlyOrBuilder * *
      * Reads entities at the given time.
-     * This may not be older than 60 seconds.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 1; @@ -635,7 +638,10 @@ public interface ReadOnlyOrBuilder * *
      * Reads entities at the given time.
-     * This may not be older than 60 seconds.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 1; @@ -648,7 +654,10 @@ public interface ReadOnlyOrBuilder * *
      * Reads entities at the given time.
-     * This may not be older than 60 seconds.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 1; @@ -704,7 +713,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * *
      * Reads entities at the given time.
-     * This may not be older than 60 seconds.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 1; @@ -720,7 +732,10 @@ public boolean hasReadTime() { * *
      * Reads entities at the given time.
-     * This may not be older than 60 seconds.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 1; @@ -736,7 +751,10 @@ public com.google.protobuf.Timestamp getReadTime() { * *
      * Reads entities at the given time.
-     * This may not be older than 60 seconds.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
      * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1111,7 +1129,10 @@ public Builder mergeFrom( * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1126,7 +1147,10 @@ public boolean hasReadTime() { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1145,7 +1169,10 @@ public com.google.protobuf.Timestamp getReadTime() { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1168,7 +1195,10 @@ public Builder setReadTime(com.google.protobuf.Timestamp value) { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1188,7 +1218,10 @@ public Builder setReadTime(com.google.protobuf.Timestamp.Builder builderForValue * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1214,7 +1247,10 @@ public Builder mergeReadTime(com.google.protobuf.Timestamp value) { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1234,7 +1270,10 @@ public Builder clearReadTime() { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1249,7 +1288,10 @@ public com.google.protobuf.Timestamp.Builder getReadTimeBuilder() { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; @@ -1266,7 +1308,10 @@ public com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder() { * *
        * Reads entities at the given time.
-       * This may not be older than 60 seconds.
+       *
+       * This must be a microsecond precision timestamp within the past one hour,
+       * or if Point-in-Time Recovery is enabled, can additionally be a whole
+       * minute timestamp within the past 7 days.
        * 
* * .google.protobuf.Timestamp read_time = 1; diff --git a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/datastore.proto b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/datastore.proto index 4822048b6..533988d77 100644 --- a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/datastore.proto +++ b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/datastore.proto @@ -578,9 +578,12 @@ message ReadOptions { // [RunQueryResponse.transaction][google.datastore.v1.RunQueryResponse.transaction]. TransactionOptions new_transaction = 3; - // Reads entities as they were at the given time. This may not be older - // than 270 seconds. This value is only supported for Cloud Firestore in - // Datastore mode. + // Reads entities as they were at the given time. This value is only + // supported for Cloud Firestore in Datastore mode. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. google.protobuf.Timestamp read_time = 4; } } @@ -602,7 +605,10 @@ message TransactionOptions { // Options specific to read-only transactions. message ReadOnly { // Reads entities at the given time. - // This may not be older than 60 seconds. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. google.protobuf.Timestamp read_time = 1; } diff --git a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto index 812bfbf05..40ade72a3 100644 --- a/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto +++ b/proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/query.proto @@ -163,10 +163,58 @@ message AggregationQuery { [(google.api.field_behavior) = OPTIONAL]; } + // Sum of the values of the requested property. + // + // * Only numeric values will be aggregated. All non-numeric values + // including `NULL` are skipped. + // + // * If the aggregated values contain `NaN`, returns `NaN`. Infinity math + // follows IEEE-754 standards. + // + // * If the aggregated value set is empty, returns 0. + // + // * Returns a 64-bit integer if all aggregated numbers are integers and the + // sum result does not overflow. Otherwise, the result is returned as a + // double. Note that even if all the aggregated values are integers, the + // result is returned as a double if it cannot fit within a 64-bit signed + // integer. When this occurs, the returned value will lose precision. + // + // * When underflow occurs, floating-point aggregation is non-deterministic. + // This means that running the same query repeatedly without any changes to + // the underlying values could produce slightly different results each + // time. In those cases, values should be stored as integers over + // floating-point numbers. + message Sum { + // The property to aggregate on. + PropertyReference property = 1; + } + + // Average of the values of the requested property. + // + // * Only numeric values will be aggregated. All non-numeric values + // including `NULL` are skipped. + // + // * If the aggregated values contain `NaN`, returns `NaN`. Infinity math + // follows IEEE-754 standards. + // + // * If the aggregated value set is empty, returns `NULL`. + // + // * Always returns the result as a double. + message Avg { + // The property to aggregate on. + PropertyReference property = 1; + } + // The type of aggregation to perform, required. oneof operator { // Count aggregator. Count count = 1; + + // Sum aggregator. + Sum sum = 2; + + // Average aggregator. + Avg avg = 3; } // Optional. Optional name of the property to store the result of the @@ -342,8 +390,9 @@ message PropertyFilter { // // Requires: // - // * That `value` is a non-empty `ArrayValue` with at most 10 values. - // * No other `IN` or `NOT_IN` is in the same query. + // * That `value` is a non-empty `ArrayValue`, subject to disjunction + // limits. + // * No `NOT_IN` is in the same query. IN = 6; // The given `property` is not equal to the given `value`. @@ -359,7 +408,7 @@ message PropertyFilter { // Requires: // // * That `value` is an entity key. - // * No other `HAS_ANCESTOR` is in the same query. + // * All evaluated disjunctions must have the same `HAS_ANCESTOR` filter. HAS_ANCESTOR = 11; // The value of the `property` is not in the given array. @@ -367,7 +416,7 @@ message PropertyFilter { // Requires: // // * That `value` is a non-empty `ArrayValue` with at most 10 values. - // * No other `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. + // * No other `OR`, `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. // * That `field` comes first in the `order_by`. NOT_IN = 13; }