@@ -27,21 +27,21 @@ use datafusion::{
2727 sum:: sum,
2828 } ,
2929 logical_expr:: { BinaryExpr , Literal , Operator } ,
30- prelude:: { col , lit , DataFrame , Expr } ,
30+ prelude:: { DataFrame , Expr , col , lit } ,
3131} ;
3232use tracing:: trace;
3333
3434use crate :: {
3535 alerts:: LogicalOperator ,
3636 handlers:: http:: query:: { create_streams_for_distributed, update_schema_when_distributed} ,
3737 parseable:: PARSEABLE ,
38- query:: { resolve_stream_names , QUERY_SESSION } ,
38+ query:: { QUERY_SESSION , resolve_stream_names } ,
3939 utils:: time:: TimeRange ,
4040} ;
4141
4242use super :: {
43- AggregateConfig , AggregateFunction , AggregateResult , Aggregates , AlertConfig , AlertError ,
44- AlertOperator , AlertState , ConditionConfig , Conditions , WhereConfigOperator , ALERTS ,
43+ ALERTS , AggregateConfig , AggregateFunction , AggregateResult , Aggregates , AlertConfig ,
44+ AlertError , AlertOperator , AlertState , ConditionConfig , Conditions , WhereConfigOperator ,
4545} ;
4646
4747/// accept the alert
@@ -473,9 +473,7 @@ fn match_alert_operator(expr: &ConditionConfig) -> Expr {
473473 WhereConfigOperator :: LessThanOrEqual => col ( column) . lt_eq ( lit ( value) ) ,
474474 WhereConfigOperator :: GreaterThanOrEqual => col ( column) . gt_eq ( lit ( value) ) ,
475475 WhereConfigOperator :: ILike => col ( column) . ilike ( lit ( string_value) ) ,
476- WhereConfigOperator :: Contains => {
477- col ( column) . like ( lit ( format ! ( "%{string_value}%" ) ) )
478- } ,
476+ WhereConfigOperator :: Contains => col ( column) . like ( lit ( format ! ( "%{string_value}%" ) ) ) ,
479477 WhereConfigOperator :: BeginsWith => Expr :: BinaryExpr ( BinaryExpr :: new (
480478 Box :: new ( col ( column) ) ,
481479 Operator :: RegexIMatch ,
@@ -497,15 +495,19 @@ fn match_alert_operator(expr: &ConditionConfig) -> Expr {
497495 Operator :: RegexNotIMatch ,
498496 Box :: new ( lit ( format ! ( "{string_value}$" ) ) ) ,
499497 ) ) ,
500- _ => unreachable ! ( "value must not be null for operators other than `is null` and `is not null`. Should've been caught in validation" )
498+ _ => unreachable ! (
499+ "value must not be null for operators other than `is null` and `is not null`. Should've been caught in validation"
500+ ) ,
501501 }
502502 } else {
503503 // for maintaining column case
504504 let column = format ! ( r#""{}""# , expr. column) ;
505505 match expr. operator {
506506 WhereConfigOperator :: IsNull => col ( column) . is_null ( ) ,
507507 WhereConfigOperator :: IsNotNull => col ( column) . is_not_null ( ) ,
508- _ => unreachable ! ( "value must be null for `is null` and `is not null`. Should've been caught in validation" )
508+ _ => unreachable ! (
509+ "value must be null for `is null` and `is not null`. Should've been caught in validation"
510+ ) ,
509511 }
510512 }
511513}
0 commit comments