File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,13 @@ pub async fn query(req: HttpRequest, query_request: Query) -> Result<HttpRespons
100100 let table_name = query
101101 . first_table_name ( )
102102 . ok_or_else ( || QueryError :: MalformedQuery ( "No table name found in query" ) ) ?;
103- let time = Instant :: now ( ) ;
104103
104+ user_auth_for_query ( & permissions, & tables) ?;
105+
106+ let time = Instant :: now ( ) ;
107+ println ! ( "{:?}" , query. is_logical_plan_count_without_filters( ) ) ;
105108 if let Some ( column_name) = query. is_logical_plan_count_without_filters ( ) {
109+ println ! ( "logical plan count without filters" ) ;
106110 let date_bin_request = DateBinRequest {
107111 stream : table_name. clone ( ) ,
108112 start_time : query_request. start_time . clone ( ) ,
@@ -127,9 +131,6 @@ pub async fn query(req: HttpRequest, query_request: Query) -> Result<HttpRespons
127131
128132 return Ok ( HttpResponse :: Ok ( ) . json ( response) ) ;
129133 }
130-
131- user_auth_for_query ( & permissions, & tables) ?;
132-
133134 let ( records, fields) = query. execute ( table_name. clone ( ) ) . await ?;
134135
135136 let response = QueryResponse {
Original file line number Diff line number Diff line change @@ -217,22 +217,22 @@ impl Query {
217217 } ;
218218
219219 // Ensure the input of the Aggregate is a TableScan and there is exactly one expression: SELECT COUNT(*)
220- if !matches ! ( & * * input, LogicalPlan :: TableScan { .. } ) || expr. len ( ) = = 1 {
220+ if !matches ! ( & * * input, LogicalPlan :: TableScan { .. } ) || expr. len ( ) ! = 1 {
221221 return None ;
222222 }
223223
224224 // Check if the expression is a column or an alias for COUNT(*)
225225 match & expr[ 0 ] {
226226 // Direct column check
227- Expr :: Column ( Column { name, .. } ) if name == "count(*)" => Some ( name) ,
227+ Expr :: Column ( Column { name, .. } ) if name. to_lowercase ( ) == "count(*)" => Some ( name) ,
228228 // Alias for COUNT(*)
229229 Expr :: Alias ( Alias {
230230 expr : inner_expr,
231231 name : alias_name,
232232 ..
233233 } ) => {
234234 if let Expr :: Column ( Column { name, .. } ) = & * * inner_expr {
235- if name == "count(*)" {
235+ if name. to_lowercase ( ) == "count(*)" {
236236 return Some ( alias_name) ;
237237 }
238238 }
You can’t perform that action at this time.
0 commit comments