Class: Google::Apis::LoggingV2::ProjectedField
- Inherits:
-
Object
- Object
- Google::Apis::LoggingV2::ProjectedField
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/logging_v2/classes.rb,
lib/google/apis/logging_v2/representations.rb,
lib/google/apis/logging_v2/representations.rb
Overview
Represents a field selected in the query, analogous to an item in a SQL SELECT clause. It specifies the source field and optionally applies transformations like aggregation, casting, regex extraction, or assigns an alias. Use ProjectedField when you need more than just the raw source field name (for which you might use FieldSource directly in QueryBuilderConfig's field_sources list if no transformations or specific operation type are needed).A ProjectedField can represent either a field present in the data schema ( specified via the field property) or a virtual field that is computed from other fields (specified via the virtual_field property).
Instance Attribute Summary collapse
-
#alias ⇒ String
The alias name for the field.
-
#cast ⇒ String
The cast for the field.
-
#field ⇒ String
Optional.
-
#operation ⇒ String
Specifies the role of this field (direct selection, grouping, or aggregation).
-
#regex_extraction ⇒ String
The re2 extraction for the field.
-
#sql_aggregation_function ⇒ Google::Apis::LoggingV2::FunctionApplication
Defines the aggregation function to apply to this field.
-
#truncation_granularity ⇒ String
The truncation granularity when grouping by a time/date field.
Instance Method Summary collapse
-
#initialize(**args) ⇒ ProjectedField
constructor
A new instance of ProjectedField.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ ProjectedField
Returns a new instance of ProjectedField.
3656 3657 3658 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3656 def initialize(**args) update!(**args) end |
Instance Attribute Details
#alias ⇒ String
The alias name for the field. Valid alias examples are: - single word alias:
TestAlias - numbers in an alias: Alias123 - multi word alias should be
enclosed in quotes: "Test Alias" Invalid alias examples are: - alias
containing keywords: WHERE, SELECT, FROM, etc. - alias starting with a number:
1stAlias
Corresponds to the JSON property alias
3610 3611 3612 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3610 def alias @alias end |
#cast ⇒ String
The cast for the field. This can any SQL cast type. Examples: - STRING - CHAR -
DATE - TIMESTAMP - DATETIME - INT - FLOAT
Corresponds to the JSON property cast
3616 3617 3618 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3616 def cast @cast end |
#field ⇒ String
Optional. The field name. This will be the field that is selected using the
dot notation to display the drill down value.
Corresponds to the JSON property field
3622 3623 3624 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3622 def field @field end |
#operation ⇒ String
Specifies the role of this field (direct selection, grouping, or aggregation).
Corresponds to the JSON property operation
3627 3628 3629 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3627 def operation @operation end |
#regex_extraction ⇒ String
The re2 extraction for the field. This will be used to extract the value from
the field using REGEXP_EXTRACT. More information on re2 can be found here:
https://github.com/google/re2/wiki/Syntax. Meta characters like +?()| will
need to be escaped. Examples: - ".(autoscaler.)$" will be converted to
REGEXP_EXTRACT(JSON_VALUE(field),"request(.(autoscaler.*)$)")in SQL. - "(
test_value)$" will be converted to REGEXP_EXTRACT(JSON_VALUE(field),"request(\
(test_value)$)") in SQL.
Corresponds to the JSON property regexExtraction
3638 3639 3640 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3638 def regex_extraction @regex_extraction end |
#sql_aggregation_function ⇒ Google::Apis::LoggingV2::FunctionApplication
Defines the aggregation function to apply to this field. This message is used
only when operation is set to AGGREGATE.
Corresponds to the JSON property sqlAggregationFunction
3644 3645 3646 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3644 def sql_aggregation_function @sql_aggregation_function end |
#truncation_granularity ⇒ String
The truncation granularity when grouping by a time/date field. This will be
used to truncate the field to the granularity specified. This can be either a
date or a time granularity found at https://cloud.google.com/bigquery/docs/
reference/standard-sql/timestamp_functions#timestamp_trunc_granularity_date
and https://cloud.google.com/bigquery/docs/reference/standard-sql/
timestamp_functions#timestamp_trunc_granularity_time respectively.
Corresponds to the JSON property truncationGranularity
3654 3655 3656 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3654 def truncation_granularity @truncation_granularity end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
3661 3662 3663 3664 3665 3666 3667 3668 3669 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3661 def update!(**args) @alias = args[:alias] if args.key?(:alias) @cast = args[:cast] if args.key?(:cast) @field = args[:field] if args.key?(:field) @operation = args[:operation] if args.key?(:operation) @regex_extraction = args[:regex_extraction] if args.key?(:regex_extraction) @sql_aggregation_function = args[:sql_aggregation_function] if args.key?(:sql_aggregation_function) @truncation_granularity = args[:truncation_granularity] if args.key?(:truncation_granularity) end |