Class: Google::Cloud::Bigquery::Job::ScriptStackFrame

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/bigquery/job.rb

Overview

Represents a stack frame showing the line/column/procedure name where the current evaluation happened.

Examples:

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new

multi_statement_sql = <<~SQL
  -- Declare a variable to hold names as an array.
  DECLARE top_names ARRAY<STRING>;
  -- Build an array of the top 100 names from the year 2017.
  SET top_names = (
  SELECT ARRAY_AGG(name ORDER BY number DESC LIMIT 100)
  FROM `bigquery-public-data.usa_names.usa_1910_current`
  WHERE year = 2017
  );
  -- Which names appear as words in Shakespeare's plays?
  SELECT
  name AS shakespeare_name
  FROM UNNEST(top_names) AS name
  WHERE name IN (
  SELECT word
  FROM `bigquery-public-data.samples.shakespeare`
  );
SQL

job = bigquery.query_job multi_statement_sql

job.wait_until_done!

child_jobs = bigquery.jobs parent_job: job

child_jobs.each do |child_job|
  script_statistics = child_job.script_statistics
  puts script_statistics.evaluation_kind
  script_statistics.stack_frames.each do |stack_frame|
    puts stack_frame.text
  end
end

Lifecycle collapse

Instance Attribute Details

#end_columnInteger (readonly)

One-based end column.

Returns:

  • (Integer)

    the current value of end_column



681
682
683
# File 'lib/google/cloud/bigquery/job.rb', line 681

def end_column
  @end_column
end

#end_lineInteger (readonly)

One-based end line.

Returns:

  • (Integer)

    the current value of end_line



681
682
683
# File 'lib/google/cloud/bigquery/job.rb', line 681

def end_line
  @end_line
end

#start_columnInteger (readonly)

One-based start column.

Returns:

  • (Integer)

    the current value of start_column



681
682
683
# File 'lib/google/cloud/bigquery/job.rb', line 681

def start_column
  @start_column
end

#start_lineInteger (readonly)

One-based start line.

Returns:

  • (Integer)

    the current value of start_line



681
682
683
# File 'lib/google/cloud/bigquery/job.rb', line 681

def start_line
  @start_line
end

#textString (readonly)

Text of the current statement/expression.

Returns:

  • (String)

    the current value of text



681
682
683
# File 'lib/google/cloud/bigquery/job.rb', line 681

def text
  @text
end