Skip to content

grouping function doesn't work anymore on a distributed table when allow_experimental_analyze=1 #71270

Closed

Description

@crakjie

Since clickhouse 24.3 to (at least 24.9)

Query using grouping function on top of a distributed table are not working anymore.

They are returning this error

Received exception from server (version 24.8.5):
Code: 1. DB::Exception: Received from localhost:9000. DB::Exception: Method executeImpl is not supported for 'grouping' function. (UNSUPPORTED_METHOD)

Here an exemple to reproduce
https://fiddle.clickhouse.com/6178e555-5909-47f8-86d8-7a474dcbdfef

CREATE TABLE shard_numbers (number UInt64) ENGINE=Memory;
CREATE TABLE dist_numbers (number UInt64) ENGINE=Distributed('default', '', 'shard_numbers', rand()) ;


insert into dist_numbers select number from numbers(10);
-- exemple from the test which is working
SELECT
    number,
    grouping(number, number % 2) AS gr
FROM numbers(10)
GROUP BY
    GROUPING SETS (
        (number),
        (number % 2)
    )
ORDER BY number, gr;
-- same working example with the old analyzer

SELECT
    number,
    grouping(number, number % 2) AS gr
FROM dist_numbers
GROUP BY
    GROUPING SETS (
        (number),
        (number % 2)
    )
ORDER BY number, gr SETTINGS allow_experimental_analyzer=0;

-- not working with the new analyzer

SELECT
    number,
    grouping(number, number % 2) AS gr
FROM dist_numbers
GROUP BY
    GROUPING SETS (
        (number),
        (number % 2)
    )
ORDER BY number, gr;

I try to disable one by one every settings containing the string "optimize" to see if one could have trigger this error. None seems to have solve the issue.

Version info

Activity

  1. added
    potential bug
    on Oct 30, 2024
  2. changed the title [-]grouping doesn't work anymore on a distributed table when allow_experimental_analyze=1[/-] [+]grouping function doesn't work anymore on a distributed table when allow_experimental_analyze=1[/+] on Oct 30, 2024
  3. added
    bug
    analyzer
    and removed
    potential bug
    on Nov 1, 2024
  4. andrey-mikhailov commented on Apr 9, 2025

    @andrey-mikhailov

    I have the same problem on 25.3.
    It's weird but the query works if the cluster has at least 2 shards.

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

    analyzerbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions