-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
kind/fixCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Milestone
Description
Describe the bug
使用窗函数lead和lag时,默认值的参数如果不为NULL时,语句报错
To Reproduce
Steps to reproduce the behavior:
- create table
CREATE TABLE `table_test` (
`active_day` date NOT NULL COMMENT "日期",
`cuid` varchar(64) NOT NULL COMMENT "操作",
`time` datetime NOT NULL COMMENT "上传时间",
`operation` varchar(64) NOT NULL COMMENT "操作"
) ENGINE=OLAP
UNIQUE KEY(`active_day`, `cuid`, `time`, `operation`)
DISTRIBUTED BY HASH(`active_day`) BUCKETS 10
PROPERTIES (
"storage_type" = "COLUMN"
);
- insert data
省略 - 查询语句中使用窗函数时提示错误
SELECT cuid,
operation,
time,
lag(operation, 1, '') over (partition BY cuid ORDER BY cuid, time) as last_op
FROM table_test limit 10;
ERROR 1064 (HY000): Type = VARCHAR() can't not convert to VARCHAR()
Expected behavior
SQL正常执行
Additional context
lag或lead的第3个参数改为null时,sql可以正常执行
SELECT cuid,
operation,
time,
lag(operation, 1, null) over (partition BY cuid ORDER BY cuid, time) as last_op
FROM table_test limit 10;
Metadata
Metadata
Assignees
Labels
kind/fixCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.