Skip to main content

SqlFunction

Enum SqlFunction 

Source
pub enum SqlFunction {
Show 129 variants Count, Sum, Avg, Min, Max, Stddev, Variance, StddevPop, StddevSamp, VarPop, VarSamp, ArrayAgg, StringAgg, GroupConcat, Listagg, Median, Mode, PercentileCont, PercentileDisc, ApproxCountDistinct, AnyValue, First, Last, BoolAnd, BoolOr, BitAnd, BitOr, BitXor, Corr, CovarPop, CovarSamp, RegrSlope, Every, RowNumber, Rank, DenseRank, Ntile, CumeDist, PercentRank, Lag, Lead, FirstValue, LastValue, NthValue, Coalesce, Nullif, Ifnull, Now, CurrentTimestamp, CurrentDate, Date, DateTrunc, Extract, DatePart, Year, Month, Day, DayOfWeek, Quarter, MakeDate, MakeTime, MakeTimestamp, MakeTimestamptz, Age, Concat, Upper, Lower, Trim, Ltrim, Rtrim, Substring, Substr, Length, CharLength, CharacterLength, ToChar, Replace, Translate, Reverse, Repeat, Lpad, Rpad, Initcap, QuoteIdent, QuoteLiteral, Left, Right, Position, Strpos, SplitPart, Abs, Sign, Round, Trunc, Truncate, Ceil, Ceiling, Floor, Power, Pow, Sqrt, Exp, Ln, Log, Log10, Log2, Mod, Sin, Cos, Tan, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh, Pi, Random, Greatest, Least, JsonObject, JsonArray, ToJson, JsonExtract, JsonExtractText, JsonArrayLength, JsonObjectKeys, JsonContains,
}
Expand description

Known SQL function names used across smelt crates.

Every function that appears in type inference, optimizer analysis, diagnostics, or test generators should have a variant here.

Variants§

§

Count

§

Sum

§

Avg

§

Min

§

Max

§

Stddev

§

Variance

§

StddevPop

§

StddevSamp

§

VarPop

§

VarSamp

§

ArrayAgg

§

StringAgg

§

GroupConcat

§

Listagg

§

Median

§

Mode

§

PercentileCont

§

PercentileDisc

§

ApproxCountDistinct

§

AnyValue

§

First

§

Last

§

BoolAnd

§

BoolOr

§

BitAnd

§

BitOr

§

BitXor

§

Corr

§

CovarPop

§

CovarSamp

§

RegrSlope

§

Every

§

RowNumber

§

Rank

§

DenseRank

§

Ntile

§

CumeDist

§

PercentRank

§

Lag

§

Lead

§

FirstValue

§

LastValue

§

NthValue

§

Coalesce

§

Nullif

§

Ifnull

§

Now

§

CurrentTimestamp

§

CurrentDate

§

Date

§

DateTrunc

§

Extract

§

DatePart

§

Year

§

Month

§

Day

§

DayOfWeek

§

Quarter

§

MakeDate

§

MakeTime

§

MakeTimestamp

§

MakeTimestamptz

§

Age

§

Concat

§

Upper

§

Lower

§

Trim

§

Ltrim

§

Rtrim

§

Substring

§

Substr

§

Length

§

CharLength

§

CharacterLength

§

ToChar

§

Replace

§

Translate

§

Reverse

§

Repeat

§

Lpad

§

Rpad

§

Initcap

§

QuoteIdent

§

QuoteLiteral

§

Left

§

Right

§

Position

§

Strpos

§

SplitPart

§

Abs

§

Sign

§

Round

§

Trunc

§

Truncate

§

Ceil

§

Ceiling

§

Floor

§

Power

§

Pow

§

Sqrt

§

Exp

§

Ln

§

Log

§

Log10

§

Log2

§

Mod

§

Sin

§

Cos

§

Tan

§

Asin

§

Acos

§

Atan

§

Atan2

§

Sinh

§

Cosh

§

Tanh

§

Pi

§

Random

§

Greatest

§

Least

§

JsonObject

json_object / json_build_object — construct JSON object from key-value pairs

§

JsonArray

json_array / json_build_array — construct JSON array from values

§

ToJson

to_json / to_jsonb / row_to_json — convert value to JSON

§

JsonExtract

json_extract / json_extract_path — extract JSON subtree (returns JSON)

§

JsonExtractText

json_extract_string / json_extract_text / json_extract_path_text / get_json_object — extract as text

§

JsonArrayLength

json_array_length — number of elements in JSON array

§

JsonObjectKeys

json_object_keys / json_keys — keys of JSON object

§

JsonContains

json_contains — JSON containment check

Implementations§

Source§

impl SqlFunction

Source

pub fn from_name(name: &str) -> Option<Self>

Look up a function by name (case-insensitive).

Accepts both canonical smelt names and dialect-specific aliases (e.g., JSON_BUILD_OBJECTJsonObject, GET_JSON_OBJECTJsonExtractText).

Source

pub fn name(&self) -> &'static str

Canonical uppercase SQL name.

Source

pub fn category(&self) -> FunctionCategory

Function category.

Source

pub fn is_aggregate(&self) -> bool

Whether this function is an aggregate function.

Source

pub fn is_window(&self) -> bool

Whether this function is a window function (ranking, distribution, or navigation).

Source

pub fn all() -> impl Iterator<Item = SqlFunction>

Iterator over all known SQL functions.

Trait Implementations§

Source§

impl Clone for SqlFunction

Source§

fn clone(&self) -> SqlFunction

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SqlFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SqlFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for SqlFunction

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SqlFunction

Source§

fn eq(&self, other: &SqlFunction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SqlFunction

Source§

impl Eq for SqlFunction

Source§

impl StructuralPartialEq for SqlFunction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.