@@ -78,33 +78,42 @@ public ExplainQueryStep apply(QueryStep stage) {
7878 };
7979 private static final long serialVersionUID = 8663444604771794411L ;
8080
81- private final String kind ;
81+ private final String name ;
8282 private final List <String > substeps ;
8383
84- QueryStep (String kind , List <String > substeps ) {
85- this .kind = kind ;
84+ QueryStep (String name , List <String > substeps ) {
85+ this .name = name ;
8686 this .substeps = substeps ;
8787 }
8888
89- public String kind () {
90- return kind ;
89+ /**
90+ * Returns a machine-readable name for the operation.
91+ *
92+ * @see <a href="https://cloud.google.com/bigquery/query-plan-explanation#steps_metadata">Steps
93+ * Metadata</a>
94+ */
95+ public String name () {
96+ return name ;
9197 }
9298
99+ /**
100+ * Returns a list of human-readable stage descriptions.
101+ */
93102 public List <String > substeps () {
94103 return substeps ;
95104 }
96105
97106 @ Override
98107 public String toString () {
99108 return MoreObjects .toStringHelper (this )
100- .add ("kind " , kind )
109+ .add ("name " , name )
101110 .add ("substeps" , substeps )
102111 .toString ();
103112 }
104113
105114 @ Override
106115 public int hashCode () {
107- return Objects .hash (kind , substeps );
116+ return Objects .hash (name , substeps );
108117 }
109118
110119 @ Override
@@ -113,20 +122,16 @@ public boolean equals(Object obj) {
113122 return false ;
114123 }
115124 QueryStep other = (QueryStep ) obj ;
116- return Objects .equals (kind , other .kind )
117- && Objects .equals (substeps , other .substeps );
125+ return Objects .equals (name , other .name ) && Objects .equals (substeps , other .substeps );
118126 }
119127
120128 ExplainQueryStep toPb () {
121- return new ExplainQueryStep ().setKind (kind ).setSubsteps (substeps );
129+ return new ExplainQueryStep ().setKind (name ).setSubsteps (substeps );
122130 }
123131
124132 static QueryStep fromPb (com .google .api .services .bigquery .model .ExplainQueryStep stepPb ) {
125- List <String > substeps = null ;
126- if (stepPb .getSubsteps () != null ) {
127- substeps = ImmutableList .copyOf (stepPb .getSubsteps ());
128- }
129- return new QueryStep (stepPb .getKind (), substeps );
133+ return new QueryStep (stepPb .getKind (), ImmutableList .copyOf (stepPb .getSubsteps () != null
134+ ? stepPb .getSubsteps () : ImmutableList .<String >of ()));
130135 }
131136 }
132137
@@ -249,14 +254,16 @@ QueryStage build() {
249254 }
250255
251256 /**
252- * Returns the relative amount of time the average shard spent on CPU-bound tasks.
257+ * Returns the time the average worker spent CPU-bound, divided by the longest time spent by any
258+ * worker in any segment.
253259 */
254260 public double computeRatioAvg () {
255261 return computeRatioAvg ;
256262 }
257263
258264 /**
259- * Returns the relative amount of time the slowest shard spent on CPU-bound tasks.
265+ * Returns the time the slowest worker spent CPU-bound, divided by the longest time spent by any
266+ * worker in any segment.
260267 */
261268 public double computeRatioMax () {
262269 return computeRatioMax ;
@@ -277,28 +284,30 @@ public String name() {
277284 }
278285
279286 /**
280- * Returns the relative amount of time the average shard spent reading input.
287+ * Returns the time the average worker spent reading input data, divided by the longest time spent
288+ * by any worker in any segment.
281289 */
282290 public double readRatioAvg () {
283291 return readRatioAvg ;
284292 }
285293
286294 /**
287- * Returns the relative amount of time the slowest shard spent reading input.
295+ * Returns the time the slowest worker spent reading input data, divided by the longest time spent
296+ * by any worker in any segment.
288297 */
289298 public double readRatioMax () {
290299 return readRatioMax ;
291300 }
292301
293302 /**
294- * Returns the number of records read into the stage.
303+ * Returns the number of rows (top-level records) read by the stage.
295304 */
296305 public long recordsRead () {
297306 return recordsRead ;
298307 }
299308
300309 /**
301- * Returns the number of records written by the stage.
310+ * Returns the number of rows (top-level records) written by the stage.
302311 */
303312 public long recordsWritten () {
304313 return recordsWritten ;
@@ -312,28 +321,32 @@ public List<QueryStep> steps() {
312321 }
313322
314323 /**
315- * Returns the relative amount of time the average shard spent waiting to be scheduled.
324+ * Returns the time the average worker spent waiting to be scheduled, divided by the longest time
325+ * spent by any worker in any segment.
316326 */
317327 public double waitRatioAvg () {
318328 return waitRatioAvg ;
319329 }
320330
321331 /**
322- * Returns the relative amount of time the slowest shard spent waiting to be scheduled.
332+ * Returns the time the slowest worker spent waiting to be scheduled, divided by the longest time
333+ * spent by any worker in any segment.
323334 */
324335 public double waitRatioMax () {
325336 return waitRatioMax ;
326337 }
327338
328339 /**
329- * Returns the relative amount of time the average shard spent on writing output.
340+ * Returns the time the average worker spent writing output data, divided by the longest time
341+ * spent by any worker in any segment.
330342 */
331343 public double writeRatioAvg () {
332344 return writeRatioAvg ;
333345 }
334346
335347 /**
336- * Returns the relative amount of time the slowest shard spent on writing output.
348+ * Returns the time the slowest worker spent writing output data, divided by the longest time
349+ * spent by any worker in any segment.
337350 */
338351 public double writeRatioMax () {
339352 return writeRatioMax ;
0 commit comments