Create a new function registry with default functions
()
| 31 | impl FunctionRegistry { |
| 32 | /// Create a new function registry with default functions |
| 33 | pub fn new() -> Self { |
| 34 | let mut registry = Self { |
| 35 | functions: HashMap::new(), |
| 36 | }; |
| 37 | |
| 38 | // Register functions - just add them here |
| 39 | registry.register("COUNT", Box::new(aggregate_functions::CountFunction::new())); |
| 40 | registry.register( |
| 41 | "AVERAGE", |
| 42 | Box::new(aggregate_functions::AverageFunction::new()), |
| 43 | ); |
| 44 | registry.register("AVG", Box::new(aggregate_functions::AverageFunction::new())); // Alias |
| 45 | registry.register("SUM", Box::new(aggregate_functions::SumFunction::new())); |
| 46 | registry.register("MIN", Box::new(aggregate_functions::MinFunction::new())); |
| 47 | registry.register("MAX", Box::new(aggregate_functions::MaxFunction::new())); |
| 48 | registry.register( |
| 49 | "COLLECT", |
| 50 | Box::new(aggregate_functions::CollectFunction::new()), |
| 51 | ); |
| 52 | registry.register("UPPER", Box::new(string_functions::UpperFunction::new())); |
| 53 | registry.register("LOWER", Box::new(string_functions::LowerFunction::new())); |
| 54 | registry.register("ROUND", Box::new(numeric_functions::RoundFunction::new())); |
| 55 | registry.register("TRIM", Box::new(string_functions::TrimFunction::new())); |
| 56 | registry.register( |
| 57 | "SUBSTRING", |
| 58 | Box::new(string_functions::SubstringFunction::new()), |
| 59 | ); |
| 60 | registry.register( |
| 61 | "REPLACE", |
| 62 | Box::new(string_functions::ReplaceFunction::new()), |
| 63 | ); |
| 64 | registry.register( |
| 65 | "REVERSE", |
| 66 | Box::new(string_functions::ReverseFunction::new()), |
| 67 | ); |
| 68 | |
| 69 | // Register temporal functions |
| 70 | registry.register( |
| 71 | "DATETIME", |
| 72 | Box::new(temporal_functions::DateTimeFunction::new()), |
| 73 | ); |
| 74 | registry.register("NOW", Box::new(temporal_functions::NowFunction::new())); |
| 75 | registry.register( |
| 76 | "DURATION", |
| 77 | Box::new(temporal_functions::DurationFunction::new()), |
| 78 | ); |
| 79 | registry.register( |
| 80 | "DURATION_NUMERIC", |
| 81 | Box::new(temporal_functions::DurationNumericFunction::new()), |
| 82 | ); |
| 83 | registry.register( |
| 84 | "TIME_WINDOW", |
| 85 | Box::new(temporal_functions::TimeWindowFunction::new()), |
| 86 | ); |
| 87 | |
| 88 | // Register standard SQL temporal convenience functions |
| 89 | registry.register( |
| 90 | "CURRENT_DATE", |