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).
Instance Attribute Summary collapse
-
#alias ⇒ String
The alias name for the field.
-
#cast ⇒ String
The cast for the field.
-
#field ⇒ String
The field name.
-
#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.
3644 3645 3646 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3644 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
3598 3599 3600 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3598 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
3604 3605 3606 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3604 def cast @cast end |
#field ⇒ String
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
3610 3611 3612 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3610 def field @field end |
#operation ⇒ String
Specifies the role of this field (direct selection, grouping, or aggregation).
Corresponds to the JSON property operation
3615 3616 3617 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3615 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
3626 3627 3628 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3626 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
3632 3633 3634 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3632 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
3642 3643 3644 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3642 def truncation_granularity @truncation_granularity end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
3649 3650 3651 3652 3653 3654 3655 3656 3657 |
# File 'lib/google/apis/logging_v2/classes.rb', line 3649 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 |