@@ -419,6 +419,10 @@ type LoadStatistics struct {
419
419
420
420
// QueryStatistics contains statistics about a query job.
421
421
type QueryStatistics struct {
422
+
423
+ // BI-Engine specific statistics.
424
+ BIEngineStatistics * BIEngineStatistics
425
+
422
426
// Billing tier for the job.
423
427
BillingTier int64
424
428
@@ -483,6 +487,51 @@ type QueryStatistics struct {
483
487
DDLTargetRoutine * Routine
484
488
}
485
489
490
+ // BIEngineStatistics contains query statistics specific to the use of BI Engine.
491
+ type BIEngineStatistics struct {
492
+ // Specifies which mode of BI Engine acceleration was performed.
493
+ BIEngineMode string
494
+
495
+ // In case of DISABLED or PARTIAL BIEngineMode, these
496
+ // contain the explanatory reasons as to why BI Engine could not
497
+ // accelerate. In case the full query was accelerated, this field is not
498
+ // populated.
499
+ BIEngineReasons []* BIEngineReason
500
+ }
501
+
502
+ func bqToBIEngineStatistics (in * bq.BiEngineStatistics ) * BIEngineStatistics {
503
+ if in == nil {
504
+ return nil
505
+ }
506
+ stats := & BIEngineStatistics {
507
+ BIEngineMode : in .BiEngineMode ,
508
+ }
509
+ for _ , v := range in .BiEngineReasons {
510
+ stats .BIEngineReasons = append (stats .BIEngineReasons , bqToBIEngineReason (v ))
511
+ }
512
+ return stats
513
+ }
514
+
515
+ // BIEngineReason contains more detailed information about why a query wasn't fully
516
+ // accelerated.
517
+ type BIEngineReason struct {
518
+ // High-Level BI engine reason for partial or disabled acceleration.
519
+ Code string
520
+
521
+ // Human-readable reason for partial or disabled acceleration.
522
+ Message string
523
+ }
524
+
525
+ func bqToBIEngineReason (in * bq.BiEngineReason ) * BIEngineReason {
526
+ if in == nil {
527
+ return nil
528
+ }
529
+ return & BIEngineReason {
530
+ Code : in .Code ,
531
+ Message : in .Message ,
532
+ }
533
+ }
534
+
486
535
// ExplainQueryStage describes one stage of a query.
487
536
type ExplainQueryStage struct {
488
537
// CompletedParallelInputs: Number of parallel input segments completed.
@@ -922,6 +971,7 @@ func (j *Job) setStatistics(s *bq.JobStatistics, c *Client) {
922
971
tables = append (tables , bqToTable (tr , c ))
923
972
}
924
973
js .Details = & QueryStatistics {
974
+ BIEngineStatistics : bqToBIEngineStatistics (s .Query .BiEngineStatistics ),
925
975
BillingTier : s .Query .BillingTier ,
926
976
CacheHit : s .Query .CacheHit ,
927
977
DDLTargetTable : bqToTable (s .Query .DdlTargetTable , c ),
0 commit comments