@@ -56,7 +56,7 @@ use crate::catalog::Snapshot as CatalogSnapshot;
56
56
use crate :: catalog:: column:: { Int64Type , TypedStatistics } ;
57
57
use crate :: catalog:: manifest:: Manifest ;
58
58
use crate :: catalog:: snapshot:: Snapshot ;
59
- use crate :: event:: { self , DEFAULT_TIMESTAMP_KEY } ;
59
+ use crate :: event:: DEFAULT_TIMESTAMP_KEY ;
60
60
use crate :: handlers:: http:: query:: QueryError ;
61
61
use crate :: option:: Mode ;
62
62
use crate :: parseable:: PARSEABLE ;
@@ -345,7 +345,7 @@ impl CountsRequest {
345
345
. get_stream ( & self . stream )
346
346
. map_err ( |err| anyhow:: Error :: msg ( err. to_string ( ) ) ) ?
347
347
. get_time_partition ( )
348
- . unwrap_or ( event :: DEFAULT_TIMESTAMP_KEY . to_owned ( ) ) ;
348
+ . unwrap_or_else ( || DEFAULT_TIMESTAMP_KEY . to_owned ( ) ) ;
349
349
350
350
// get time range
351
351
let time_range = TimeRange :: parse_human_time ( & self . start_time , & self . end_time ) ?;
@@ -449,7 +449,7 @@ impl CountsRequest {
449
449
let time_partition = PARSEABLE
450
450
. get_stream ( & self . stream ) ?
451
451
. get_time_partition ( )
452
- . unwrap_or ( DEFAULT_TIMESTAMP_KEY . into ( ) ) ;
452
+ . unwrap_or_else ( || DEFAULT_TIMESTAMP_KEY . into ( ) ) ;
453
453
454
454
let time_range = TimeRange :: parse_human_time ( & self . start_time , & self . end_time ) ?;
455
455
@@ -458,20 +458,20 @@ impl CountsRequest {
458
458
let date_bin = if dur. num_minutes ( ) <= 60 * 10 {
459
459
// date_bin 1 minute
460
460
format ! (
461
- "CAST(DATE_BIN('1 minute', \" {}\" .\" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') AS TEXT) as start_time, DATE_BIN('1 minute', \" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') + INTERVAL '1 minute' as end_time" ,
462
- self . stream
461
+ "CAST(DATE_BIN('1 minute', \" {}\" .\" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') AS TEXT) as start_time, DATE_BIN('1 minute', \" {} \" . \" { time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') + INTERVAL '1 minute' as end_time" ,
462
+ self . stream, self . stream
463
463
)
464
464
} else if dur. num_minutes ( ) > 60 * 10 && dur. num_minutes ( ) < 60 * 240 {
465
465
// date_bin 1 hour
466
466
format ! (
467
- "CAST(DATE_BIN('1 hour', \" {}\" .\" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') AS TEXT) as start_time, DATE_BIN('1 hour', \" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') + INTERVAL '1 hour' as end_time" ,
468
- self . stream
467
+ "CAST(DATE_BIN('1 hour', \" {}\" .\" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') AS TEXT) as start_time, DATE_BIN('1 hour', \" {} \" . \" { time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') + INTERVAL '1 hour' as end_time" ,
468
+ self . stream, self . stream
469
469
)
470
470
} else {
471
471
// date_bin 1 day
472
472
format ! (
473
- "CAST(DATE_BIN('1 day', \" {}\" .\" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') AS TEXT) as start_time, DATE_BIN('1 day', \" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') + INTERVAL '1 day' as end_time" ,
474
- self . stream
473
+ "CAST(DATE_BIN('1 day', \" {}\" .\" {time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') AS TEXT) as start_time, DATE_BIN('1 day', \" {} \" . \" { time_partition}\" , TIMESTAMP '1970-01-01 00:00:00+00') + INTERVAL '1 day' as end_time" ,
474
+ self . stream, self . stream
475
475
)
476
476
} ;
477
477
0 commit comments