doris3.0.3中 percentile函数不支持double类型的字段

Viewed 57

CREATE TABLE sales_data
(
product_id INT,
sale_price DECIMAL(10, 2)
) DUPLICATE KEY(product_id)
DISTRIBUTED BY HASH(product_id) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

-- 插入示例数据
INSERT INTO sales_data VALUES
(1, 10.00),
(1, 15.00),
(1, 20.00),
(1, 25.00),
(1, 30.00),
(1, 35.00),
(1, 40.00),
(1, 45.00),
(1, 50.00),
(1, 100.00);

-- 计算不同百分位的销售价格
SELECT
percentile(sale_price, 0.5) as median_price, -- 中位数
percentile(sale_price, 0.75) as p75_price, -- 75分位数
percentile(sale_price, 0.90) as p90_price, -- 90分位数
percentile(sale_price, 0.95) as p95_price, -- 95分位数
percentile(null, 0.99) as p99_null -- null的99分位数
FROM sales_data;

--错误信息
SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = (xx.xx.xx.xx)[INTERNAL_ERROR]Agg Function percentile_array(double, array) is not implemented

3 Answers

这边本地跑这个case是正常的,请问您直接在mysql client跑这个case是否正常?image.png

image.png
在mysql client执行也是失败 版本是doris3.0.3

3.0.3/3.0.4上percentile存在问题,现象是单独一个percentile使用没有问题,多个在一起用会报错。
可以通过

set disable_nereids_rules = "MERGE_PERCENTILE_TO_ARRAY"; 

规避问题