apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.3k stars 3.21k forks source link

[Bug] Left expr of binary predicate should be column name, predicate: minute(`date`) != 59, left expr type:TINYINT #31382

Open drgnchan opened 6 months ago

drgnchan commented 6 months ago

Search before asking

Version

select version(); return 5.7.99

What's Wrong?

execute: delete from cost where minute(date) <> 59;

an error is reported: SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = errCode = 2, detailMessage = Left expr of binary predicate should be column name, predicate: minute(date) != 59, left expr type:TINYINT

What You Expected?

sql executed successfully.

How to Reproduce?

CREATE TABLE `cost` (
  `id` bigint(20) NULL,
  `name` varchar(20) NULL,
  `date` date NULL,
  `cost` bigint(20) SUM NULL
) ENGINE=OLAP
AGGREGATE KEY(`id`, `name`, `date`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`id`, `name`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

insert into cost values (1, 'abc', '2021-01-01', 100);
delete from cost where minute(date) <> 59;

Anything Else?

No response

Are you willing to submit PR?

Code of Conduct

yiguolei commented 6 months ago

@drgnchan Currently, delete where clause does not support expr or function, it only supports literal. For example, it does not support delete from cost where minute(date) <> 59; but it support delete from cost where date = '2020-11-11';