@@ -56,7 +56,7 @@ use crate::catalog::Snapshot as CatalogSnapshot;
5656use crate::catalog::column::{Int64Type, TypedStatistics};
5757use crate::catalog::manifest::Manifest;
5858use crate::catalog::snapshot::Snapshot;
59- use crate::event::{self, DEFAULT_TIMESTAMP_KEY} ;
59+ use crate::event::DEFAULT_TIMESTAMP_KEY;
6060use crate::handlers::http::query::QueryError;
6161use crate::option::Mode;
6262use crate::parseable::PARSEABLE;
@@ -345,7 +345,7 @@ impl CountsRequest {
345345 .get_stream(&self.stream)
346346 .map_err(|err| anyhow::Error::msg(err.to_string()))?
347347 .get_time_partition()
348- .unwrap_or(event:: DEFAULT_TIMESTAMP_KEY.to_owned());
348+ .unwrap_or_else(|| DEFAULT_TIMESTAMP_KEY.to_owned());
349349
350350 // get time range
351351 let time_range = TimeRange::parse_human_time(&self.start_time, &self.end_time)?;
@@ -449,7 +449,7 @@ impl CountsRequest {
449449 let time_partition = PARSEABLE
450450 .get_stream(&self.stream)?
451451 .get_time_partition()
452- .unwrap_or( DEFAULT_TIMESTAMP_KEY.into());
452+ .unwrap_or_else(|| DEFAULT_TIMESTAMP_KEY.into());
453453
454454 let time_range = TimeRange::parse_human_time(&self.start_time, &self.end_time)?;
455455
@@ -458,20 +458,20 @@ impl CountsRequest {
458458 let date_bin = if dur.num_minutes() <= 60 * 10 {
459459 // date_bin 1 minute
460460 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
463463 )
464464 } else if dur.num_minutes() > 60 * 10 && dur.num_minutes() < 60 * 240 {
465465 // date_bin 1 hour
466466 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
469469 )
470470 } else {
471471 // date_bin 1 day
472472 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
475475 )
476476 };
477477
0 commit comments