mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
Merge branch 'main' into json-extract
This commit is contained in:
commit
2e730ead25
69 changed files with 6112 additions and 2208 deletions
390
core/function.rs
390
core/function.rs
|
@ -1,12 +1,13 @@
|
|||
use crate::ext::ExtFunc;
|
||||
use std::fmt;
|
||||
use std::fmt::Display;
|
||||
|
||||
#[cfg(feature = "json")]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum JsonFunc {
|
||||
Json,
|
||||
JsonArray,
|
||||
JsonExtract,
|
||||
JsonArrayLength,
|
||||
}
|
||||
|
||||
#[cfg(feature = "json")]
|
||||
|
@ -19,6 +20,7 @@ impl Display for JsonFunc {
|
|||
JsonFunc::Json => "json".to_string(),
|
||||
JsonFunc::JsonArray => "json_array".to_string(),
|
||||
JsonFunc::JsonExtract => "json_extract".to_string(),
|
||||
Self::JsonArrayLength => "json_array_length".to_string(),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -39,14 +41,14 @@ pub enum AggFunc {
|
|||
impl AggFunc {
|
||||
pub fn to_string(&self) -> &str {
|
||||
match self {
|
||||
AggFunc::Avg => "avg",
|
||||
AggFunc::Count => "count",
|
||||
AggFunc::GroupConcat => "group_concat",
|
||||
AggFunc::Max => "max",
|
||||
AggFunc::Min => "min",
|
||||
AggFunc::StringAgg => "string_agg",
|
||||
AggFunc::Sum => "sum",
|
||||
AggFunc::Total => "total",
|
||||
Self::Avg => "avg",
|
||||
Self::Count => "count",
|
||||
Self::GroupConcat => "group_concat",
|
||||
Self::Max => "max",
|
||||
Self::Min => "min",
|
||||
Self::StringAgg => "string_agg",
|
||||
Self::Sum => "sum",
|
||||
Self::Total => "total",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,46 +100,46 @@ pub enum ScalarFunc {
|
|||
impl Display for ScalarFunc {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let str = match self {
|
||||
ScalarFunc::Cast => "cast".to_string(),
|
||||
ScalarFunc::Char => "char".to_string(),
|
||||
ScalarFunc::Coalesce => "coalesce".to_string(),
|
||||
ScalarFunc::Concat => "concat".to_string(),
|
||||
ScalarFunc::ConcatWs => "concat_ws".to_string(),
|
||||
ScalarFunc::Glob => "glob".to_string(),
|
||||
ScalarFunc::IfNull => "ifnull".to_string(),
|
||||
ScalarFunc::Iif => "iif".to_string(),
|
||||
ScalarFunc::Instr => "instr".to_string(),
|
||||
ScalarFunc::Like => "like(2)".to_string(),
|
||||
ScalarFunc::Abs => "abs".to_string(),
|
||||
ScalarFunc::Upper => "upper".to_string(),
|
||||
ScalarFunc::Lower => "lower".to_string(),
|
||||
ScalarFunc::Random => "random".to_string(),
|
||||
ScalarFunc::RandomBlob => "randomblob".to_string(),
|
||||
ScalarFunc::Trim => "trim".to_string(),
|
||||
ScalarFunc::LTrim => "ltrim".to_string(),
|
||||
ScalarFunc::RTrim => "rtrim".to_string(),
|
||||
ScalarFunc::Round => "round".to_string(),
|
||||
ScalarFunc::Length => "length".to_string(),
|
||||
ScalarFunc::OctetLength => "octet_length".to_string(),
|
||||
ScalarFunc::Min => "min".to_string(),
|
||||
ScalarFunc::Max => "max".to_string(),
|
||||
ScalarFunc::Nullif => "nullif".to_string(),
|
||||
ScalarFunc::Sign => "sign".to_string(),
|
||||
ScalarFunc::Substr => "substr".to_string(),
|
||||
ScalarFunc::Substring => "substring".to_string(),
|
||||
ScalarFunc::Soundex => "soundex".to_string(),
|
||||
ScalarFunc::Date => "date".to_string(),
|
||||
ScalarFunc::Time => "time".to_string(),
|
||||
ScalarFunc::Typeof => "typeof".to_string(),
|
||||
ScalarFunc::Unicode => "unicode".to_string(),
|
||||
ScalarFunc::Quote => "quote".to_string(),
|
||||
ScalarFunc::SqliteVersion => "sqlite_version".to_string(),
|
||||
ScalarFunc::UnixEpoch => "unixepoch".to_string(),
|
||||
ScalarFunc::Hex => "hex".to_string(),
|
||||
ScalarFunc::Unhex => "unhex".to_string(),
|
||||
ScalarFunc::ZeroBlob => "zeroblob".to_string(),
|
||||
ScalarFunc::LastInsertRowid => "last_insert_rowid".to_string(),
|
||||
ScalarFunc::Replace => "replace".to_string(),
|
||||
Self::Cast => "cast".to_string(),
|
||||
Self::Char => "char".to_string(),
|
||||
Self::Coalesce => "coalesce".to_string(),
|
||||
Self::Concat => "concat".to_string(),
|
||||
Self::ConcatWs => "concat_ws".to_string(),
|
||||
Self::Glob => "glob".to_string(),
|
||||
Self::IfNull => "ifnull".to_string(),
|
||||
Self::Iif => "iif".to_string(),
|
||||
Self::Instr => "instr".to_string(),
|
||||
Self::Like => "like(2)".to_string(),
|
||||
Self::Abs => "abs".to_string(),
|
||||
Self::Upper => "upper".to_string(),
|
||||
Self::Lower => "lower".to_string(),
|
||||
Self::Random => "random".to_string(),
|
||||
Self::RandomBlob => "randomblob".to_string(),
|
||||
Self::Trim => "trim".to_string(),
|
||||
Self::LTrim => "ltrim".to_string(),
|
||||
Self::RTrim => "rtrim".to_string(),
|
||||
Self::Round => "round".to_string(),
|
||||
Self::Length => "length".to_string(),
|
||||
Self::OctetLength => "octet_length".to_string(),
|
||||
Self::Min => "min".to_string(),
|
||||
Self::Max => "max".to_string(),
|
||||
Self::Nullif => "nullif".to_string(),
|
||||
Self::Sign => "sign".to_string(),
|
||||
Self::Substr => "substr".to_string(),
|
||||
Self::Substring => "substring".to_string(),
|
||||
Self::Soundex => "soundex".to_string(),
|
||||
Self::Date => "date".to_string(),
|
||||
Self::Time => "time".to_string(),
|
||||
Self::Typeof => "typeof".to_string(),
|
||||
Self::Unicode => "unicode".to_string(),
|
||||
Self::Quote => "quote".to_string(),
|
||||
Self::SqliteVersion => "sqlite_version".to_string(),
|
||||
Self::UnixEpoch => "unixepoch".to_string(),
|
||||
Self::Hex => "hex".to_string(),
|
||||
Self::Unhex => "unhex".to_string(),
|
||||
Self::ZeroBlob => "zeroblob".to_string(),
|
||||
Self::LastInsertRowid => "last_insert_rowid".to_string(),
|
||||
Self::Replace => "replace".to_string(),
|
||||
};
|
||||
write!(f, "{}", str)
|
||||
}
|
||||
|
@ -186,37 +188,34 @@ pub enum MathFuncArity {
|
|||
impl MathFunc {
|
||||
pub fn arity(&self) -> MathFuncArity {
|
||||
match self {
|
||||
MathFunc::Pi => MathFuncArity::Nullary,
|
||||
Self::Pi => MathFuncArity::Nullary,
|
||||
Self::Acos
|
||||
| Self::Acosh
|
||||
| Self::Asin
|
||||
| Self::Asinh
|
||||
| Self::Atan
|
||||
| Self::Atanh
|
||||
| Self::Ceil
|
||||
| Self::Ceiling
|
||||
| Self::Cos
|
||||
| Self::Cosh
|
||||
| Self::Degrees
|
||||
| Self::Exp
|
||||
| Self::Floor
|
||||
| Self::Ln
|
||||
| Self::Log10
|
||||
| Self::Log2
|
||||
| Self::Radians
|
||||
| Self::Sin
|
||||
| Self::Sinh
|
||||
| Self::Sqrt
|
||||
| Self::Tan
|
||||
| Self::Tanh
|
||||
| Self::Trunc => MathFuncArity::Unary,
|
||||
|
||||
MathFunc::Acos
|
||||
| MathFunc::Acosh
|
||||
| MathFunc::Asin
|
||||
| MathFunc::Asinh
|
||||
| MathFunc::Atan
|
||||
| MathFunc::Atanh
|
||||
| MathFunc::Ceil
|
||||
| MathFunc::Ceiling
|
||||
| MathFunc::Cos
|
||||
| MathFunc::Cosh
|
||||
| MathFunc::Degrees
|
||||
| MathFunc::Exp
|
||||
| MathFunc::Floor
|
||||
| MathFunc::Ln
|
||||
| MathFunc::Log10
|
||||
| MathFunc::Log2
|
||||
| MathFunc::Radians
|
||||
| MathFunc::Sin
|
||||
| MathFunc::Sinh
|
||||
| MathFunc::Sqrt
|
||||
| MathFunc::Tan
|
||||
| MathFunc::Tanh
|
||||
| MathFunc::Trunc => MathFuncArity::Unary,
|
||||
Self::Atan2 | Self::Mod | Self::Pow | Self::Power => MathFuncArity::Binary,
|
||||
|
||||
MathFunc::Atan2 | MathFunc::Mod | MathFunc::Pow | MathFunc::Power => {
|
||||
MathFuncArity::Binary
|
||||
}
|
||||
|
||||
MathFunc::Log => MathFuncArity::UnaryOrBinary,
|
||||
Self::Log => MathFuncArity::UnaryOrBinary,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,57 +223,59 @@ impl MathFunc {
|
|||
impl Display for MathFunc {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let str = match self {
|
||||
MathFunc::Acos => "acos".to_string(),
|
||||
MathFunc::Acosh => "acosh".to_string(),
|
||||
MathFunc::Asin => "asin".to_string(),
|
||||
MathFunc::Asinh => "asinh".to_string(),
|
||||
MathFunc::Atan => "atan".to_string(),
|
||||
MathFunc::Atan2 => "atan2".to_string(),
|
||||
MathFunc::Atanh => "atanh".to_string(),
|
||||
MathFunc::Ceil => "ceil".to_string(),
|
||||
MathFunc::Ceiling => "ceiling".to_string(),
|
||||
MathFunc::Cos => "cos".to_string(),
|
||||
MathFunc::Cosh => "cosh".to_string(),
|
||||
MathFunc::Degrees => "degrees".to_string(),
|
||||
MathFunc::Exp => "exp".to_string(),
|
||||
MathFunc::Floor => "floor".to_string(),
|
||||
MathFunc::Ln => "ln".to_string(),
|
||||
MathFunc::Log => "log".to_string(),
|
||||
MathFunc::Log10 => "log10".to_string(),
|
||||
MathFunc::Log2 => "log2".to_string(),
|
||||
MathFunc::Mod => "mod".to_string(),
|
||||
MathFunc::Pi => "pi".to_string(),
|
||||
MathFunc::Pow => "pow".to_string(),
|
||||
MathFunc::Power => "power".to_string(),
|
||||
MathFunc::Radians => "radians".to_string(),
|
||||
MathFunc::Sin => "sin".to_string(),
|
||||
MathFunc::Sinh => "sinh".to_string(),
|
||||
MathFunc::Sqrt => "sqrt".to_string(),
|
||||
MathFunc::Tan => "tan".to_string(),
|
||||
MathFunc::Tanh => "tanh".to_string(),
|
||||
MathFunc::Trunc => "trunc".to_string(),
|
||||
Self::Acos => "acos".to_string(),
|
||||
Self::Acosh => "acosh".to_string(),
|
||||
Self::Asin => "asin".to_string(),
|
||||
Self::Asinh => "asinh".to_string(),
|
||||
Self::Atan => "atan".to_string(),
|
||||
Self::Atan2 => "atan2".to_string(),
|
||||
Self::Atanh => "atanh".to_string(),
|
||||
Self::Ceil => "ceil".to_string(),
|
||||
Self::Ceiling => "ceiling".to_string(),
|
||||
Self::Cos => "cos".to_string(),
|
||||
Self::Cosh => "cosh".to_string(),
|
||||
Self::Degrees => "degrees".to_string(),
|
||||
Self::Exp => "exp".to_string(),
|
||||
Self::Floor => "floor".to_string(),
|
||||
Self::Ln => "ln".to_string(),
|
||||
Self::Log => "log".to_string(),
|
||||
Self::Log10 => "log10".to_string(),
|
||||
Self::Log2 => "log2".to_string(),
|
||||
Self::Mod => "mod".to_string(),
|
||||
Self::Pi => "pi".to_string(),
|
||||
Self::Pow => "pow".to_string(),
|
||||
Self::Power => "power".to_string(),
|
||||
Self::Radians => "radians".to_string(),
|
||||
Self::Sin => "sin".to_string(),
|
||||
Self::Sinh => "sinh".to_string(),
|
||||
Self::Sqrt => "sqrt".to_string(),
|
||||
Self::Tan => "tan".to_string(),
|
||||
Self::Tanh => "tanh".to_string(),
|
||||
Self::Trunc => "trunc".to_string(),
|
||||
};
|
||||
write!(f, "{}", str)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Func {
|
||||
Agg(AggFunc),
|
||||
Scalar(ScalarFunc),
|
||||
Math(MathFunc),
|
||||
#[cfg(feature = "json")]
|
||||
Json(JsonFunc),
|
||||
Extension(ExtFunc),
|
||||
}
|
||||
|
||||
impl Display for Func {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Func::Agg(agg_func) => write!(f, "{}", agg_func.to_string()),
|
||||
Func::Scalar(scalar_func) => write!(f, "{}", scalar_func),
|
||||
Func::Math(math_func) => write!(f, "{}", math_func),
|
||||
Self::Agg(agg_func) => write!(f, "{}", agg_func.to_string()),
|
||||
Self::Scalar(scalar_func) => write!(f, "{}", scalar_func),
|
||||
Self::Math(math_func) => write!(f, "{}", math_func),
|
||||
#[cfg(feature = "json")]
|
||||
Func::Json(json_func) => write!(f, "{}", json_func),
|
||||
Self::Json(json_func) => write!(f, "{}", json_func),
|
||||
Self::Extension(ext_func) => write!(f, "{}", ext_func),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,91 +287,96 @@ pub struct FuncCtx {
|
|||
}
|
||||
|
||||
impl Func {
|
||||
pub fn resolve_function(name: &str, arg_count: usize) -> Result<Func, ()> {
|
||||
pub fn resolve_function(name: &str, arg_count: usize) -> Result<Self, ()> {
|
||||
match name {
|
||||
"avg" => Ok(Func::Agg(AggFunc::Avg)),
|
||||
"count" => Ok(Func::Agg(AggFunc::Count)),
|
||||
"group_concat" => Ok(Func::Agg(AggFunc::GroupConcat)),
|
||||
"max" if arg_count == 0 || arg_count == 1 => Ok(Func::Agg(AggFunc::Max)),
|
||||
"max" if arg_count > 1 => Ok(Func::Scalar(ScalarFunc::Max)),
|
||||
"min" if arg_count == 0 || arg_count == 1 => Ok(Func::Agg(AggFunc::Min)),
|
||||
"min" if arg_count > 1 => Ok(Func::Scalar(ScalarFunc::Min)),
|
||||
"nullif" if arg_count == 2 => Ok(Func::Scalar(ScalarFunc::Nullif)),
|
||||
"string_agg" => Ok(Func::Agg(AggFunc::StringAgg)),
|
||||
"sum" => Ok(Func::Agg(AggFunc::Sum)),
|
||||
"total" => Ok(Func::Agg(AggFunc::Total)),
|
||||
"char" => Ok(Func::Scalar(ScalarFunc::Char)),
|
||||
"coalesce" => Ok(Func::Scalar(ScalarFunc::Coalesce)),
|
||||
"concat" => Ok(Func::Scalar(ScalarFunc::Concat)),
|
||||
"concat_ws" => Ok(Func::Scalar(ScalarFunc::ConcatWs)),
|
||||
"glob" => Ok(Func::Scalar(ScalarFunc::Glob)),
|
||||
"ifnull" => Ok(Func::Scalar(ScalarFunc::IfNull)),
|
||||
"iif" => Ok(Func::Scalar(ScalarFunc::Iif)),
|
||||
"instr" => Ok(Func::Scalar(ScalarFunc::Instr)),
|
||||
"like" => Ok(Func::Scalar(ScalarFunc::Like)),
|
||||
"abs" => Ok(Func::Scalar(ScalarFunc::Abs)),
|
||||
"upper" => Ok(Func::Scalar(ScalarFunc::Upper)),
|
||||
"lower" => Ok(Func::Scalar(ScalarFunc::Lower)),
|
||||
"random" => Ok(Func::Scalar(ScalarFunc::Random)),
|
||||
"randomblob" => Ok(Func::Scalar(ScalarFunc::RandomBlob)),
|
||||
"trim" => Ok(Func::Scalar(ScalarFunc::Trim)),
|
||||
"ltrim" => Ok(Func::Scalar(ScalarFunc::LTrim)),
|
||||
"rtrim" => Ok(Func::Scalar(ScalarFunc::RTrim)),
|
||||
"round" => Ok(Func::Scalar(ScalarFunc::Round)),
|
||||
"length" => Ok(Func::Scalar(ScalarFunc::Length)),
|
||||
"octet_length" => Ok(Func::Scalar(ScalarFunc::OctetLength)),
|
||||
"sign" => Ok(Func::Scalar(ScalarFunc::Sign)),
|
||||
"substr" => Ok(Func::Scalar(ScalarFunc::Substr)),
|
||||
"substring" => Ok(Func::Scalar(ScalarFunc::Substring)),
|
||||
"date" => Ok(Func::Scalar(ScalarFunc::Date)),
|
||||
"time" => Ok(Func::Scalar(ScalarFunc::Time)),
|
||||
"typeof" => Ok(Func::Scalar(ScalarFunc::Typeof)),
|
||||
"last_insert_rowid" => Ok(Func::Scalar(ScalarFunc::LastInsertRowid)),
|
||||
"unicode" => Ok(Func::Scalar(ScalarFunc::Unicode)),
|
||||
"quote" => Ok(Func::Scalar(ScalarFunc::Quote)),
|
||||
"sqlite_version" => Ok(Func::Scalar(ScalarFunc::SqliteVersion)),
|
||||
"replace" => Ok(Func::Scalar(ScalarFunc::Replace)),
|
||||
"avg" => Ok(Self::Agg(AggFunc::Avg)),
|
||||
"count" => Ok(Self::Agg(AggFunc::Count)),
|
||||
"group_concat" => Ok(Self::Agg(AggFunc::GroupConcat)),
|
||||
"max" if arg_count == 0 || arg_count == 1 => Ok(Self::Agg(AggFunc::Max)),
|
||||
"max" if arg_count > 1 => Ok(Self::Scalar(ScalarFunc::Max)),
|
||||
"min" if arg_count == 0 || arg_count == 1 => Ok(Self::Agg(AggFunc::Min)),
|
||||
"min" if arg_count > 1 => Ok(Self::Scalar(ScalarFunc::Min)),
|
||||
"nullif" if arg_count == 2 => Ok(Self::Scalar(ScalarFunc::Nullif)),
|
||||
"string_agg" => Ok(Self::Agg(AggFunc::StringAgg)),
|
||||
"sum" => Ok(Self::Agg(AggFunc::Sum)),
|
||||
"total" => Ok(Self::Agg(AggFunc::Total)),
|
||||
"char" => Ok(Self::Scalar(ScalarFunc::Char)),
|
||||
"coalesce" => Ok(Self::Scalar(ScalarFunc::Coalesce)),
|
||||
"concat" => Ok(Self::Scalar(ScalarFunc::Concat)),
|
||||
"concat_ws" => Ok(Self::Scalar(ScalarFunc::ConcatWs)),
|
||||
"glob" => Ok(Self::Scalar(ScalarFunc::Glob)),
|
||||
"ifnull" => Ok(Self::Scalar(ScalarFunc::IfNull)),
|
||||
"iif" => Ok(Self::Scalar(ScalarFunc::Iif)),
|
||||
"instr" => Ok(Self::Scalar(ScalarFunc::Instr)),
|
||||
"like" => Ok(Self::Scalar(ScalarFunc::Like)),
|
||||
"abs" => Ok(Self::Scalar(ScalarFunc::Abs)),
|
||||
"upper" => Ok(Self::Scalar(ScalarFunc::Upper)),
|
||||
"lower" => Ok(Self::Scalar(ScalarFunc::Lower)),
|
||||
"random" => Ok(Self::Scalar(ScalarFunc::Random)),
|
||||
"randomblob" => Ok(Self::Scalar(ScalarFunc::RandomBlob)),
|
||||
"trim" => Ok(Self::Scalar(ScalarFunc::Trim)),
|
||||
"ltrim" => Ok(Self::Scalar(ScalarFunc::LTrim)),
|
||||
"rtrim" => Ok(Self::Scalar(ScalarFunc::RTrim)),
|
||||
"round" => Ok(Self::Scalar(ScalarFunc::Round)),
|
||||
"length" => Ok(Self::Scalar(ScalarFunc::Length)),
|
||||
"octet_length" => Ok(Self::Scalar(ScalarFunc::OctetLength)),
|
||||
"sign" => Ok(Self::Scalar(ScalarFunc::Sign)),
|
||||
"substr" => Ok(Self::Scalar(ScalarFunc::Substr)),
|
||||
"substring" => Ok(Self::Scalar(ScalarFunc::Substring)),
|
||||
"date" => Ok(Self::Scalar(ScalarFunc::Date)),
|
||||
"time" => Ok(Self::Scalar(ScalarFunc::Time)),
|
||||
"typeof" => Ok(Self::Scalar(ScalarFunc::Typeof)),
|
||||
"last_insert_rowid" => Ok(Self::Scalar(ScalarFunc::LastInsertRowid)),
|
||||
"unicode" => Ok(Self::Scalar(ScalarFunc::Unicode)),
|
||||
"quote" => Ok(Self::Scalar(ScalarFunc::Quote)),
|
||||
"sqlite_version" => Ok(Self::Scalar(ScalarFunc::SqliteVersion)),
|
||||
"replace" => Ok(Self::Scalar(ScalarFunc::Replace)),
|
||||
#[cfg(feature = "json")]
|
||||
"json" => Ok(Func::Json(JsonFunc::Json)),
|
||||
"json" => Ok(Self::Json(JsonFunc::Json)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_array" => Ok(Func::Json(JsonFunc::JsonArray)),
|
||||
"json_array_length" => Ok(Self::Json(JsonFunc::JsonArrayLength)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_array" => Ok(Self::Json(JsonFunc::JsonArray)),
|
||||
#[cfg(feature = "json")]
|
||||
"json_extract" => Ok(Func::Json(JsonFunc::JsonExtract)),
|
||||
"unixepoch" => Ok(Func::Scalar(ScalarFunc::UnixEpoch)),
|
||||
"hex" => Ok(Func::Scalar(ScalarFunc::Hex)),
|
||||
"unhex" => Ok(Func::Scalar(ScalarFunc::Unhex)),
|
||||
"zeroblob" => Ok(Func::Scalar(ScalarFunc::ZeroBlob)),
|
||||
"soundex" => Ok(Func::Scalar(ScalarFunc::Soundex)),
|
||||
"acos" => Ok(Func::Math(MathFunc::Acos)),
|
||||
"acosh" => Ok(Func::Math(MathFunc::Acosh)),
|
||||
"asin" => Ok(Func::Math(MathFunc::Asin)),
|
||||
"asinh" => Ok(Func::Math(MathFunc::Asinh)),
|
||||
"atan" => Ok(Func::Math(MathFunc::Atan)),
|
||||
"atan2" => Ok(Func::Math(MathFunc::Atan2)),
|
||||
"atanh" => Ok(Func::Math(MathFunc::Atanh)),
|
||||
"ceil" => Ok(Func::Math(MathFunc::Ceil)),
|
||||
"ceiling" => Ok(Func::Math(MathFunc::Ceiling)),
|
||||
"cos" => Ok(Func::Math(MathFunc::Cos)),
|
||||
"cosh" => Ok(Func::Math(MathFunc::Cosh)),
|
||||
"degrees" => Ok(Func::Math(MathFunc::Degrees)),
|
||||
"exp" => Ok(Func::Math(MathFunc::Exp)),
|
||||
"floor" => Ok(Func::Math(MathFunc::Floor)),
|
||||
"ln" => Ok(Func::Math(MathFunc::Ln)),
|
||||
"log" => Ok(Func::Math(MathFunc::Log)),
|
||||
"log10" => Ok(Func::Math(MathFunc::Log10)),
|
||||
"log2" => Ok(Func::Math(MathFunc::Log2)),
|
||||
"mod" => Ok(Func::Math(MathFunc::Mod)),
|
||||
"pi" => Ok(Func::Math(MathFunc::Pi)),
|
||||
"pow" => Ok(Func::Math(MathFunc::Pow)),
|
||||
"power" => Ok(Func::Math(MathFunc::Power)),
|
||||
"radians" => Ok(Func::Math(MathFunc::Radians)),
|
||||
"sin" => Ok(Func::Math(MathFunc::Sin)),
|
||||
"sinh" => Ok(Func::Math(MathFunc::Sinh)),
|
||||
"sqrt" => Ok(Func::Math(MathFunc::Sqrt)),
|
||||
"tan" => Ok(Func::Math(MathFunc::Tan)),
|
||||
"tanh" => Ok(Func::Math(MathFunc::Tanh)),
|
||||
"trunc" => Ok(Func::Math(MathFunc::Trunc)),
|
||||
_ => Err(()),
|
||||
"unixepoch" => Ok(Self::Scalar(ScalarFunc::UnixEpoch)),
|
||||
"hex" => Ok(Self::Scalar(ScalarFunc::Hex)),
|
||||
"unhex" => Ok(Self::Scalar(ScalarFunc::Unhex)),
|
||||
"zeroblob" => Ok(Self::Scalar(ScalarFunc::ZeroBlob)),
|
||||
"soundex" => Ok(Self::Scalar(ScalarFunc::Soundex)),
|
||||
"acos" => Ok(Self::Math(MathFunc::Acos)),
|
||||
"acosh" => Ok(Self::Math(MathFunc::Acosh)),
|
||||
"asin" => Ok(Self::Math(MathFunc::Asin)),
|
||||
"asinh" => Ok(Self::Math(MathFunc::Asinh)),
|
||||
"atan" => Ok(Self::Math(MathFunc::Atan)),
|
||||
"atan2" => Ok(Self::Math(MathFunc::Atan2)),
|
||||
"atanh" => Ok(Self::Math(MathFunc::Atanh)),
|
||||
"ceil" => Ok(Self::Math(MathFunc::Ceil)),
|
||||
"ceiling" => Ok(Self::Math(MathFunc::Ceiling)),
|
||||
"cos" => Ok(Self::Math(MathFunc::Cos)),
|
||||
"cosh" => Ok(Self::Math(MathFunc::Cosh)),
|
||||
"degrees" => Ok(Self::Math(MathFunc::Degrees)),
|
||||
"exp" => Ok(Self::Math(MathFunc::Exp)),
|
||||
"floor" => Ok(Self::Math(MathFunc::Floor)),
|
||||
"ln" => Ok(Self::Math(MathFunc::Ln)),
|
||||
"log" => Ok(Self::Math(MathFunc::Log)),
|
||||
"log10" => Ok(Self::Math(MathFunc::Log10)),
|
||||
"log2" => Ok(Self::Math(MathFunc::Log2)),
|
||||
"mod" => Ok(Self::Math(MathFunc::Mod)),
|
||||
"pi" => Ok(Self::Math(MathFunc::Pi)),
|
||||
"pow" => Ok(Self::Math(MathFunc::Pow)),
|
||||
"power" => Ok(Self::Math(MathFunc::Power)),
|
||||
"radians" => Ok(Self::Math(MathFunc::Radians)),
|
||||
"sin" => Ok(Self::Math(MathFunc::Sin)),
|
||||
"sinh" => Ok(Self::Math(MathFunc::Sinh)),
|
||||
"sqrt" => Ok(Self::Math(MathFunc::Sqrt)),
|
||||
"tan" => Ok(Self::Math(MathFunc::Tan)),
|
||||
"tanh" => Ok(Self::Math(MathFunc::Tanh)),
|
||||
"trunc" => Ok(Self::Math(MathFunc::Trunc)),
|
||||
_ => match ExtFunc::resolve_function(name, arg_count) {
|
||||
Some(ext_func) => Ok(Self::Extension(ext_func)),
|
||||
None => Err(()),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue