Skip to content

Fix three assertion failures in InverseDictionaryLookupPass#91460

Merged
nihalzp merged 5 commits intoClickHouse:masterfrom
nihalzp:fix-inverse-dict-lookup-logical-error
Dec 16, 2025
Merged

Fix three assertion failures in InverseDictionaryLookupPass#91460
nihalzp merged 5 commits intoClickHouse:masterfrom
nihalzp:fix-inverse-dict-lookup-logical-error

Conversation

@nihalzp
Copy link
Copy Markdown
Member

@nihalzp nihalzp commented Dec 4, 2025

The following queries has assertion failure:

CREATE DICTIONARY `dict` (`c0` UInt128) PRIMARY KEY (`c0`) SOURCE(NULL()) LAYOUT(FLAT()) LIFETIME(0);

SELECT *, dictGetUInt16('dict', 'c0', `t1`.`c0`) = TRUE FROM `dict` AS t1;

I assumed dictionary arguments would be validated before the pass; but it's not the case always.

The following two also have logical error because the return type of the original node and the replacement expression did not match (e.g. Nullable(UInt8) vs UInt8).

CREATE TABLE t__fuzz_0 (`color_id` UInt64, `payload` String)
ENGINE = MergeTree ORDER BY color_id;

CREATE DICTIONARY colors
(
  color_id   UInt64,
  payload String
)
PRIMARY KEY color_id
SOURCE(CLICKHOUSE(TABLE 't__fuzz_0'))
LAYOUT(HASHED())
LIFETIME(0);

SELECT equals(materialize(9), CAST('red' AS Nullable(String)) = dictGetString('colors', 'payload', color_id))
FROM t__fuzz_0;
CREATE TABLE tab__fuzz_24
(`id` LowCardinality(UInt16), `payload` LowCardinality(Nullable(Int8)))
ENGINE = MergeTree ORDER BY id;

INSERT INTO tab__fuzz_24 FORMAT Values (1,'x'), (2,'y'), (99,'z');

CREATE TABLE ref_table_all
(`id` UInt64, `name` String, `i8` String, `i16` String, `i32` String, `i64` String, `u8` String, `u16` String, `u32` String, `u64` String, `f32` String, `f64` String, `d` String, `dt` String, `uid` String, `ip4` String, `ip6` String)
ENGINE = MergeTree ORDER BY id;

CREATE DICTIONARY dictionary_all
(`id` UInt64, `name` String, `i8` String, `i16` String, `i32` String, `i64` String, `u8` String, `u16` String, `u32` String, `u64` String, `f32` String, `f64` String, `d` String, `dt` String, `uid` String, `ip4` String, `ip6` String)
PRIMARY KEY id
SOURCE(CLICKHOUSE(TABLE 'ref_table_all'))
LIFETIME(MIN 0 MAX 0)
LAYOUT(HASHED());

SELECT DISTINCT 13, *, or(-32 = dictGetInt32(toFixedString('dictionary_all', toLowCardinality(14)), toFixedString('i32', 3), id), isNotDistinctFrom(1, 9223372036854775806), toLowCardinality(19), not(equals(payload, 9223372036854775806))), isNotNull('dictGetFloat64 - plan'), id, isNotNull(1)
FROM tab__fuzz_24 PREWHERE equals(9223372036854775806, payload)
WHERE isNotDistinctFrom(id, isNotDistinctFrom(9223372036854775806, equals(1, isNotNull(9223372036854775806)))) QUALIFY and(NULL, equals(1, isZeroOrNull(1)))
ORDER BY payload DESC;

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@nihalzp nihalzp added the fuzz Problem found by one of the fuzzers label Dec 4, 2025
@nihalzp nihalzp changed the title Fix too strong assertion assumption in InverseDictionaryLookupPass Fix assertion failure in InverseDictionaryLookupPass Dec 4, 2025
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Dec 4, 2025

Workflow [PR], commit [0ad09e0]

Summary:

job_name test_name status info comment
Stateless tests (amd_msan, parallel) failure
00411_long_accurate_number_comparison_int2 FAIL cidb
BuzzHouse (amd_debug) failure
Logical error: 'Inconsistent AST formatting: the query: (STID: 2508-11b5) FAIL cidb

@clickhouse-gh clickhouse-gh bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Dec 4, 2025
@nihalzp nihalzp requested a review from novikd December 4, 2025 05:11
@nihalzp nihalzp marked this pull request as draft December 4, 2025 07:16
@KochetovNicolai
Copy link
Copy Markdown
Member

00411_long_accurate_number_comparison_int2- was too long, testart worked.

@KochetovNicolai KochetovNicolai added this pull request to the merge queue Dec 16, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 16, 2025
@nihalzp nihalzp added this pull request to the merge queue Dec 16, 2025
@nihalzp
Copy link
Copy Markdown
Member Author

nihalzp commented Dec 16, 2025

Seems like caused by a flaky test.

Merged via the queue into ClickHouse:master with commit 488dbf4 Dec 16, 2025
249 of 256 checks passed
@nihalzp nihalzp deleted the fix-inverse-dict-lookup-logical-error branch December 16, 2025 15:49
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzz Problem found by one of the fuzzers pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

3 participants