Reference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::QueryJob::Stage.
Represents a stage in the execution plan for the query.
Inherits
Object
Example
require"google/cloud/bigquery"bigquery=Google::Cloud::Bigquery.newsql="SELECT word FROM `bigquery-public-data.samples.shakespeare`"job=bigquery.query_jobsqljob.wait_until_done!stages=job.query_planstages.eachdo|stage|putsstage.namestage.steps.eachdo|step|putsstep.kindputsstep.substeps.inspectendend
Methods
#compute_ratio_avg
defcompute_ratio_avg()->Float
Relative amount of time the
average shard spent on CPU-bound tasks.
Returns
(Float) — the current value of compute_ratio_avg
#compute_ratio_max
defcompute_ratio_max()->Float
Relative amount of time the
slowest shard spent on CPU-bound tasks.
Returns
(Float) — the current value of compute_ratio_max
#id
defid()->Integer
Unique ID for the stage within the query
plan.
Returns
(Integer) — the current value of id
#name
defname()->String
Human-readable name for the stage.
Returns
(String) — the current value of name
#read_ratio_avg
defread_ratio_avg()->Float
Relative amount of time the
average shard spent reading input.
Returns
(Float) — the current value of read_ratio_avg
#read_ratio_max
defread_ratio_max()->Float
Relative amount of time the
slowest shard spent reading input.
Returns
(Float) — the current value of read_ratio_max
#records_read
defrecords_read()->Integer
Number of records read into the
stage.
Returns
(Integer) — the current value of records_read
#records_written
defrecords_written()->Integer
Number of records written by
the stage.
Returns
(Integer) — the current value of records_written
#status
defstatus()
Returns the value of attribute status.
#steps
defsteps()->Array<Step>
List of operations within the stage
in dependency order (approximately chronological).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# BigQuery API - Class Google::Cloud::Bigquery::QueryJob::Stage (v1.56.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.56.0 (latest)](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.55.0](/ruby/docs/reference/google-cloud-bigquery/1.55.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.54.0](/ruby/docs/reference/google-cloud-bigquery/1.54.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.53.0](/ruby/docs/reference/google-cloud-bigquery/1.53.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.52.1](/ruby/docs/reference/google-cloud-bigquery/1.52.1/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.51.1](/ruby/docs/reference/google-cloud-bigquery/1.51.1/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.50.0](/ruby/docs/reference/google-cloud-bigquery/1.50.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.49.1](/ruby/docs/reference/google-cloud-bigquery/1.49.1/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.48.1](/ruby/docs/reference/google-cloud-bigquery/1.48.1/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.47.0](/ruby/docs/reference/google-cloud-bigquery/1.47.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.46.1](/ruby/docs/reference/google-cloud-bigquery/1.46.1/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.45.0](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.44.2](/ruby/docs/reference/google-cloud-bigquery/1.44.2/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.43.1](/ruby/docs/reference/google-cloud-bigquery/1.43.1/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.42.0](/ruby/docs/reference/google-cloud-bigquery/1.42.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.41.0](/ruby/docs/reference/google-cloud-bigquery/1.41.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.40.0](/ruby/docs/reference/google-cloud-bigquery/1.40.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.39.0](/ruby/docs/reference/google-cloud-bigquery/1.39.0/Google-Cloud-Bigquery-QueryJob-Stage)\n- [1.38.1](/ruby/docs/reference/google-cloud-bigquery/1.38.1/Google-Cloud-Bigquery-QueryJob-Stage) \nReference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::QueryJob::Stage.\n\nRepresents a stage in the execution plan for the query. \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nbigquery = Google::Cloud::Bigquery.new\n\nsql = \"SELECT word FROM `bigquery-public-data.samples.shakespeare`\"\njob = bigquery.query_job sql\n\njob.wait_until_done!\n\nstages = job.query_plan\nstages.each do |stage|\n puts stage.name\n stage.steps.each do |step|\n puts step.kind\n puts step.substeps.inspect\n end\nend\n```\n\nMethods\n-------\n\n### #compute_ratio_avg\n\n def compute_ratio_avg() -\u003e Float\n\nRelative amount of time the\naverage shard spent on CPU-bound tasks. \n**Returns**\n\n- (Float) --- the current value of compute_ratio_avg\n\n### #compute_ratio_max\n\n def compute_ratio_max() -\u003e Float\n\nRelative amount of time the\nslowest shard spent on CPU-bound tasks. \n**Returns**\n\n- (Float) --- the current value of compute_ratio_max\n\n### #id\n\n def id() -\u003e Integer\n\nUnique ID for the stage within the query\nplan. \n**Returns**\n\n- (Integer) --- the current value of id\n\n### #name\n\n def name() -\u003e String\n\nHuman-readable name for the stage. \n**Returns**\n\n- (String) --- the current value of name\n\n### #read_ratio_avg\n\n def read_ratio_avg() -\u003e Float\n\nRelative amount of time the\naverage shard spent reading input. \n**Returns**\n\n- (Float) --- the current value of read_ratio_avg\n\n### #read_ratio_max\n\n def read_ratio_max() -\u003e Float\n\nRelative amount of time the\nslowest shard spent reading input. \n**Returns**\n\n- (Float) --- the current value of read_ratio_max\n\n### #records_read\n\n def records_read() -\u003e Integer\n\nNumber of records read into the\nstage. \n**Returns**\n\n- (Integer) --- the current value of records_read\n\n### #records_written\n\n def records_written() -\u003e Integer\n\nNumber of records written by\nthe stage. \n**Returns**\n\n- (Integer) --- the current value of records_written\n\n### #status\n\n def status()\n\nReturns the value of attribute status.\n\n### #steps\n\n def steps() -\u003e Array\u003cStep\u003e\n\nList of operations within the stage\nin dependency order (approximately chronological). \n**Returns**\n\n- (Array\\\u003c[Step](./Google-Cloud-Bigquery-QueryJob-Step)\\\u003e) --- the current value of steps\n\n### #wait_ratio_avg\n\n def wait_ratio_avg() -\u003e Float\n\nRelative amount of time the\naverage shard spent waiting to be scheduled. \n**Returns**\n\n- (Float) --- the current value of wait_ratio_avg\n\n### #wait_ratio_max\n\n def wait_ratio_max() -\u003e Float\n\nRelative amount of time the\nslowest shard spent waiting to be scheduled. \n**Returns**\n\n- (Float) --- the current value of wait_ratio_max\n\n### #write_ratio_avg\n\n def write_ratio_avg() -\u003e Float\n\nRelative amount of time the\naverage shard spent on writing output. \n**Returns**\n\n- (Float) --- the current value of write_ratio_avg\n\n### #write_ratio_max\n\n def write_ratio_max() -\u003e Float\n\nRelative amount of time the\nslowest shard spent on writing output. \n**Returns**\n\n- (Float) --- the current value of write_ratio_max"]]