@@ -381,13 +381,36 @@ func (j *Job) waitForQuery(ctx context.Context, projectID string) (Schema, uint6
381381
382382// JobStatistics contains statistics about a job.
383383type JobStatistics struct {
384- CreationTime time.Time
385- StartTime time.Time
386- EndTime time.Time
384+ // CreationTime is the creation time of this job.
385+ // This field will be present on all jobs.
386+ CreationTime time.Time
387+
388+ // StartTime is the start time of this job.
389+ // This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
390+ StartTime time.Time
391+
392+ // EndTime is the end time of this job.
393+ // This field will be present whenever a job is in the DONE state.
394+ EndTime time.Time
395+
396+ // TotalBytesProcessed is the total bytes processed for the job.
387397 TotalBytesProcessed int64
388398
399+ // Details is the jobType-specific statistics for the job
389400 Details Statistics
390401
402+ // TotalSlotDuration is the slot duration for the job.
403+ TotalSlotDuration time.Duration
404+
405+ // ReservationUsage attributes slot consumption to reservations.
406+ // This field reported misleading information and will no longer be populated.
407+ ReservationUsage []* ReservationUsage
408+
409+ // ReservationID is the name of the primary reservation assigned to this job.
410+ // Note that this could be different than reservations reported in the reservation
411+ // usage field if parent reservations were used to execute this job.
412+ ReservationID string
413+
391414 // NumChildJobs indicates the number of child jobs run as part of a script.
392415 NumChildJobs int64
393416
@@ -398,14 +421,19 @@ type JobStatistics struct {
398421 // a script.
399422 ScriptStatistics * ScriptStatistics
400423
401- // ReservationUsage attributes slot consumption to reservations.
402- ReservationUsage []* ReservationUsage
403-
404424 // TransactionInfo indicates the transaction ID associated with the job, if any.
405425 TransactionInfo * TransactionInfo
406426
407427 // SessionInfo contains information about the session if this job is part of one.
408428 SessionInfo * SessionInfo
429+
430+ // FinalExecutionDuration is the duration of the execution of the final
431+ // attempt of this job, as BigQuery may internally re-attempt to execute the job.
432+ FinalExecutionDuration time.Duration
433+
434+ // Edition is the name of edition corresponding to the reservation for this job
435+ // at the time of this update.
436+ Edition ReservationEdition
409437}
410438
411439// Statistics is one of ExtractStatistics, LoadStatistics or QueryStatistics.
@@ -697,6 +725,23 @@ type QueryTimelineSample struct {
697725 SlotMillis int64
698726}
699727
728+ // ReservationEdition is used to specify the name of edition corresponding to the reservation.
729+ type ReservationEdition string
730+
731+ var (
732+ // ReservationEditionUnspecified is the default value, which will be treated as ReservationEditionEnterprise
733+ ReservationEditionUnspecified ReservationEdition = "RESERVATION_EDITION_UNSPECIFIED"
734+
735+ // ReservationEditionStandard represents the Standard edition.
736+ ReservationEditionStandard ReservationEdition = "STANDARD"
737+
738+ // ReservationEditionEnterprise represents the Enterprise edition.
739+ ReservationEditionEnterprise ReservationEdition = "ENTERPRISE"
740+
741+ // ReservationEditionEnterprisePlus represents the Enterprise Plus edition.
742+ ReservationEditionEnterprisePlus ReservationEdition = "ENTERPRISE_PLUS"
743+ )
744+
700745// ReservationUsage contains information about a job's usage of a single reservation.
701746type ReservationUsage struct {
702747 // SlotMillis reports the slot milliseconds utilized within in the given reservation.
@@ -1014,16 +1059,20 @@ func (j *Job) setStatistics(s *bq.JobStatistics, c *Client) {
10141059 return
10151060 }
10161061 js := & JobStatistics {
1017- CreationTime : unixMillisToTime (s .CreationTime ),
1018- StartTime : unixMillisToTime (s .StartTime ),
1019- EndTime : unixMillisToTime (s .EndTime ),
1020- TotalBytesProcessed : s .TotalBytesProcessed ,
1021- NumChildJobs : s .NumChildJobs ,
1022- ParentJobID : s .ParentJobId ,
1023- ScriptStatistics : bqToScriptStatistics (s .ScriptStatistics ),
1024- ReservationUsage : bqToReservationUsage (s .ReservationUsage ),
1025- TransactionInfo : bqToTransactionInfo (s .TransactionInfo ),
1026- SessionInfo : bqToSessionInfo (s .SessionInfo ),
1062+ CreationTime : unixMillisToTime (s .CreationTime ),
1063+ StartTime : unixMillisToTime (s .StartTime ),
1064+ EndTime : unixMillisToTime (s .EndTime ),
1065+ TotalBytesProcessed : s .TotalBytesProcessed ,
1066+ TotalSlotDuration : time .Duration (s .TotalSlotMs ) * time .Millisecond ,
1067+ ReservationUsage : bqToReservationUsage (s .ReservationUsage ),
1068+ ReservationID : s .ReservationId ,
1069+ NumChildJobs : s .NumChildJobs ,
1070+ ParentJobID : s .ParentJobId ,
1071+ ScriptStatistics : bqToScriptStatistics (s .ScriptStatistics ),
1072+ TransactionInfo : bqToTransactionInfo (s .TransactionInfo ),
1073+ SessionInfo : bqToSessionInfo (s .SessionInfo ),
1074+ FinalExecutionDuration : time .Duration (s .FinalExecutionDurationMs ) * time .Millisecond ,
1075+ Edition : ReservationEdition (s .Edition ),
10271076 }
10281077 switch {
10291078 case s .Extract != nil :
0 commit comments