What's Missing
Three conversion function aliases registered in the Databend function registry have no documentation:
TRY_TO_DECIMAL(expr[, precision, scale]) — converts a value to DECIMAL, returning NULL on error instead of throwing
TRY_TO_NUMERIC — alias for TRY_TO_DECIMAL
TRY_TO_NUMBER — alias for TRY_TO_DECIMAL
The non-try counterparts TO_DECIMAL / TO_NUMERIC / TO_NUMBER are also undocumented, but the TRY_ variants are especially important for safe data ingestion pipelines.
Source File
/workspace/databend/src/query/functions/src/scalars/decimal/src/cast.rs
Relevant registrations:
registry.register_function_factory(
"try_to_decimal",
FunctionFactory::Closure(Box::new(move |params, args_type| {
let mut f = factory(params, args_type)?;
f.signature.name = "try_to_decimal".to_string();
Some(Arc::new(f.error_to_null()))
})),
);
registry.register_aliases("try_to_decimal", &["try_to_numeric", "try_to_number"]);
What They Do
TRY_TO_DECIMAL(expr[, precision[, scale]]) attempts to cast any numeric or string expression to a DECIMAL(precision, scale) value. Unlike TO_DECIMAL, it returns NULL rather than raising an error when the conversion fails (e.g., the input string is not a valid number, or the value overflows the target precision/scale).
TRY_TO_NUMERIC and TRY_TO_NUMBER are exact aliases.
Suggested Doc Location
/docs/en/sql-reference/20-sql-functions/02-conversion-functions/
A new page try-to-decimal.md (with title_includes: TRY_TO_NUMERIC, TRY_TO_NUMBER) should be added, mirroring the pattern of try-cast.md and the existing to-decimal.md (if it exists) or alongside to-float32.md, to-int8.md, etc.
What's Missing
Three conversion function aliases registered in the Databend function registry have no documentation:
TRY_TO_DECIMAL(expr[, precision, scale])— converts a value to DECIMAL, returning NULL on error instead of throwingTRY_TO_NUMERIC— alias forTRY_TO_DECIMALTRY_TO_NUMBER— alias forTRY_TO_DECIMALThe non-try counterparts
TO_DECIMAL/TO_NUMERIC/TO_NUMBERare also undocumented, but theTRY_variants are especially important for safe data ingestion pipelines.Source File
/workspace/databend/src/query/functions/src/scalars/decimal/src/cast.rsRelevant registrations:
What They Do
TRY_TO_DECIMAL(expr[, precision[, scale]])attempts to cast any numeric or string expression to aDECIMAL(precision, scale)value. UnlikeTO_DECIMAL, it returnsNULLrather than raising an error when the conversion fails (e.g., the input string is not a valid number, or the value overflows the target precision/scale).TRY_TO_NUMERICandTRY_TO_NUMBERare exact aliases.Suggested Doc Location
/docs/en/sql-reference/20-sql-functions/02-conversion-functions/A new page
try-to-decimal.md(withtitle_includes: TRY_TO_NUMERIC, TRY_TO_NUMBER) should be added, mirroring the pattern oftry-cast.mdand the existingto-decimal.md(if it exists) or alongsideto-float32.md,to-int8.md, etc.