class Google::Cloud::Bigquery::Job::ScriptStackFrame

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

@attr_reader [Integer] start_line One-based start line. @attr_reader [Integer] start_column One-based start column. @attr_reader [Integer] end_line One-based end line. @attr_reader [Integer] end_column One-based end column. @attr_reader [String] text Text of the current statement/expression.

@example

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

Attributes

end_column[R]
end_line[R]
start_column[R]
start_line[R]
text[R]

Public Class Methods

from_gapi(gapi) click to toggle source

@private New ScriptStackFrame from a statistics.script_statistics[].stack_frames element.

# File lib/google/cloud/bigquery/job.rb, line 668
def self.from_gapi gapi
  new gapi.start_line, gapi.start_column, gapi.end_line, gapi.end_column, gapi.text
end
new(start_line, start_column, end_line, end_column, text) click to toggle source

@private Creates a new ScriptStackFrame instance.

# File lib/google/cloud/bigquery/job.rb, line 658
def initialize start_line, start_column, end_line, end_column, text
  @start_line = start_line
  @start_column = start_column
  @end_line = end_line
  @end_column = end_column
  @text = text
end