Skip to content

v23.3.13.6-lts Unexpected behaviour : NOT FOUND COLUMN IN BLOCK exception #55466

Closed

Description

@h1k

Describe the unexpected behaviour
I got an unexpected result when executing a query: NOT_FOUND_COLUMN_IN_BLOCK

How to reproduce

  • Which ClickHouse server version to use
    v23.3.13.6-lts
  • CREATE TABLE statements for all tables involved
create table default.TEST_NOT_FOUND_COLUMN_IN_BLOCK as default.TEST_NOT_FOUND_COLUMN_IN_BLOCK_merge  Engine=Distributed(cluster_test,default,TEST_NOT_FOUND_COLUMN_IN_BLOCK_merge,rand());
create table default.TEST_NOT_FOUND_COLUMN_IN_BLOCK_merge  (ID Nullable(String)) Engine= MergeTree() order by tuple() settings use_metadata_cache=true;
insert into TEST_NOT_FOUND_COLUMN_IN_BLOCK values('a'),('b'),('c')
  • Queries to run that lead to unexpected result
SELECT multiIf( (multiIf((ID is null) AND ((ID = 'a') OR (ID = 'c') OR (ID = 'b')), 'a', CAST(NULL, 'Nullable(String)')) = 'c') OR
                (multiIf((ID is null) AND ((ID = 'a') OR (ID = 'c') OR (ID = 'b')),'a',CAST(NULL, 'Nullable(String)')) ='b') OR
                (multiIf((ID is null) AND ((ID = 'a') OR (ID = 'c') OR  (ID = 'b')), 'a', CAST(NULL, 'Nullable(String)')) = 'd') OR
                (multiIf((ID is null) AND ((ID = 'a') OR (ID = 'c') OR (ID = 'b')), 'a', CAST(NULL, 'Nullable(String)')) = 'e'),
               'test', CAST(NULL, 'Nullable(String)')) AS alias,
       AVG(1)                                          AS avg_temp_alias
FROM TEST_NOT_FOUND_COLUMN_IN_BLOCK
GROUP BY alias

Expected behavior
It should perform properly and produce results.

Error message and/or stacktrace
Code: 10. DB::Exception: Not found column if(in(if(and(isNull(ID), or(equals(ID, 'a'), equals(ID, 'c'), equals(ID, 'b'))), 'a', CAST(NULL, 'Nullable(String)')), ('b', 'c', 'd', 'e')), 'test', CAST(NULL, 'Nullable(String)')) in block avg(1) Float64 Float64(size = 0). (NOT_FOUND_COLUMN_IN_BLOCK) (version 23.3.13.1)

Additional context
This is the reproduction SQL statement after my anonymization. It may look strange.
I have tested that the problem cannot be reproduced when multiple shards are specified for a single server. The problem can be reproduced only when more than two servers are sharded.

Activity

  1. added
    unexpected behaviour
    on Oct 10, 2023
  2. h1k commented on Oct 25, 2023

    @h1k
    Author

    与分析器配合使用https://fiddle.clickhouse.com/47c331d8-e8e5-444c-ade0-3443db2b674b

    Thank you for your support, but set allow_experimental_analyzer=1 will affect my other queries. Is there any plan to fix this problem?

  3. added a commit that references this issue on Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    unexpected behaviour

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions