From e54fd83f4989d778101e69814cba0ba08f27ef6d Mon Sep 17 00:00:00 2001 From: Vegard Stikbakke Date: Sun, 11 Aug 2024 13:49:16 +0200 Subject: [PATCH] Handle FunctionCallStar in analyze_expr --- core/translate/expr.rs | 18 +++++++++++++++++- testing/agg-functions.test | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/translate/expr.rs b/core/translate/expr.rs index 68a3a203c..debb1a771 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -1,3 +1,5 @@ +use core::panic; + use crate::{function::JsonFunc, Result}; use sqlite3_parser::ast::{self, Expr, UnaryOperator}; @@ -582,7 +584,21 @@ pub fn analyze_expr<'a>(expr: &'a Expr, column_info_out: &mut ColumnInfo<'a>) { column_info_out.args = args; } } - ast::Expr::FunctionCallStar { .. } => todo!(), + ast::Expr::FunctionCallStar { + name, + filter_over: _, + } => { + let func_type = + match Func::resolve_function(normalize_ident(name.0.as_str()).as_str(), 1) { + Ok(func) => Some(func), + Err(_) => None, + }; + if func_type.is_none() { + panic!("Function not found"); + } else { + column_info_out.func = func_type; + } + } _ => {} } } diff --git a/testing/agg-functions.test b/testing/agg-functions.test index 6410b1425..e7c15e1c7 100755 --- a/testing/agg-functions.test +++ b/testing/agg-functions.test @@ -35,6 +35,10 @@ do_execsql_test select-count { SELECT count(id) FROM users; } {10000} +do_execsql_test select-count { + SELECT count(*) FROM users; +} {10000} + do_execsql_test select-max { SELECT max(age) FROM users; } {100}