Skip to content

Docs: specify argument types explicitly - #82089

Merged
rschu1ze merged 17 commits into
masterfrom
docs-explicit-arg-types
Jun 20, 2025
Merged

rschu1ze merged 17 commits into
masterfrom
docs-explicit-arg-types

Conversation

@Blargian

Copy link
Copy Markdown
Member

Allow to specify argument and return types explicitly

Changelog category (leave one):

  • Documentation (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh

clickhouse-gh Bot commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [412d016]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-documentation Documentation PRs for the specific code PR label Jun 18, 2025
@Blargian
Blargian requested a review from rschu1ze June 18, 2025 10:23
@Blargian

This comment was marked as resolved.

@rschu1ze rschu1ze self-assigned this Jun 18, 2025
Comment thread src/Common/FunctionDocumentation.h Resolved
Comment thread src/Common/FunctionDocumentation.h Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Outdated
result += "`](/sql-reference/data-types/fixedstring)";
else if (type.starts_with("Int") || type.starts_with("UInt") || type == "(U)Int*") /// matches 'Int8', 'Int16' etc. and 'UInt8', 'UInt16' etc. and 'Int*' and '(U)Int*'
result += "`](/sql-reference/data-types/int-uint)";
else if (type.starts_with("Float") || type.starts_with("BFloat")) /// matches 'Float32', 'Float64', 'BFloat16' etc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove etc at the end of the line. The enumeration of the three types is exhaustive.

Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
@rschu1ze

This comment was marked as resolved.

@rschu1ze
rschu1ze marked this pull request as ready for review June 19, 2025 11:52
Comment thread src/Common/FunctionDocumentation.cpp Outdated
Comment on lines +128 to +132
result += "- `" + name + "` — " + description_;
/// We assume that if 'type' is empty(), 'description' already ends with the elegible type.
/// there may also be special cases where the exact argument type depends on something else or needs explanation
if (!types.empty())
result += mapTypesToTypesWithLinks(types);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rschu1ze any idea why the c++ style check doesn't like this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait for another style check result, I moved some code around in the last two commits.

Comment thread src/Functions/moduloOrZero.cpp Resolved
Comment thread src/Functions/multiplyDecimal.cpp Resolved
Comment thread src/Functions/reverse.cpp Resolved
Comment thread src/Functions/FunctionsHashingMisc.cpp Resolved
Comment thread src/Functions/vectorFunctions.cpp Resolved
Comment thread src/Functions/vectorFunctions.cpp Resolved
Comment thread src/Functions/toTimezone.cpp Resolved
Comment thread src/Functions/toStartOfTenMinutes.cpp Resolved
@rschu1ze

Copy link
Copy Markdown
Member

No test failures in OSS and the one in public is unrelated!

@rschu1ze
rschu1ze added this pull request to the merge queue Jun 20, 2025
Merged via the queue into master with commit ec0db07 Jun 20, 2025
@rschu1ze
rschu1ze deleted the docs-explicit-arg-types branch June 20, 2025 13:11
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 20, 2025
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Common/FunctionDocumentation.cpp Resolved
Comment thread src/Functions/visitParamHas.cpp Resolved
FunctionDocumentation::Description description
= R"(Converts a string to lowercase, assuming that the string contains valid UTF-8 encoded text. If this assumption is violated, no exception is thrown and the result is undefined.)";
FunctionDocumentation::Syntax syntax = "upperUTF8(input)";
FunctionDocumentation::Arguments arguments = {{"input", "Input with String type"}};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a chance that "String type" included FixedStrings, pls check.

Comment thread src/Functions/isNaN.cpp Resolved
Comment thread src/Functions/modulo.cpp Resolved
Comment thread src/Functions/multiplyDecimal.cpp Resolved
Comment thread src/Functions/changeDate.cpp Resolved
.syntax = "getClientHTTPHeader(name)",
.arguments = {{"name", "The HTTP header name (String)"}},
.returned_value = "The value of the header (String).",
.returned_value = {"The value of the header", {"String"}},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls also change l. 97.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-documentation Documentation PRs for the specific code PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants