File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/store/reducers/executeTopQueries Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 11import { ITopQueriesFilters } from './types' ;
22
3+ const endTimeColumn = 'EndTime' ;
4+ const intervalEndColumn = 'IntervalEnd' ;
5+
36const getMaxIntervalSubquery = ( path : string ) => `(
47 SELECT
5- MAX(IntervalEnd )
8+ MAX(${ intervalEndColumn } )
69 FROM \`${ path } /.sys/top_queries_by_cpu_time_one_hour\`
710)` ;
811
@@ -17,15 +20,18 @@ export function getFiltersConditions(path: string, filters?: ITopQueriesFilters)
1720 // matching `from` & `to` is an edge case
1821 // other cases should not include the starting point, since intervals are stored using the ending time
1922 const gt = filters . to === filters . from ? '>=' : '>' ;
20- conditions . push ( `IntervalEnd ${ gt } Timestamp('${ new Date ( filters . from ) . toISOString ( ) } ')` ) ;
23+ conditions . push (
24+ `${ endTimeColumn } ${ gt } Timestamp('${ new Date ( filters . from ) . toISOString ( ) } ')` ,
25+ ) ;
2126 }
2227
2328 if ( filters ?. to ) {
24- conditions . push ( `IntervalEnd <= Timestamp('${ new Date ( filters . to ) . toISOString ( ) } ')` ) ;
29+ conditions . push ( `${ endTimeColumn } <= Timestamp('${ new Date ( filters . to ) . toISOString ( ) } ')` ) ;
2530 }
2631
32+ // If there is no filters, return queries, that were executed in the last hour
2733 if ( ! filters ?. from && ! filters ?. to ) {
28- conditions . push ( `IntervalEnd IN ${ getMaxIntervalSubquery ( path ) } ` ) ;
34+ conditions . push ( `${ intervalEndColumn } IN ${ getMaxIntervalSubquery ( path ) } ` ) ;
2935 }
3036
3137 if ( filters ?. text ) {
You can’t perform that action at this time.
0 commit comments