@@ -16,31 +16,32 @@ type queryStats struct {
1616}
1717
1818func (s * queryStats ) ProcessCPUTime () time.Duration {
19- if s == nil {
20- return 0
21- }
2219 return s .processCPUTime
2320}
2421
2522func (s * queryStats ) Compilation () (c * stats.CompilationStats ) {
26- if s == nil || s .stats == nil || s .stats .Compilation == nil {
23+ if s .stats == nil || s .stats .Compilation == nil {
2724 return nil
2825 }
29- x := s .stats .Compilation
30- if x == nil {
31- return
32- }
3326 return & stats.CompilationStats {
34- FromCache : x .FromCache ,
35- Duration : time .Microsecond * time .Duration (x .DurationUs ),
36- CPUTime : time .Microsecond * time .Duration (x .CpuTimeUs ),
27+ FromCache : s . stats . Compilation .FromCache ,
28+ Duration : time .Microsecond * time .Duration (s . stats . Compilation .DurationUs ),
29+ CPUTime : time .Microsecond * time .Duration (s . stats . Compilation .CpuTimeUs ),
3730 }
3831}
3932
33+ func (s * queryStats ) QueryPlan () string {
34+ return s .stats .GetQueryPlan ()
35+ }
36+
37+ func (s * queryStats ) QueryAST () string {
38+ return s .stats .GetQueryAst ()
39+ }
40+
4041// NextPhase returns next execution phase within query.
4142// If ok flag is false, then there are no more phases and p is invalid.
4243func (s * queryStats ) NextPhase () (p stats.QueryPhase , ok bool ) {
43- if s .stats == nil || s . pos >= len (s .stats .QueryPhases ) {
44+ if s .pos >= len (s .stats .QueryPhases ) {
4445 return
4546 }
4647 x := s .stats .QueryPhases [s .pos ]
@@ -54,6 +55,7 @@ func (s *queryStats) NextPhase() (p stats.QueryPhase, ok bool) {
5455 duration : time .Microsecond * time .Duration (x .DurationUs ),
5556 cpuTime : time .Microsecond * time .Duration (x .CpuTimeUs ),
5657 affectedShards : x .AffectedShards ,
58+ literalPhase : x .LiteralPhase ,
5759 }, true
5860}
5961
@@ -64,6 +66,7 @@ type queryPhase struct {
6466 affectedShards uint64
6567 tables []* Ydb_TableStats.TableAccessStats
6668 pos int
69+ literalPhase bool
6770}
6871
6972// NextTableAccess returns next accessed table within query execution phase.
@@ -96,6 +99,10 @@ func (q *queryPhase) AffectedShards() uint64 {
9699 return q .affectedShards
97100}
98101
102+ func (q * queryPhase ) IsLiteralPhase () bool {
103+ return q .literalPhase
104+ }
105+
99106func initOperationStats (x * Ydb_TableStats.OperationStats ) stats.OperationStats {
100107 if x == nil {
101108 return stats.OperationStats {}
0 commit comments