doris 2.0.10查询报错multi_distinct_count can't support multi distinct

Viewed 63

版本:2.0.10

查询报错
Execution failed: Error Failed to execute sql: java.sql.SQLException: (conn=6900) errCode = 2, detailMessage = multi_distinct_count can't support multi distinct.

在issue里面找到了https://github.com/apache/doris/pull/34592,预计哪个版本可以修复?

建表语句

CREATE TABLE `test` (
  `tm` datetime NOT NULL,
  `event_type` varchar(20) NOT NULL,
  `project` varchar(32),
  `uic_id` varchar(24),
  `component` varchar(100),
  `component_context` jsonb
) DUPLICATE KEY(`tm`, `event_type`, `project`)
PARTITION BY RANGE(`tm`) () 
DISTRIBUTED BY HASH(`event_type`, `project`) BUCKETS 10 
PROPERTIES (
  "replication_allocation" = "tag.location.default: 3"
);

查询语句

SELECT
      sta_date,
      activity_code,
      COUNT(DISTINCT CASE WHEN component = 'a' AND event_type = 'click' THEN uic_id ELSE NULL END) AS a,
      COUNT(CASE WHEN component = 'a' AND event_type = 'click' THEN uic_id ELSE NULL END) AS b,
      COUNT(DISTINCT CASE WHEN component = 'a' AND event_type = 'click' AND jump_type = '8' THEN uic_id ELSE NULL END) AS c
    FROM
      (
        SELECT
          TO_DATE(tm) AS sta_date,
          jsonb_extract_string(component_context, '$.activity_code') AS activity_code,
          uic_id,
          component,
          event_type,
          jsonb_extract_string(component_context, '$.jump_type') AS jump_type
        FROM
          test
        WHERE
          component = 'a'
          AND event_type = 'click'
      ) a
    GROUP BY
      sta_date,
      activity_code
    HAVING
      a != 0
1 Answers

您好,方便贴个case吗?比如建表语句和复现的sql 这些