ClickHouse / clickhouse-docs

Official documentation for ClickHouse
https://clickhouse.com/docs
Other
114 stars 268 forks source link

Document all ClickHouse functions. #1833

Open johnnymatthews opened 10 months ago

johnnymatthews commented 10 months ago

Problem

There are many functions in ClickHouse, but not all are documented. See https://github.com/ClickHouse/clickhouse-docs/issues/1682 https://github.com/ClickHouse/clickhouse-docs/issues/1512 as examples. This issue serves as the main holding-issue for many child/sub-issues. Essentially, if you want to know which functions have recently had documentation added, you should treat this issue as the source-of-truth.

Solution

Document 100% of the functions in ClickHouse.

Process

  1. List all the functions that exist in ClickHouse.
  2. List all the functions that have docs.
  3. Create a list of functions that don't have docs.
  4. Loop through this new list to write a description and syntax example for each function.
    1. To get this info, check the tests that each function was written with.
    2. Check in with the author of each function to get a background on why it was created.
  5. Repeat step 4 until all the functions have docs.

Scope

List each function, what it does, and a syntax example.

Example

Here is a markdown example of what a function should look like the following (a copy of this is available in the clickhouse/clickhouse repository at /docs/en/sql-reference/functions/_function-template.md):

## Example

This function serves as an example of what function documentation should look like.

**Syntax**

```sql
Example(input, secondary_input)

Parameters

Returned value

This function doesn't exists. But if it did, they it would return a bool.

Implementation details

Any additional information pertaining to this function that users might need to know about. Things like known-bugs or edge cases would fit into this section. For example, if a function used bankers rounding instead of standard rounding.

Example

Query:

CREATE TABLE example_table
(
    id UUID,
    name String,
) ENGINE = MergeTree
ORDER BY id;

INSERT INTO example_table VALUES (generateUUIDv4(), Example());
SELECT * FROM example_table;
9e22db8c-d343-4bc5-8a95-501f635c0fc4    Example


Things to note:

1. The arguments must end in a valid type and link to that type within the docs.
2. The example query must be valid and complete; a user should be able to copy and paste the query directly into fiddle.clickhouse.com and have the query run without any modifications.
3. The example result must be _similar_ to what the user can expect to see when running it in fiddle.clickhouse.com. Some functions, such as `generateUUIDv4()`, will return a random string; as such, you shouldn't try to have your example response match what the user might see.

## Out of scope

We will not:

- Create a fancy new way of searching through functions.
- Expand on or update existing function docs.
- Create in-depth guides or tutorials for each function.
- Add docs directly into [clickhouse/clickhouse](https://github.com/clickhouse/clickhouse) code.
- Showcase specific functions.

These items are valid points to improve the docs, but they're entirely separate projects that require planning and setup of their own.

## Timeline

This project should be completed in Q1 2024. So, by the end of March 2024.
johnnymatthews commented 9 months ago

After going through all the available ClickHouse functions, and searching through the docs for appropriate documentation, I've concluded that we have 449 functions without adequate documentation. See this Google Sheet. Check the Info tab for details on how the existing docs were judged.

449 function is a lot, especially given the size of the docs team. Without significant crowd-sourcing methods, it's unlikely that we'll get all of these missing functions documented by the end of March 2024.

johnnymatthews commented 9 months ago

Here's a complete list of the missing functions:

See #1919.


See #1920.


See #1921.


See #1922.


See #1923.


See #1924.


See #1925.


See #1926. Won't be documented, these functions are only for internal usage.


See #1927.


See #1928.


See #1929.


See #1930.


See #1931.


See #1932.


See #1933.


See #1934.


See #1935.


See #1936.


See #1937.


See #1938.



See #1940.


See #1941.


See #1942.


See #1943.


See #1944.


See #1918.


See #1945.


See #1946.


See #1947.


See #1948.


See #1949.


See #1950.


See #1951.


See #1953.


See #1954.


See #1955.


See #1956.


See #1957.


See #1958.


See #1959.


See #1960.


See #1961.


See #1962.


See #1963.


See #1964.


See #1965.


See #1966.


See #1967.


See #1968.


See #1969.


See #1970.


See #1971.


See #1972.


See #1973.


See #1974.


See #1975.


See #1976.


See #1977.


See #1978.


See #1979.


See #1980.


See #1981.


See #1982.


See #1983.


See #1984.


See #1985.


See #1986.


See #1987.


See #1988.


See #1989.


See #1990.


See #1991.


See #1992.


See #1993.


See #1994.


See #1995.


See #1996.


See #1997.


See #1998.


See #1999.


See #2000.


See #2001.


See #2002.


See #2003.


See #2004.


See #2005.


See #2006.


See #2007.


See #2008.


See #2009.


See #2010.


See #2011.


See #2012.


See #2013.


See #2014.


See #2015.


See #2016.


See #2017.


See #2018.


See #2019.


See #2020.


See #2021.


See #2022.


See #2023.


See #2024.


See #2025.


See #2026.


See #2027.


See #2028.


See #2029.


See #2030.


See #2031.


See #2032.


See #2033.


See #2034.


See #2035.


See #2036.


See #2037.


See #2038.


See #2039.


See #2040.


See #2041.


See #2042.

Blargian commented 8 months ago

@johnnymatthews I'd like to help out with this in between working on some code related contributions. Feel free to assign tasks to me, or alternatively I can just start from the top of the list.

johnnymatthews commented 8 months ago

Hey @Blargian, sorry for the delay in getting back to you. I've just seen a few comment and PRs from yourself, so thanks for that! If you're still interested in helping out, just keep plugging away at the issues. If you'd like specific issues to be assigned to yourself, just leave a comment in the issue saying something like "I'll work on this one" -- I'll assign it to you then :)