Skip to content

doc(udf): merge udf docs for the same function #2740

Open
@aceforeverd

Description

some UDFs may has mutiple doc string, each for different parameters type. The problem is for udf doc gen, it is unclear which doc string to publish in the generated doc (as the document only has one entry for each, it selects random one). Refer the PR #2734 .

know problem udfs

  • ilike_match
  • like_match
  • regexp_like
  • string
  • substring
  • or anything else you find

Solution

merge the multiple doc strings into single one, with all informations included. See how dayofyear implemented:

const std::string dayofyear_doc =
R"(
@brief Return the day of year for a timestamp or date. Returns 0 given an invalid date.
Example:
@code{.sql}
select dayofyear(timestamp(1590115420000));
-- output 143
select dayofyear(1590115420000);
-- output 143
select dayofyear(date("2020-05-22"));
-- output 143
select dayofyear(date("2020-05-32"));
-- output 0
@endcode
@since 0.1.0
)";
RegisterExternal("dayofyear")
.args<int64_t>(reinterpret_cast<void*>(static_cast<void (*)(int64_t, int32_t*, bool*)>(v1::dayofyear)))
.return_by_arg(true)
.returns<Nullable<int32_t>>()
.doc(dayofyear_doc);
RegisterExternal("dayofyear")
.args<Timestamp>(reinterpret_cast<void*>(static_cast<void (*)(Timestamp*, int32_t*, bool*)>(v1::dayofyear)))
.return_by_arg(true)
.returns<Nullable<int32_t>>()
.doc(dayofyear_doc);

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions