Class: Google::Cloud::Datastore::V1::AggregationQuery

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/datastore/v1/query.rb

Overview

Datastore query for running an aggregation over a Query.

Defined Under Namespace

Classes: Aggregation

Instance Attribute Summary collapse

Instance Attribute Details

#aggregations::Array<::Google::Cloud::Datastore::V1::AggregationQuery::Aggregation>

Returns Optional. Series of aggregations to apply over the results of the nested_query.

Requires:

  • A minimum of one and maximum of five aggregations per query.

Returns:



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'proto_docs/google/datastore/v1/query.rb', line 143

class AggregationQuery
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines an aggregation that produces a single result.
  # @!attribute [rw] count
  #   @return [::Google::Cloud::Datastore::V1::AggregationQuery::Aggregation::Count]
  #     Count aggregator.
  # @!attribute [rw] alias
  #   @return [::String]
  #     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.
  class Aggregation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Count of entities that match the query.
    #
    # The `COUNT(*)` aggregation function operates on the entire entity
    # so it does not require a field reference.
    # @!attribute [rw] up_to
    #   @return [::Google::Protobuf::Int64Value]
    #     Optional. Optional constraint on the maximum number of entities to
    #     count.
    #
    #     This provides a way to set an upper bound on the number of entities
    #     to scan, limiting latency, and cost.
    #
    #     Unspecified is interpreted as no bound.
    #
    #     If a zero value is provided, a count result of zero should always be
    #     expected.
    #
    #     High-Level Example:
    #
    #     ```
    #     AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
    #     ```
    #
    #     Requires:
    #
    #     * Must be non-negative when present.
    class Count
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#nested_query::Google::Cloud::Datastore::V1::Query

Returns Nested query for aggregation.

Returns:



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'proto_docs/google/datastore/v1/query.rb', line 143

class AggregationQuery
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines an aggregation that produces a single result.
  # @!attribute [rw] count
  #   @return [::Google::Cloud::Datastore::V1::AggregationQuery::Aggregation::Count]
  #     Count aggregator.
  # @!attribute [rw] alias
  #   @return [::String]
  #     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.
  class Aggregation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Count of entities that match the query.
    #
    # The `COUNT(*)` aggregation function operates on the entire entity
    # so it does not require a field reference.
    # @!attribute [rw] up_to
    #   @return [::Google::Protobuf::Int64Value]
    #     Optional. Optional constraint on the maximum number of entities to
    #     count.
    #
    #     This provides a way to set an upper bound on the number of entities
    #     to scan, limiting latency, and cost.
    #
    #     Unspecified is interpreted as no bound.
    #
    #     If a zero value is provided, a count result of zero should always be
    #     expected.
    #
    #     High-Level Example:
    #
    #     ```
    #     AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
    #     ```
    #
    #     Requires:
    #
    #     * Must be non-negative when present.
    class Count
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end