docs: missing documentation for TRY_TO_DECIMAL, TRY_TO_NUMERIC, and TRY_TO_NUMBER conversion functions
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Domain
- documentation
Research direction
Start by reading the function registration in src/query/functions/src/scalars/decimal/src/cast.rs, then compare try-cast.md with the existing conversion-function pages under /docs/en/sql-reference/20-sql-functions/02-conversion-functions/. Add try-to-decimal.md with the documented TRY_TO_DECIMAL behavior and TRY_TO_NUMERIC and TRY_TO_NUMBER aliases; done means the page covers NULL-on-error conversion and precision/scale arguments.
Written by the indexing model from the issue text.
Description
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_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.
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 44
- Avg merge
- 2d 7m
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from databendlabs/databend-docs
-
Link Checker Report Openautomated issue report
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
databendlabs/databend-docs#3504 ·
-
Link Checker Report Openautomated issue report
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
databendlabs/databend-docs#3503 ·
-
auto-fix-done documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
databendlabs/databend-docs#3359 ·
-
auto-fix-done documentation
Difficulty 2/5 1-2 days Newbie friendliness 72/100
databendlabs/databend-docs#3356 ·
-
auto-fix documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
databendlabs/databend-docs#3302 ·
All issues in databendlabs/databend-docs
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100