Skip to content

prefer_column_name_to_alias = 1 does not work for virtual columns #35652

Closed

Description

@vmihailenco

Using ClickHouse 22.3.2:

CREATE TABLE test (
  id UInt64
)
ENGINE = MergeTree()
SAMPLE BY intHash32(id)
ORDER BY intHash32(id)

This works:

SELECT
  any(id),
  any(id) AS id
FROM test
SETTINGS prefer_column_name_to_alias = 1

But this does not:

SELECT
  any(_sample_factor),
  any(_sample_factor) AS _sample_factor
FROM test
SETTINGS prefer_column_name_to_alias = 1
SELECT
  any(_partition_id),
  any(_partition_id) AS _partition_id
FROM test
SETTINGS prefer_column_name_to_alias = 1

The error:

Received exception from server (version 22.3.2):
Code: 184. DB::Exception: Received from localhost:9000. DB::Exception: Aggregate function any(_partition_id) is found inside another aggregate function in query: While processing any(_partition_id) AS _partition_id. (ILLEGAL_AGGREGATION)

Activity

  1. added
    potential bug
    on Mar 28, 2022
  2. Algunenano commented on Jan 18, 2024

    @Algunenano
    Member

    Works fine with the analyzer

  3. added a commit that references this issue on Apr 3, 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

    potential bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions