Update system.functions table with more details by PedroTadim · Pull Request #104479 · ClickHouse/ClickHouse · GitHub
Skip to content

Update system.functions table with more details#104479

Merged
PedroTadim merged 30 commits into
masterfrom
system-functions
May 18, 2026
Merged

Update system.functions table with more details#104479
PedroTadim merged 30 commits into
masterfrom
system-functions

Conversation

@PedroTadim

@PedroTadim PedroTadim commented May 9, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

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

Add deterministic and higher_order columns to system.functions table.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

The system.functions table got new columns: deterministic, and higher_order . This helps with automated testing. For each of these columns, if the value is unknown, it outputs NULL.

Version info

  • Merged into: 26.5.1.750

@clickhouse-gh

clickhouse-gh Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label May 9, 2026
Comment thread src/Storages/System/StorageSystemFunctions.cpp Outdated
@PedroTadim PedroTadim changed the title Update system.functions system table with more details Update system.functions table with more details May 9, 2026
Comment thread src/Storages/System/StorageSystemFunctions.cpp Outdated
Comment thread src/Storages/System/StorageSystemFunctions.cpp
Comment thread docs/en/operations/system-tables/functions.md Outdated
Comment thread docs/en/operations/system-tables/functions.md Outdated
Comment thread docs/en/operations/system-tables/functions.md
@PedroTadim

Copy link
Copy Markdown
Member Author

@rschu1ze may I merge this once tests pass?

@alexey-milovidov

Copy link
Copy Markdown
Member

The FileCacheTest.SLRUFreeSpaceKeepingProtectedOnly failure on this PR is a known flaky test that was fixed in #104418. Could you please update the branch with the latest master to pick up the fix?

@PedroTadim PedroTadim enabled auto-merge May 12, 2026 16:56
Comment thread docs/en/operations/system-tables/functions.md Outdated
Comment thread docs/en/operations/system-tables/functions.md Outdated
Comment thread src/Storages/System/StorageSystemFunctions.cpp Outdated

@alexey-milovidov alexey-milovidov left a comment

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.

Overall, very good PR, thank you!

@alexey-milovidov alexey-milovidov self-assigned this May 12, 2026
@PedroTadim

This comment was marked as resolved.

Comment thread src/Common/QueryFuzzer.h Outdated
pull Bot pushed a commit to CrazyForks/ClickHouse that referenced this pull request May 14, 2026
…results

`table_function_results` is a `Tables` map protected by `table_function_results_mutex`.
All 5 production accesses (`Context::executeTableFunction`,
`Context::clearTableFunctionResults`) take the mutex before reading or writing
the map. The `ContextData(const ContextData &)` copy constructor, however,
copied the map in its initializer list:

    table_function_results(o.table_function_results),

without acquiring `o.table_function_results_mutex`. When another thread was
mutating `o.table_function_results` under the mutex (e.g. inserting a new
table-function cache entry from `Context::executeTableFunction`), TSan
reported a data race against the unsynchronized read inside the copy
constructor.

Reported via STID 1003-358c (issue ClickHouse#104807). The truncated stack from the
AST fuzzer hit on PR ClickHouse#104479 (amd_tsan) showed:

  T762 (write, holding M0): Context::executeTableFunction ->
    std::map::__insert_node_at
  T748 (read, no mutex):    ContextData::ContextData(const ContextData&) ->
    std::map __copy_construct_tree

The fix follows the established pattern used elsewhere in this file
(`QueryAccessInfo::QueryAccessInfo`, `QueryFactoriesInfo::QueryFactoriesInfo`,
`QueryPrivilegesInfo::QueryPrivilegesInfo`): take the source object's
mutex and copy the protected field in the constructor body.

PR ClickHouse#94171 originally added `table_function_results_mutex` and locked the
production readers/writers, but did not update the `ContextData` copy
constructor. This fix closes that gap.

Also adds a regression test in `gtest_context_race.cpp` that races a
writer thread (`executeTableFunction`) against a copier thread
(`Context::createCopy`). Without this fix, the TSan build reports the
race; with the fix, the test passes.

CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104479&sha=42334bfbb7d48857ed6741a30fd2a876590b1dff&name_0=PR&name_1=AST%20fuzzer%20%28amd_tsan%29

Closes ClickHouse#104807

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts:
#	src/Functions/IFunctionAdaptors.h
#	src/Functions/array/arrayFold.cpp
Comment thread src/Functions/array/FunctionsMapMiscellaneous.cpp Outdated
Comment thread src/Functions/IFunction.h
Comment thread src/Storages/System/StorageSystemFunctions.cpp Outdated
@PedroTadim

Copy link
Copy Markdown
Member Author

@alexey-milovidov, why did you remove the no-parallel tag? A SQL function is being re-created. This is going to be flaky if the test runs in parallel.

@clickhouse-gh

clickhouse-gh Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.20% 84.20% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.60% +0.00%

Changed lines: 98.53% (67/68) · Uncovered code

Full report · Diff report

@PedroTadim PedroTadim added this pull request to the merge queue May 18, 2026
Merged via the queue into master with commit aa94a6c May 18, 2026
164 of 166 checks passed
@PedroTadim PedroTadim deleted the system-functions branch May 18, 2026 12:59
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature 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.

4 participants