File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -100,8 +100,10 @@ pub async fn query(req: HttpRequest, query_request: Query) -> Result<HttpRespons
100
100
let table_name = query
101
101
. first_table_name ( )
102
102
. ok_or_else ( || QueryError :: MalformedQuery ( "No table name found in query" ) ) ?;
103
- let time = Instant :: now ( ) ;
104
103
104
+ user_auth_for_query ( & permissions, & tables) ?;
105
+
106
+ let time = Instant :: now ( ) ;
105
107
if let Some ( column_name) = query. is_logical_plan_count_without_filters ( ) {
106
108
let date_bin_request = DateBinRequest {
107
109
stream : table_name. clone ( ) ,
@@ -127,9 +129,6 @@ pub async fn query(req: HttpRequest, query_request: Query) -> Result<HttpRespons
127
129
128
130
return Ok ( HttpResponse :: Ok ( ) . json ( response) ) ;
129
131
}
130
-
131
- user_auth_for_query ( & permissions, & tables) ?;
132
-
133
132
let ( records, fields) = query. execute ( table_name. clone ( ) ) . await ?;
134
133
135
134
let response = QueryResponse {
Original file line number Diff line number Diff line change @@ -217,22 +217,22 @@ impl Query {
217
217
} ;
218
218
219
219
// 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 {
221
221
return None ;
222
222
}
223
223
224
224
// Check if the expression is a column or an alias for COUNT(*)
225
225
match & expr[ 0 ] {
226
226
// 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) ,
228
228
// Alias for COUNT(*)
229
229
Expr :: Alias ( Alias {
230
230
expr : inner_expr,
231
231
name : alias_name,
232
232
..
233
233
} ) => {
234
234
if let Expr :: Column ( Column { name, .. } ) = & * * inner_expr {
235
- if name == "count(*)" {
235
+ if name. to_lowercase ( ) == "count(*)" {
236
236
return Some ( alias_name) ;
237
237
}
238
238
}
You can’t perform that action at this time.
0 commit comments