Skip to content

Forbid using Dynamic type in JOIN keys - #86358

Merged
Avogar merged 16 commits into
ClickHouse:masterfrom
Avogar:join-on-dynamic-keys
Sep 29, 2025
Merged

Avogar merged 16 commits into
ClickHouse:masterfrom
Avogar:join-on-dynamic-keys

Conversation

@Avogar

@Avogar Avogar commented Aug 28, 2025

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Backward Incompatible Change

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

Forbid using Dynamic type in JOIN keys. It could lead to unexpected results when Dynamic type is compared to a non-Dynamic type. It's better to cast Dynamic column to the required type.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh

clickhouse-gh Bot commented Aug 28, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [85dd708]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_binary, ParallelReplicas, s3 storage, parallel) failure
02972_insert_deduplication_token_hierarchical_inserts_views FAIL
Exception in test runner FAIL
Killed by signal (in clickhouse-server.log or clickhouse-server.err.log) FAIL
Fatal messages (in clickhouse-server.log or clickhouse-server.err.log) FAIL
Integration tests (amd_binary, 4/5) failure
test_storage_iceberg_no_spark/test_writes_with_compression_metadata.py::test_writes_with_compression_metadata[local-2] FAIL
test_storage_iceberg_no_spark/test_writes_with_compression_metadata.py::test_writes_with_compression_metadata[local-1] FAIL
test_mysql_database_engine/test.py::test_mysql_types[datetime_default] FAIL
test_mysql_database_engine/test.py::test_mysql_database_engine_comment FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_4] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_80] FAIL
test_mysql_database_engine/test.py::test_mysql_ddl_for_mysql_database FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_12] FAIL
test_mysql_database_engine/test.py::test_mysql_types[float_2] FAIL
test_mysql_database_engine/test.py::test_column_comments_for_mysql_database_engine FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_10] FAIL
test_mysql_database_engine/test.py::test_bad_arguments_for_mysql_database_engine FAIL
test_mysql_database_engine/test.py::test_clickhouse_ddl_for_mysql_database FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_17] FAIL
test_mysql_database_engine/test.py::test_mysql_types[datetime_6_2] FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_2] FAIL
test_mysql_database_engine/test.py::test_mysql_types[timestamp_6] FAIL
test_mysql_database_engine/test.py::test_memory_leak FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_19] FAIL
test_mysql_database_engine/test.py::test_clickhouse_dml_for_mysql_database FAIL
test_mysql_database_engine/test.py::test_predefined_connection_configuration FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_21] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_23] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_81] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_15] FAIL
test_mysql_database_engine/test.py::test_password_leak FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_1] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_6] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_5] FAIL
test_mysql_database_engine/test.py::test_clickhouse_join_for_mysql_database FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_1] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_20] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_22] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_2] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_3] FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_18_6_2] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_16] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_14] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_24] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_7] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_9] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_13] FAIL
test_mysql_database_engine/test.py::test_mysql_types[timestamp_default] FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_40_6] FAIL
test_mysql_database_engine/test.py::test_restart_server FAIL
test_mysql_database_engine/test.py::test_mysql_types[datetime_6_1] FAIL
test_mysql_database_engine/test.py::test_data_types_support_level_for_mysql_database_engine FAIL
test_mysql_database_engine/test.py::test_mysql_types[datetime_6_3] FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_18_6_1] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_4] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_18] FAIL
test_mysql_database_engine/test.py::test_mysql_types[float_1] FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_11] FAIL
test_mysql_database_engine/test.py::test_mysql_types[decimal_3] FAIL
test_mysql_database_engine/test.py::test_backup_database FAIL
test_mysql_database_engine/test.py::test_mysql_types[common_types_25] FAIL

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Aug 28, 2025
@novikd novikd self-assigned this Sep 1, 2025

@novikd novikd 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.

In general, LGTM

Comment thread src/Planner/PlannerJoins.cpp Resolved
@Avogar

Avogar commented Sep 29, 2025

Copy link
Copy Markdown
Member Author

@Avogar
Avogar added this pull request to the merge queue Sep 29, 2025
Merged via the queue into ClickHouse:master with commit 8e4ce0a Sep 29, 2025
@Avogar
Avogar deleted the join-on-dynamic-keys branch September 29, 2025 04:53
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 29, 2025
arsenmuk pushed a commit to melvynator/ClickHouse that referenced this pull request Oct 21, 2026
The fuzzer profile enables `allow_dynamic_type_in_join_keys`, and the
oracle context copied it. With it on, the TLP `WHERE p` arm turns a
`Dynamic = UInt256` equality into a hash-join key compared after a cast
to `Dynamic`, where a `UInt64` variant never equals a `UInt256` one, while
the reference and the `not(p)` / `isNull(p)` arms keep a cross join with
an `equals` filter. The forms then legitimately disagree (the limitation
documented by ClickHouse#86358) and the oracle reported a false mismatch on
`AST fuzzer (amd_release, oracle)`.

Pin the setting off in `makeOracleContext`, next to the other settings
that make rewrite forms disagree by design. It also overrides a session
`compatibility <= 25.9`, which turns the setting on. The fuzzed query
itself keeps the setting, so crash fuzzing of Dynamic join keys stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backward-incompatible Pull request with backwards incompatible changes 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