Class: Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation

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

Overview

Defines an aggregation that produces a single result.

Defined Under Namespace

Classes: Avg, Count, Sum

Instance Attribute Summary collapse

Instance Attribute Details

#alias::String

Returns Optional. Optional name of the field to store the result of the aggregation into.

If not provided, Firestore will pick a default name following the format field_<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 field_1,
  COUNT_UP_TO(3) AS count_up_to_3,
  COUNT(*) AS field_2
OVER (
  ...
);

Requires:

Returns:

  • (::String)

    Optional. Optional name of the field to store the result of the aggregation into.

    If not provided, Firestore will pick a default name following the format field_<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 field_1,
      COUNT_UP_TO(3) AS count_up_to_3,
      COUNT(*) AS field_2
    OVER (
      ...
    );
    

    Requires:



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'proto_docs/google/firestore/v1/query.rb', line 442

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

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

  # Sum of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Sum
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Average of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Avg
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#avg::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Avg

Returns Average aggregator.



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'proto_docs/google/firestore/v1/query.rb', line 442

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

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

  # Sum of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Sum
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Average of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Avg
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#count::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Count

Returns Count aggregator.



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'proto_docs/google/firestore/v1/query.rb', line 442

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

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

  # Sum of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Sum
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Average of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Avg
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#sum::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Sum

Returns Sum aggregator.



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'proto_docs/google/firestore/v1/query.rb', line 442

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

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

  # Sum of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Sum
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Average of the values of the requested field.
  #
  # * 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.
  # @!attribute [rw] field
  #   @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference]
  #     The field to aggregate on.
  class Avg
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end