@@ -320,8 +320,16 @@ public static class QueryStatistics extends JobStatistics {
320320
321321 private final Integer billingTier ;
322322 private final Boolean cacheHit ;
323+ private final String ddlOperationPerformed ;
324+ private final TableId ddlTargetTable ;
325+ private final Long estimatedBytesProcessed ;
326+ private final Long numDmlAffectedRows ;
327+ private final List <TableId > referencedTables ;
328+ private final String statementType ;
323329 private final Long totalBytesBilled ;
324330 private final Long totalBytesProcessed ;
331+ private final Long totalPartitionsProcessed ;
332+ private final Long totalSlotMs ;
325333 private final List <QueryStage > queryPlan ;
326334 private final List <TimelineSample > timeline ;
327335 private final Schema schema ;
@@ -330,8 +338,16 @@ static final class Builder extends JobStatistics.Builder<QueryStatistics, Builde
330338
331339 private Integer billingTier ;
332340 private Boolean cacheHit ;
341+ private String ddlOperationPerformed ;
342+ private TableId ddlTargetTable ;
343+ private Long estimatedBytesProcessed ;
344+ private Long numDmlAffectedRows ;
345+ private List <TableId > referencedTables ;
346+ private String statementType ;
333347 private Long totalBytesBilled ;
334348 private Long totalBytesProcessed ;
349+ private Long totalPartitionsProcessed ;
350+ private Long totalSlotMs ;
335351 private List <QueryStage > queryPlan ;
336352 private List <TimelineSample > timeline ;
337353 private Schema schema ;
@@ -343,8 +359,22 @@ private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsP
343359 if (statisticsPb .getQuery () != null ) {
344360 this .billingTier = statisticsPb .getQuery ().getBillingTier ();
345361 this .cacheHit = statisticsPb .getQuery ().getCacheHit ();
362+ this .ddlOperationPerformed = statisticsPb .getQuery ().getDdlOperationPerformed ();
363+ if (statisticsPb .getQuery ().getDdlTargetTable () != null ) {
364+ this .ddlTargetTable = TableId .fromPb (statisticsPb .getQuery ().getDdlTargetTable ());
365+ }
366+ this .estimatedBytesProcessed = statisticsPb .getQuery ().getEstimatedBytesProcessed ();
367+ this .numDmlAffectedRows = statisticsPb .getQuery ().getNumDmlAffectedRows ();
368+ this .statementType = statisticsPb .getQuery ().getStatementType ();
346369 this .totalBytesBilled = statisticsPb .getQuery ().getTotalBytesBilled ();
347370 this .totalBytesProcessed = statisticsPb .getQuery ().getTotalBytesProcessed ();
371+ this .totalPartitionsProcessed = statisticsPb .getQuery ().getTotalPartitionsProcessed ();
372+ this .totalSlotMs = statisticsPb .getQuery ().getTotalSlotMs ();
373+ if (statisticsPb .getQuery ().getReferencedTables () != null ) {
374+ this .referencedTables =
375+ Lists .transform (
376+ statisticsPb .getQuery ().getReferencedTables (), TableId .FROM_PB_FUNCTION );
377+ }
348378 if (statisticsPb .getQuery ().getQueryPlan () != null ) {
349379 this .queryPlan =
350380 Lists .transform (
@@ -371,6 +401,36 @@ Builder setCacheHit(Boolean cacheHit) {
371401 return self ();
372402 }
373403
404+ Builder setDDLOperationPerformed (String ddlOperationPerformed ) {
405+ this .ddlOperationPerformed = ddlOperationPerformed ;
406+ return self ();
407+ }
408+
409+ Builder setDDLTargetTable (TableId ddlTargetTable ) {
410+ this .ddlTargetTable = ddlTargetTable ;
411+ return self ();
412+ }
413+
414+ Builder setEstimatedBytesProcessed (Long estimatedBytesProcessed ) {
415+ this .estimatedBytesProcessed = estimatedBytesProcessed ;
416+ return self ();
417+ }
418+
419+ Builder setNumDmlAffectedRows (Long numDmlAffectedRows ) {
420+ this .numDmlAffectedRows = numDmlAffectedRows ;
421+ return self ();
422+ }
423+
424+ Builder setReferenceTables (List <TableId > referencedTables ) {
425+ this .referencedTables = referencedTables ;
426+ return self ();
427+ }
428+
429+ Builder setStatementType (String statementType ) {
430+ this .statementType = statementType ;
431+ return self ();
432+ }
433+
374434 Builder setTotalBytesBilled (Long totalBytesBilled ) {
375435 this .totalBytesBilled = totalBytesBilled ;
376436 return self ();
@@ -381,6 +441,16 @@ Builder setTotalBytesProcessed(Long totalBytesProcessed) {
381441 return self ();
382442 }
383443
444+ Builder setTotalPartitionsProcessed (Long totalPartitionsProcessed ) {
445+ this .totalPartitionsProcessed = totalPartitionsProcessed ;
446+ return self ();
447+ }
448+
449+ Builder setTotalSlotMs (Long totalSlotMs ) {
450+ this .totalSlotMs = totalSlotMs ;
451+ return self ();
452+ }
453+
384454 Builder setQueryPlan (List <QueryStage > queryPlan ) {
385455 this .queryPlan = queryPlan ;
386456 return self ();
@@ -406,8 +476,16 @@ private QueryStatistics(Builder builder) {
406476 super (builder );
407477 this .billingTier = builder .billingTier ;
408478 this .cacheHit = builder .cacheHit ;
479+ this .ddlOperationPerformed = builder .ddlOperationPerformed ;
480+ this .ddlTargetTable = builder .ddlTargetTable ;
481+ this .estimatedBytesProcessed = builder .estimatedBytesProcessed ;
482+ this .numDmlAffectedRows = builder .numDmlAffectedRows ;
483+ this .referencedTables = builder .referencedTables ;
484+ this .statementType = builder .statementType ;
409485 this .totalBytesBilled = builder .totalBytesBilled ;
410486 this .totalBytesProcessed = builder .totalBytesProcessed ;
487+ this .totalPartitionsProcessed = builder .totalPartitionsProcessed ;
488+ this .totalSlotMs = builder .totalSlotMs ;
411489 this .queryPlan = builder .queryPlan ;
412490 this .timeline = builder .timeline ;
413491 this .schema = builder .schema ;
@@ -432,6 +510,47 @@ public Boolean getCacheHit() {
432510 return cacheHit ;
433511 }
434512
513+ /**
514+ * [BETA] For DDL queries, returns the operation applied to the DDL target table.
515+ */
516+ public String getDdlOperationPerformed () { return ddlOperationPerformed ; }
517+
518+ /**
519+ * [BETA] For DDL queries, returns the TableID of the targeted table.
520+ */
521+ public TableId getDdlTargetTable () { return ddlTargetTable ; }
522+
523+ /**
524+ * The original estimate of bytes processed for the job.
525+ */
526+ public Long getEstimatedBytesProcessed () { return estimatedBytesProcessed ; }
527+
528+ /**
529+ * The number of rows affected by a DML statement.
530+ * Present only for DML statements INSERT, UPDATE or DELETE.
531+ */
532+ public Long getNumDmlAffectedRows () { return numDmlAffectedRows ; }
533+
534+ /**
535+ * Referenced tables for the job.
536+ * Queries that reference more than 50 tables will not have a complete list.
537+ */
538+ public List <TableId > getReferencedTables () { return referencedTables ; }
539+
540+ /**
541+ * [BETA] The type of query statement, if valid.
542+ * Possible values include:
543+ * SELECT
544+ * INSERT
545+ * UPDATE
546+ * DELETE
547+ * CREATE_TABLE
548+ * CREATE_TABLE_AS_SELECT
549+ * DROP_TABLE
550+ * CREATE_VIEW
551+ * DROP_VIEW
552+ */
553+ public String getStatementType () { return statementType ; }
435554
436555 /**
437556 * Returns the total number of bytes billed for the job.
@@ -448,6 +567,15 @@ public Long getTotalBytesProcessed() {
448567 return totalBytesProcessed ;
449568 }
450569
570+ /**
571+ * Total number of partitions processed from all partitioned tables referenced in the job.
572+ */
573+ public Long getTotalPartitionsProcessed () { return totalPartitionsProcessed ; }
574+
575+ /**
576+ * Returns the slot-milliseconds consumed by the query.
577+ */
578+ public Long getTotalSlotMs () { return totalSlotMs ; }
451579
452580 /**
453581 * Returns the query plan as a list of stages or {@code null} if a query plan is not available.
0 commit comments